{"id":13814835,"url":"https://github.com/k4yt3x/sshd_config","last_synced_at":"2025-04-05T07:03:07.640Z","repository":{"id":47293469,"uuid":"301594878","full_name":"k4yt3x/sshd_config","owner":"k4yt3x","description":"K4YT3X's Hardened OpenSSH Server Configuration","archived":false,"fork":false,"pushed_at":"2024-11-07T23:21:17.000Z","size":36,"stargazers_count":125,"open_issues_count":0,"forks_count":21,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-29T06:02:54.719Z","etag":null,"topics":["hardening","linux","openssh","security","ssh"],"latest_commit_sha":null,"homepage":"https://k4t.io/sshd","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k4yt3x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-06T02:37:47.000Z","updated_at":"2025-03-19T17:17:52.000Z","dependencies_parsed_at":"2024-02-12T04:29:43.720Z","dependency_job_id":"9e62354a-5ff8-4b96-b729-203efd16b6be","html_url":"https://github.com/k4yt3x/sshd_config","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4yt3x%2Fsshd_config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4yt3x%2Fsshd_config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4yt3x%2Fsshd_config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4yt3x%2Fsshd_config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k4yt3x","download_url":"https://codeload.github.com/k4yt3x/sshd_config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299831,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hardening","linux","openssh","security","ssh"],"created_at":"2024-08-04T04:02:38.290Z","updated_at":"2025-04-05T07:03:07.623Z","avatar_url":"https://github.com/k4yt3x.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"# K4YT3X's Hardened OpenSSH Server Configuration\n\nThis repository hosts my hardened version of OpenSSH server (\u003e=8.5) configuration file. You will need to modify the configuration according to the error messages if you want to use this configuration for older versions of OpenSSH.\n\n**Please review the configuration file carefully before applying it.** You are responsible for actions done to your own systems.\n\nIn addition to this configuration, you may also want to check out the [SSH Hardening Guides](https://www.ssh-audit.com/hardening_guides.html).\n\n## Usages\n\n1. Download the file `sshd_config` from the repository\n1. **Review the content of the `sshd_config` file to make sure all settings are suitable for your system**\n1. Backup your current `/etc/ssh/sshd_config` file\n1. Overwrite the old `sshd_config` file with the downloaded `sshd_config` file\n1. Run the appropriate command to restart the SSH service (e.g., `sudo systemctl restart ssh`)\n\n```shell\n# download the configuration file from GitHub using curl or other methods\ncurl https://raw.githubusercontent.com/k4yt3x/sshd_config/master/sshd_config -o ~/sshd_config\n\n# backup the original sshd_config\nsudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup\n\n# replace the old sshd_config with the new one\nsudo mv ~/sshd_config /etc/ssh/sshd_config\n\n# make sure the file has the correct ownership and permissions\nsudo chown root:root /etc/ssh/sshd_config\nsudo chmod 644 /etc/ssh/sshd_config\n\n# use systemctl to reload the SSH server and apply the new configurations\n# on some distributions the SSH server service is called sshd\nsudo systemctl restart ssh\n```\n\nFor convenience, I have pointed the URL `https://kt.ax/sshd` to the `sshd_config` file. You may therefore download the `sshd_config` file with the following command. However, be sure to check the integrity of the file after downloading it if you choose to download using this method.\n\n```shell\ncurl -L kt.ax/sshd -o sshd_config\n```\n\nIt's recommended to use the [ssh-audit](https://github.com/jtesta/ssh-audit) script to check the cryptographic strength of your SSH server after done configuring it.\n\n## Deactivating Short Diffie-Hellman Moduli\n\nDiffie-Hellman moduli used for `diffie-hellman-group-exchange-sha256` should be at lest 3072 bits long according to [Mozilla's OpenSSH server hardening guide](https://infosec.mozilla.org/guidelines/openssh#modern-openssh-67). This can be done with the following commands.\n\n```shell\n# backup original moduli file\ncp /etc/ssh/moduli /etc/ssh/moduli.backup\n\n# find lines with moduli \u003e= 3071 bits and save them to moduli.tmp\nawk '$5 \u003e= 3071' /etc/ssh/moduli \u003e /etc/ssh/moduli.tmp\n\n# overwrite original moduli file with the updated one\nmv /etc/ssh/moduli.tmp /etc/ssh/moduli\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk4yt3x%2Fsshd_config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk4yt3x%2Fsshd_config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk4yt3x%2Fsshd_config/lists"}