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

ssh: failure because it cannot access /etc/ssh/ssh_revoked_hosts #6308

Closed
5 of 7 tasks
tools200ms opened this issue Apr 12, 2024 · 4 comments · Fixed by #6309
Closed
5 of 7 tasks

ssh: failure because it cannot access /etc/ssh/ssh_revoked_hosts #6308

tools200ms opened this issue Apr 12, 2024 · 4 comments · Fixed by #6309
Labels
bug Something isn't working

Comments

@tools200ms
Copy link
Contributor

Description

ssh in firejail fails to establish connection throwing the following message:

Error checking host key <key removed> in revoked keys file /etc/ssh/ssh_revoked_hosts: Permission denied
Host key verification failed.

Looks like firejail prevents ssh from accessing /etc/ssh/ssh_revoked_hosts file.
With --noprofile it works, while with --profile=ssh.profile fails with a given message.

Firejail version: 0.9.72
OS: Gentoo stable

Checklist

  • The issues is caused by firejail (i.e. running the program by path (e.g. /usr/bin/vlc) "fixes" it).
  • I can reproduce the issue without custom modifications (e.g. globals.local).
  • The program has a profile. (If not, request one in https://github.com/netblue30/firejail/issues/1139)
  • The profile (and redirect profile if exists) hasn't already been fixed upstream.
  • I have performed a short search for similar issues (to avoid opening a duplicate).
    • I'm aware of browser-allow-drm yes/browser-disable-u2f no in firejail.config to allow DRM/U2F in browsers.
  • I used --profile=PROFILENAME to set the right profile. (Only relevant for AppImages)

Log

$ ssh -v 10.0.4.181
OpenSSH_9.6p1, OpenSSL 3.0.13 30 Jan 2024
debug1: Reading configuration data /home/barney/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/9999999gentoo-security.conf
debug1: Reading configuration data /etc/ssh/ssh_config.d/9999999gentoo.conf
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to 10.0.4.181 [10.0.4.181] port 22.
debug1: Connection established.
debug1: identity file /home/barney/.ssh/id_rsa type -1
debug1: identity file /home/barney/.ssh/id_rsa-cert type -1
debug1: identity file /home/barney/.ssh/id_ecdsa type -1
debug1: identity file /home/barney/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/barney/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/barney/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/barney/.ssh/id_ed25519 type -1
debug1: identity file /home/barney/.ssh/id_ed25519-cert type -1
debug1: identity file /home/barney/.ssh/id_ed25519_sk type -1
debug1: identity file /home/barney/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/barney/.ssh/id_xmss type -1
debug1: identity file /home/barney/.ssh/id_xmss-cert type -1
debug1: identity file /home/barney/.ssh/id_dsa type -1
debug1: identity file /home/barney/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_9.6
debug1: compat_banner: match: OpenSSH_9.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 10.0.4.181:22 as 'barney'
debug1: load_hostkeys: fopen /home/barney/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: <key removed>
Error checking host key <key removed> in revoked keys file /etc/ssh/ssh_revoked_hosts: Permission denied
Host key verification failed.
@glitsj16
Copy link
Collaborator

Thanks for reporting. Looks like we need to add noblacklist /etc/ssh/ssh_revoked_hosts to allow-ssh.inc. Can you confirm the below fixes this please:

$ cat ~/.config/firejail/allow-ssh.local
noblacklist /etc/ssh/ssh_revoked_hosts

If it fixes the issue you might open a PR and get credit for the fix. But let's test things first...

@tools200ms
Copy link
Contributor Author

I do confirm, fix works. No issues now.

@glitsj16
Copy link
Collaborator

I do confirm, fix works. No issues now.

Great. Thank you for confirming!

Approaching typical Friday evening pressed for time with energy-loaden children bursting into weekend-mode... I'll keep eyes on this and will open a PR during the weekend if you haven't beaten me to it :-)

Cheers

@tools200ms
Copy link
Contributor Author

Just did PR, have a good time!
Mateusz

@kmk3 kmk3 changed the title Firejailed ssh can't access /etc/ssh/ssh_revoked_hosts ssh fails because it cannot access /etc/ssh/ssh_revoked_hosts Apr 12, 2024
glitsj16 pushed a commit that referenced this issue Apr 20, 2024
The path is used in the Gentoo net-misc/openssh package (9.6_p1-r3).

Fixes #6308.
kmk3 added a commit that referenced this issue Apr 25, 2024
@kmk3 kmk3 changed the title ssh fails because it cannot access /etc/ssh/ssh_revoked_hosts ssh: failure because it cannot access /etc/ssh/ssh_revoked_hosts Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done (on RELNOTES)
Development

Successfully merging a pull request may close this issue.

2 participants