logicnow / BlueSky

An SSH tunneling solution for remote Mac-to-Mac connectivity (formerly a Mac-MSP product)
Apache License 2.0
39 stars 15 forks source link

Text wrap problem in BlueSky Admin Setup applescript #13

Closed illudium closed 6 years ago

illudium commented 6 years ago

There's additional whitespace and possibly a carriage return/newline in

do shell script "echo 'Host " & serverAddr & " UseKeychain yes' >> ~/.ssh/config"

that renders ~/.ssh/config file unusable, causing ensuing ssh (outgoing) connections to fail. The resulting config file shows the following which should of course all be on one line:

Host XX.ip.address
   Use Keychain yes

The problem might only occur if said file already has an entry.

sphen13 commented 6 years ago

i have seen this elsewhere too. i dont think the multi-line entry is the issue but actually that it is not respecting previous entires and creating a line-wrap issue between the old and the new. going to look to fix this.

sphen13 commented 6 years ago

ok i duplicated it - its actually when your existing config file doesn't contain a newline character at the end of it (which is relatively hard to do) - so the echo ends up not writing on a newline.

simple idea would be to just include a newline before bluesky admin setup writes to the file - better would be to check for the lack of newline and act accordingly

sphen13 commented 6 years ago

i fixed this but am waiting for #14 to me merged before i submit. it will require a change within something in the docker image as well.

for reference: https://github.com/sphen13/BlueSky/blob/992c39b2c5584f5d59faf5620eb2925b888a4033/Admin%20Tools/setup.applescript#L57