SSH Certificate Authority in known_hosts blocks podman
Issue Description
If an SSH Certificate Authority is configured in .ssh/known_hosts to validate the authenticity of a host, it blocks podman from executing.
Steps to reproduce the issue
Steps to reproduce the issue
- Insert an SSH Certificate Authority into ~/.ssh/known_hosts
@cert-authority * ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0r3m1p5UmD0L0rS1t4m3tC0n53c7e7Ur4D1p15c1n6 Lorem Ipsum - Initialise a Podman Machine
podman machine init - Start Podman Machine
podman machine start - Attempt a podman command that communicates with the podman machine instance
podman system info
Describe the results you received
Podman exits with the following error
podman --log-level debug system info
INFO[0000] podman filtering at log level debug
DEBU[0000] Called info.PersistentPreRunE(podman --log-level debug system info)
DEBU[0000] SSH Ident Key "/Users/username/.local/share/containers/podman/machine/machine" SHA256:t6Ol1r4g+5hhhDO4E3Zr6LnMARNhXywEz6zLx/58ngY ssh-ed25519
Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
Error: unable to connect to Podman socket: failed to connect: ssh: handshake failed: ssh: no common algorithm for host key; we offered: [[email protected]], peer offered: [rsa-sha2-512 rsa-sha2-256 ecdsa-sha2-nistp256 ssh-ed25519]
DEBU[0000] Shutting down engines
Describe the results you expected
The podman command should execute without error
podman --log-level debug ps -a
INFO[0000] podman filtering at log level debug
DEBU[0000] Called ps.PersistentPreRunE(podman --log-level debug ps -a)
DEBU[0000] SSH Ident Key "/Users/username/.local/share/containers/podman/machine/machine" SHA256:t6Ol1r4g+5hhhDO4E3Zr6LnMARNhXywEz6zLx/58ngY ssh-ed25519
DEBU[0000] DoRequest Method: GET URI: http://d/v5.7.1/libpod/_ping
DEBU[0000] DoRequest Method: GET URI: http://d/v5.7.1/libpod/containers/json
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
DEBU[0000] Called ps.PersistentPostRunE(podman --log-level debug ps -a)
DEBU[0000] Shutting down engines
### podman info output
```yaml
Client:
APIVersion: 5.7.1
BuildOrigin: pkginstaller
Built: 1765378539
BuiltTime: Wed Dec 10 06:55:39 2025
GitCommit: f845d14e941889ba4c071f35233d09b29d363c75
GoVersion: go1.25.5
Os: darwin
OsArch: darwin/amd64
Version: 5.7.1
host:
arch: amd64
buildahVersion: 1.42.2
cgroupControllers:
- cpu
- io
- memory
- pids
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.1.13-2.fc43.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.1.13, commit: '
cpuUtilization:
idlePercent: 99.92
systemPercent: 0.05
userPercent: 0.03
cpus: 2
databaseBackend: sqlite
distribution:
distribution: fedora
variant: coreos
version: "43"
emulatedArchitectures:
- linux/arm64
- linux/arm64be
eventLogger: journald
freeLocks: 2048
hostname: localhost.localdomain
idMappings:
gidmap:
- container_id: 0
host_id: 1000
size: 1
- container_id: 1
host_id: 100000
size: 1000000
uidmap:
- container_id: 0
host_id: 501
size: 1
- container_id: 1
host_id: 100000
size: 1000000
kernel: 6.17.7-300.fc43.x86_64
linkmode: dynamic
logDriver: journald
memFree: 1353105408
memTotal: 2047524864
networkBackend: netavark
networkBackendInfo:
backend: netavark
dns:
package: aardvark-dns-1.17.0-1.fc43.x86_64
path: /usr/libexec/podman/aardvark-dns
version: aardvark-dns 1.17.0
package: netavark-1.17.1-1.fc43.x86_64
path: /usr/libexec/podman/netavark
version: netavark 1.17.1
ociRuntime:
name: crun
package: crun-1.24-1.fc43.x86_64
path: /usr/bin/crun
version: |-
crun version 1.24
commit: 54693209039e5e04cbe3c8b1cd5fe2301219f0a1
rundir: /run/user/501/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
os: linux
pasta:
executable: /usr/sbin/pasta
package: passt-0^20250919.g623dbf6-1.fc43.x86_64
version: |
pasta 0^20250919.g623dbf6-1.fc43.x86_64
Copyright Red Hat
GNU General Public License, version 2 or later
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
remoteSocket:
exists: true
path: unix:///run/user/501/podman/podman.sock
rootlessNetworkCmd: pasta
security:
apparmorEnabled: false
capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
rootless: true
seccompEnabled: true
seccompProfilePath: /usr/share/containers/seccomp.json
selinuxEnabled: true
serviceIsRemote: true
slirp4netns:
executable: /usr/sbin/slirp4netns
package: slirp4netns-1.3.1-3.fc43.x86_64
version: |-
slirp4netns version 1.3.1
commit: e5e368c4f5db6ae75c2fce786e31eef9da6bf236
libslirp: 4.9.1
SLIRP_CONFIG_VERSION_MAX: 6
libseccomp: 2.6.0
swapFree: 0
swapTotal: 0
uptime: 5h 32m 12.00s (Approximately 0.21 days)
variant: ""
plugins:
authorization: null
log:
- k8s-file
- none
- passthrough
- journald
network:
- bridge
- macvlan
- ipvlan
volume:
- local
registries:
search:
- docker.io
store:
configFile: /var/home/core/.config/containers/storage.conf
containerStore:
number: 0
paused: 0
running: 0
stopped: 0
graphDriverName: overlay
graphOptions: {}
graphRoot: /var/home/core/.local/share/containers/storage
graphRootAllocated: 106769133568
graphRootUsed: 4276117504
graphStatus:
Backing Filesystem: xfs
Native Overlay Diff: "true"
Supports d_type: "true"
Supports shifting: "false"
Supports volatile: "true"
Using metacopy: "false"
imageCopyTmpDir: /var/tmp
imageStore:
number: 0
runRoot: /run/user/501/containers
transientStore: false
volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
APIVersion: 5.7.1
BuildOrigin: 'Copr: packit/containers-podman-27732'
Built: 1765238400
BuiltTime: Mon Dec 8 16:00:00 2025
GitCommit: f845d14e941889ba4c071f35233d09b29d363c75
GoVersion: go1.25.4 X:nodwarf5
Os: linux
OsArch: linux/amd64
Version: 5.7.1
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
sw_vers
ProductName: macOS
ProductVersion: 15.7.3
BuildVersion: 24G419
Additional information
The issue can be mitigated if the SSH Certificate Authority is restricted to be more restrictive than the catch-all of *
Catch-All:
@cert-authority * ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0r3m1p5UmD0L0rS1t4m3tC0n53c7e7Ur4D1p15c1n6 Lorem Ipsum
Limited to *.localdomain:
@cert-authority *.localdomain ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0r3m1p5UmD0L0rS1t4m3tC0n53c7e7Ur4D1p15c1n6 Lorem Ipsum
This issue does not interfere with Podman Remote connections over ssh, to check the remote host against the SSH Certificate Authority and execute remote podman commands without issues.
podman --connection $remote system info
runs without issues
The issue affects the local podman machine running on the locally.
podman --connection podman-machine-default system info
would error out.
A friendly reminder that this issue had no activity for 30 days.
/assign
I'm working on this. Root cause: ValidateAndConfigure in go.podman.io/common/pkg/ssh loads known_hosts and sets HostKeyAlgorithms even for machine connections, which ignore the host key anyway (InsecureIgnoreHostKey). A @cert-authority marker then restricts the offered algorithms to cert-only types the machine server doesn't present → handshake fails. Fix in podman-container-tools/container-libs#1197.
I believe the proposed change in skeema/knownhosts#17 could also fix this indirectly. In brief, it would work around the problem where @cert-authority * ... wildcard lines erroneously cause x/crypto/ssh/knownhosts to treat all hosts as "known", which then causes skeema/knownhosts to populate HostKeyAlgorithms incorrectly. Instead the host would be treated as unknown in this specific situation, resulting in the default permissive algo list being used.
That said, the changes described in podman-container-tools/container-libs#1197 seem reasonable to me as a shorter-term fix (with the important caveat that I'm not familiar with the podman codebase). One question about that approach though: in which situations is insecureIsMachineConnection false? Those would still be affected by the wildcard match issue here, if I understand correctly.
cc'ing @l0rd for input based on https://github.com/containers/common/pull/2212 - thanks!