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

publicKey option not working. #36

Open
mohanramanujam opened this issue Feb 27, 2018 · 1 comment
Open

publicKey option not working. #36

mohanramanujam opened this issue Feb 27, 2018 · 1 comment

Comments

@mohanramanujam
Copy link

Hi

The connection closes immediately

command invoked:
docker run --rm -p 2222:22 -v /var/run/docker.sock:/var/run/docker.sock -v ./authorized_keys:/authorized_keys --name sshd-python-docker -e FILTERS={"name":["^/python-docker$"]} -e AUTH_MECHANISM=publicKey -e AUTHORIZED_KEYS=/authorized_keys jeroenpeeters/docker-ssh

I have tested NoAuth, multiUser, etc. and they all work fine but publicKey is not working

here is error log:
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
[2018-02-27T20:21:36.702Z] INFO: sshServer/32 on be42859d55fb: Docker filter (filter={"name":["^/python-docker$"]})
[2018-02-27T20:21:36.733Z] INFO: webserver/32 on be42859d55fb: Listening (host=::, port=8022)
[2018-02-27T20:21:36.734Z] INFO: sshServer/32 on be42859d55fb: Docker-SSH ~ Because every container should be accessible
[2018-02-27T20:21:36.734Z] INFO: sshServer/32 on be42859d55fb: Listening (host=0.0.0.0, port=22)
[2018-02-27T20:22:01.281Z] INFO: sshServer/32 on be42859d55fb: Client connected (clientIp=172.17.0.1)
[2018-02-27T20:22:01.414Z] INFO: publicKeyAuth/32 on be42859d55fb: Checking public key against authorized keys (user=mohan)
fs.js:732
var r = binding.read(fd, buffer, offset, length, position);
^

Error: EISDIR: illegal operation on a directory, read
at Error (native)
at Object.fs.readSync (fs.js:732:19)
at tryReadSync (fs.js:487:20)
at Object.fs.readFileSync (fs.js:535:19)
at Client.module.exports (/usr/src/app/src/auth/publicKeyAuth.coffee:18:8)
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
[2018-02-27T20:22:02.287Z] INFO: sshServer/38 on be42859d55fb: Docker filter (filter={"name":["^/python-docker$"]})
[2018-02-27T20:22:02.316Z] INFO: webserver/38 on be42859d55fb: Listening (host=::, port=8022)
[2018-02-27T20:22:02.317Z] INFO: sshServer/38 on be42859d55fb: Docker-SSH ~ Because every container should be accessible
[2018-02-27T20:22:02.318Z] INFO: sshServer/38 on be42859d55fb: Listening (host=0.0.0.0, port=22)

@jeroenpeeters
Copy link
Owner

It seems that ./authorized_keys is a directory while it should be a file containing one key per line.

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

2 participants