cloudposse / bastion

🔒Secure Bastion implemented as Docker Container running Alpine Linux with Google Authenticator & DUO MFA support
https://cloudposse.com/accelerate
Apache License 2.0
640 stars 112 forks source link

chsh: PAM: Authentication failure #46

Closed jbarop closed 1 year ago

jbarop commented 5 years ago

Hi,

I can't get the latest version to run. 0.4.4 works fine.

docker run -it -p 1234:22 \
     -e MFA_PROVIDER=google-authenticator \
     -v ~/.ssh/authorized_keys:/root/.ssh/authorized_keys \
     cloudposse/bastion:latest
Initializing duo
Initializing enforcer
- Enabling Enforcer
- Enabling Clean Home
Initializing google-authenticator
- Enabling Google Authenticator MFA
Initializing hostname
Initializing rate-limit
- Enabling Rate Limits
- Users will be locked for 300s after 5 failed logins
- Fail delay of 3000000 micro-seconds
Initializing secure-proc
- Locking down /proc
Initializing slack
Initializing ssh-audit
- Enabling SSH Audit Logs
Password:

It ask for an password and then outputs:

chsh: PAM: Authentication failure
FATAL: Failed to initialize

System: macOS 10.14.5 with Docker version 18.09.2, build 6247962

maikelmertens commented 4 years ago

Have the same problem with 0.5.0, switching back to 0.4.4 does work fine though.

joshes commented 4 years ago

If you can run without SSH_AUDIT_ENABLED you can workaround via:

Looked into the root issue, but no joy yet.

DownRangeDevOps commented 4 years ago

The reason you're getting a password prompt is because of a missing or misconfigured PAM module. To use chsh without a password prompt, two things must be true.

The pam_shells.so module must be active (usually in /etc/pam.d/chsh):

auth     required     pam_shells.so

And the current shell you're using, plus the shell you want to change to, must be listed in /etc/shells.

I'll open a PR with the fix.

ajhool commented 4 years ago

@joshes is there a security concern with disabling that flag?

akomlik commented 4 years ago

the simple fix would be to run usermod -s /usr/bin/sudosh root instead in /etc/init.d/ssh-audit script

max-lobur commented 1 year ago

Fixed in master now