ssh logs about missing host certificates #6399

Closed
opened 2025-11-02 06:54:45 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @42wim on GitHub (Nov 27, 2020).

  • Gitea version (or commit ref):
    7ec1c13f53 (release/v1.13)
  • Operating system:
    Self-build docker image

Description

Every ssh connection now logs

Could not load host certificate "/data/ssh/ssh_host_ed25519_cert": No such file or directory
Could not load host certificate "/data/ssh/ssh_host_rsa_cert": No such file or directory
Could not load host certificate "/data/ssh/ssh_host_ecdsa_cert": No such file or directory
Could not load host certificate "/data/ssh/ssh_host_dsa_cert": No such file or directory

Introduced by #13143

Maybe make this opt-in?

Originally created by @42wim on GitHub (Nov 27, 2020). - Gitea version (or commit ref): 7ec1c13f53f35d422343185d2ab8cf379e24c14e (release/v1.13) - Operating system: Self-build docker image ## Description Every ssh connection now logs ``` Could not load host certificate "/data/ssh/ssh_host_ed25519_cert": No such file or directory Could not load host certificate "/data/ssh/ssh_host_rsa_cert": No such file or directory Could not load host certificate "/data/ssh/ssh_host_ecdsa_cert": No such file or directory Could not load host certificate "/data/ssh/ssh_host_dsa_cert": No such file or directory ``` Introduced by #13143 Maybe make this opt-in?
Author
Owner

@zeripath commented on GitHub (Nov 27, 2020):

So these are actually more warnings than errors and don't have any effect on the running of the sshd server. They simply mean that if the cert files exist they are used.

The alternative would mean that if you wanted to use a certificate you'd have to change the sshd.conf in addition to add them in. I guess it might be possible to generate the sshd.conf with a template and variables?

@zeripath commented on GitHub (Nov 27, 2020): So these are actually more warnings than errors and don't have any effect on the running of the sshd server. They simply mean that if the cert files exist they are used. The alternative would mean that if you wanted to use a certificate you'd have to change the sshd.conf in addition to add them in. I guess it might be possible to generate the sshd.conf with a template and variables?
Author
Owner

@42wim commented on GitHub (Nov 27, 2020):

I'm personally going to add those to my gitea config, but could be annoying for users as it's filling logs with every connection (I'm running it behind a loadbalancer with a healthcheck).

Feel free to close also if not worth the effort.

@42wim commented on GitHub (Nov 27, 2020): I'm personally going to add those to my gitea config, but could be annoying for users as it's filling logs with every connection (I'm running it behind a loadbalancer with a healthcheck). Feel free to close also if not worth the effort.
Author
Owner

@zeripath commented on GitHub (Nov 27, 2020):

I guess if you stuck some environment variable and template checks around 3f13e07849/docker/root/etc/templates/sshd_config (L11) and the other places it would work.

Wouldn't be too much work - only issue is I guess you would have to remember to change the file manually if you restarted the docker and wanted to add them in.

@zeripath commented on GitHub (Nov 27, 2020): I guess if you stuck some environment variable and template checks around https://github.com/go-gitea/gitea/blob/3f13e078491753827e5e44f7133d3f58113f6fb4/docker/root/etc/templates/sshd_config#L11 and the other places it would work. Wouldn't be too much work - only issue is I guess you would have to remember to change the file manually if you restarted the docker and wanted to add them in.
Author
Owner

@joseluisq commented on GitHub (Dec 28, 2020):

The same error here when I have upgraded my PostgreSQL database to a major version then I got:

Could not load host certificate "/data/ssh/ssh_host_ed25519_cert": No such file or directory
Could not load host certificate "/data/ssh/ssh_host_rsa_cert": No such file or directory
Could not load host certificate "/data/ssh/ssh_host_ecdsa_cert": No such file or directory
Could not load host certificate "/data/ssh/ssh_host_dsa_cert": No such file or directory
Server listening on :: port 22.
Server listening on 0.0.0.0 port 22.
2020/12/28 22:34:24 cmd/web.go:108:runWeb() [I] Starting Gitea on PID: 14
2020/12/28 22:34:24 ...dules/setting/git.go:91:newGit() [I] Git Version: 2.26.2, Wire Protocol Version 2 Enabled
2020/12/28 22:34:24 routers/init.go:130:GlobalInit() [T] AppPath: /app/gitea/gitea
2020/12/28 22:34:24 routers/init.go:131:GlobalInit() [T] AppWorkPath: /app/gitea
2020/12/28 22:34:24 routers/init.go:132:GlobalInit() [T] Custom path: /data/gitea
2020/12/28 22:34:24 routers/init.go:133:GlobalInit() [T] Log path: /data/gitea/log
Received signal 15; terminating.

In my case the Docker service doesn't start anymore because the error signal.

@joseluisq commented on GitHub (Dec 28, 2020): The same error here when I have upgraded my PostgreSQL database to a major version then I got: ```log Could not load host certificate "/data/ssh/ssh_host_ed25519_cert": No such file or directory Could not load host certificate "/data/ssh/ssh_host_rsa_cert": No such file or directory Could not load host certificate "/data/ssh/ssh_host_ecdsa_cert": No such file or directory Could not load host certificate "/data/ssh/ssh_host_dsa_cert": No such file or directory Server listening on :: port 22. Server listening on 0.0.0.0 port 22. 2020/12/28 22:34:24 cmd/web.go:108:runWeb() [I] Starting Gitea on PID: 14 2020/12/28 22:34:24 ...dules/setting/git.go:91:newGit() [I] Git Version: 2.26.2, Wire Protocol Version 2 Enabled 2020/12/28 22:34:24 routers/init.go:130:GlobalInit() [T] AppPath: /app/gitea/gitea 2020/12/28 22:34:24 routers/init.go:131:GlobalInit() [T] AppWorkPath: /app/gitea 2020/12/28 22:34:24 routers/init.go:132:GlobalInit() [T] Custom path: /data/gitea 2020/12/28 22:34:24 routers/init.go:133:GlobalInit() [T] Log path: /data/gitea/log Received signal 15; terminating. ``` In my case the Docker service doesn't start anymore because the error signal.
Author
Owner

@techknowlogick commented on GitHub (Dec 29, 2020):

@joseluisq the Could not load host certificate logs are warnings, and be safely ignored per above. The issue you are facing is Received signal 15; terminating. which means your binary is being OOM killed and is facing an unrelated issue to this one. Please hop into chat, or create a new forum thread and we can help walk you through finding out where all your memory went.

@techknowlogick commented on GitHub (Dec 29, 2020): @joseluisq the `Could not load host certificate` logs are warnings, and be safely ignored per above. The issue you are facing is `Received signal 15; terminating.` which means your binary is being OOM killed and is facing an unrelated issue to this one. Please hop into chat, or create a new forum thread and we can help walk you through finding out where all your memory went.
Author
Owner

@joseluisq commented on GitHub (Dec 29, 2020):

@joseluisq the Could not load host certificate logs are warnings, and be safely ignored per above. The issue you are facing is Received signal 15; terminating. which means your binary is being OOM killed and is facing an unrelated issue to this one. Please hop into chat, or create a new forum thread and we can help walk you through finding out where all your memory went.

@techknowlogick yeah I have realized after fix the issue because a bad Gitea config.

@joseluisq commented on GitHub (Dec 29, 2020): > @joseluisq the `Could not load host certificate` logs are warnings, and be safely ignored per above. The issue you are facing is `Received signal 15; terminating.` which means your binary is being OOM killed and is facing an unrelated issue to this one. Please hop into chat, or create a new forum thread and we can help walk you through finding out where all your memory went. @techknowlogick yeah I have realized after fix the issue because a bad Gitea config.
Author
Owner

@toddnni commented on GitHub (May 10, 2021):

A note. /etc/s6/openssh/setup inside the Docker image generates

ssh_host_dsa_key
ssh_host_dsa_key.pub
ssh_host_ecdsa_key
ssh_host_ecdsa_key.pub
ssh_host_ed25519_key
ssh_host_ed25519_key.pub
ssh_host_rsa_key
ssh_host_rsa_key.pub

So maybe the sshd_config template is just pointing to wrong files, eg. /data/ssh/ssh_host_ed25519_cert instead of /data/ssh/ssh_host_ed25519_key.pub.

SSH daemon seems to get the public keys from the private keys also, but prints warning on each connection.

@toddnni commented on GitHub (May 10, 2021): A note. `/etc/s6/openssh/setup` inside the Docker image generates ssh_host_dsa_key ssh_host_dsa_key.pub ssh_host_ecdsa_key ssh_host_ecdsa_key.pub ssh_host_ed25519_key ssh_host_ed25519_key.pub ssh_host_rsa_key ssh_host_rsa_key.pub So maybe the sshd_config template is just pointing to wrong files, eg. `/data/ssh/ssh_host_ed25519_cert` instead of `/data/ssh/ssh_host_ed25519_key.pub`. SSH daemon seems to get the public keys from the private keys also, but prints warning on each connection.
Author
Owner

@zeripath commented on GitHub (May 10, 2021):

No. Those are different things.

Just ignore the "errors" they're irrelevant.

@zeripath commented on GitHub (May 10, 2021): No. Those are different things. Just ignore the "errors" they're irrelevant.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6399