Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commented authorized_keys file bug #48

Open
balmung-fr opened this issue Aug 10, 2018 · 0 comments
Open

Commented authorized_keys file bug #48

balmung-fr opened this issue Aug 10, 2018 · 0 comments

Comments

@balmung-fr
Copy link

balmung-fr commented Aug 10, 2018

Hi,

As per man 8 sshd, we can put # commented lines or empty lines in a standard authorized_keys file :

AUTHORIZED_KEYS FILE FORMAT
AuthorizedKeysFile specifies the files containing public keys for public key authentication; if this option is not specified, the default is ~/.ssh/authorized_keys and ~/.ssh/authorized_keys2. Each line of the file contains one key (empty lines and lines
starting with a ‘#’ are ignored as comments).

But with docker-ssh, if I use a comment in this file :

me@somewhere:$ cat authorized_keys
# This is a regular comment
ssh-rsa AAAA_my_pretty _secret_key_here_kfjlkfjqlskfjzfzjb key comment

I get this error thrown :

[2018-08-10T17:18:23.221Z] INFO: publicKeyAuth/33 on 7e7ad76cb459: Checking public key against authorized keys (user=root)
/usr/src/app/node_modules/ssh2-streams/lib/utils.js:352
throw new Error('Missing data generated by parseKey()');
^

Error: Missing data generated by parseKey()
at Object.genPublicKey (/usr/src/app/node_modules/ssh2-streams/lib/utils.js:352:11)
at /usr/src/app/src/auth/publicKeyAuth.coffee:21:37
at Array.forEach (native)
at Client.module.exports (/usr/src/app/src/auth/publicKeyAuth.coffee:18:64)
at emitOne (events.js:96:13)
at Client.emit (events.js:188:7)
at SSH2Stream.onUSERAUTH_REQUEST (/usr/src/app/node_modules/ssh2/lib/server.js:240:12)
at emitMany (events.js:127:13)
at SSH2Stream.emit (events.js:201:7)
at parsePacket (/usr/src/app/node_modules/ssh2-streams/lib/ssh.js:3625:10)
at SSH2Stream._transform (/usr/src/app/node_modules/ssh2-streams/lib/ssh.js:551:13)
at SSH2Stream.Transform._read (_stream_transform.js:167:10)
at SSH2Stream._read (/usr/src/app/node_modules/ssh2-streams/lib/ssh.js:212:15)
at SSH2Stream.Transform._write (_stream_transform.js:155:12)
at doWrite (_stream_writable.js:331:12)
at writeOrBuffer (_stream_writable.js:317:5)
at SSH2Stream.Writable.write (_stream_writable.js:243:11)
at Socket.ondata (_stream_readable.js:555:20)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:547:20)

error: Forever detected script exited with code: 1
error: Script restart attempt #1

Would you mind patching your code to accept comments and empty lines (I have not tested if an empty line is hitting the same bug, just to mention) ?

Thanx for your valuable software by the way and have a great day !

Fred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant