docker-ssh
docker-ssh copied to clipboard
TypeError: Cannot read property 'length' of undefined
Here Is my Docker FIle
SSH:
container_name: SSHD
image: jeroenpeeters/docker-ssh
restart: always
ports:
- "2222:22"
environment:
- HTTP_ENABLED=true
- FILTERS={\"name\":[\"^/Container-Nginx$$\"]}
- AUTH_MECHANISM=publicKey
- AUTHORIZED_KEYS=/authorized_keys
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./authorized_keys:/authorized_keys
networks:
-com-Network
Here is the log when i connect
SSH | [2018-05-23T06:28:49.519Z] INFO: sshServer/37 on 552beea9b467: Client connected (clientIp=172.18.0.1)
SSH | [2018-05-23T06:28:49.667Z] INFO: publicKeyAuth/37 on 552beea9b467: Checking public key against authorized keys (user=root)
SSH | [2018-05-23T06:28:49.669Z] INFO: publicKeyAuth/37 on 552beea9b467: Found authorized key matching client key at /authorized_keys:1
SSH | [2018-05-23T06:28:49.670Z] INFO: publicKeyAuth/37 on 552beea9b467: Public key auth succeeded (user=root)
SSH | [2018-05-23T06:28:49.757Z] INFO: sessionHandler/37 on 552beea9b467: Opening shell
SSH | /usr/src/app/src/session-handler-factory.coffee:21
SSH | for (i = j = 0, ref = length - text.length; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {
SSH | ^
SSH |
SSH | TypeError: Cannot read property 'length' of undefined
SSH | at /usr/src/app/src/session-handler-factory.coffee:7:41
SSH | at spaces (/usr/src/app/src/session-handler-factory.coffee:25:7)
SSH | at header (/usr/src/app/src/session-handler-factory.coffee:13:34)
SSH | at Session.<anonymous> (/usr/src/app/src/session-handler-factory.coffee:81:28)
SSH | at emitTwo (events.js:106:13)
SSH | at Session.emit (events.js:191:7)
SSH | at SSH2Stream.onREQUEST (/usr/src/app/node_modules/ssh2/lib/server.js:653:16)
SSH | at emitOne (events.js:96:13)
SSH | at SSH2Stream.emit (events.js:188:7)
SSH | at parse_CHANNEL_REQUEST (/usr/src/app/node_modules/ssh2-streams/lib/ssh.js:4356:8)
SSH | at parsePacket (/usr/src/app/node_modules/ssh2-streams/lib/ssh.js:3727:12)
SSH | at SSH2Stream._transform (/usr/src/app/node_modules/ssh2-streams/lib/ssh.js:551:13)
SSH | at SSH2Stream.Transform._read (_stream_transform.js:167:10)
SSH | at SSH2Stream._read (/usr/src/app/node_modules/ssh2-streams/lib/ssh.js:212:15)
SSH | at SSH2Stream.Transform._write (_stream_transform.js:155:12)
SSH | at doWrite (_stream_writable.js:331:12)
SSH | at writeOrBuffer (_stream_writable.js:317:5)
SSH | at SSH2Stream.Writable.write (_stream_writable.js:243:11)
SSH | at Socket.ondata (_stream_readable.js:555:20)
SSH | at emitOne (events.js:96:13)
SSH | at Socket.emit (events.js:188:7)
SSH | at readableAddChunk (_stream_readable.js:176:18)
SSH | at Socket.Readable.push (_stream_readable.js:134:10)
SSH | at TCP.onread (net.js:547:20)
As it is connecting but error is in /usr/src/app/src/session-handler-factory.coffee:21
In my case this meant my filter wasn't matching any of my running containers. Are you sure you have a container with name Container-Nginx
, and did you mean to have two $
at the end of your filter?
Had the same issue with wrong filter name. Changing name helped.
How do you test the filter out?
How do we test the filter out? I'm having the same problem.