{"id":21129593,"url":"https://github.com/pimvh/ssh","last_synced_at":"2026-05-19T17:33:09.027Z","repository":{"id":164557459,"uuid":"640006584","full_name":"pimvh/ssh","owner":"pimvh","description":"Ansible role to configure SSH","archived":false,"fork":false,"pushed_at":"2024-05-20T18:51:31.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T06:09:45.069Z","etag":null,"topics":["ansible","molecule-tested","openssh","role","ssh-ca"],"latest_commit_sha":null,"homepage":"","language":"Jinja","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/pimvh.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":"2023-05-12T18:39:46.000Z","updated_at":"2024-05-20T18:51:34.000Z","dependencies_parsed_at":"2024-11-20T21:19:24.400Z","dependency_job_id":null,"html_url":"https://github.com/pimvh/ssh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimvh%2Fssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimvh%2Fssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimvh%2Fssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimvh%2Fssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pimvh","download_url":"https://codeload.github.com/pimvh/ssh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243573491,"owners_count":20312883,"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":["ansible","molecule-tested","openssh","role","ssh-ca"],"created_at":"2024-11-20T05:25:55.134Z","updated_at":"2025-12-29T17:16:38.421Z","avatar_url":"https://github.com/pimvh.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Molecule test](https://github.com/pimvh/ssh/actions/workflows/test.yaml/badge.svg)\n# Requirements\n\n1. Ansible installed:\n\n```\nsudo apt install python3\npython3 -m ensurepip --upgrade\npip3 install ansible\n```\n\n## Required variables\n\nReview the variables as shown in defaults.\n\nA description of what the variables entails is included in the argument specification (see meta/main.yaml).\n\n```\n---\nssh_directory: /etc/ssh\n# use debian style of directory, ssh directives are loaded in first-come-first-serve order, and thus we can enforce config the best this way\nssh_config_file: \"{{ ssh_directory }}/sshd_config.d/10-sshd_config.conf\" ssh_trusted_user_ca_keys_file: \"{{ ssh_directory }}/ssh_trusted_user_ca_keys\"\n\nssh_acceptable_hostkey_crypto:\n  - rsa\n  - ecdsa\n  - ed25519\n\nssh_copy_trusted_user_cas: true\nssh_sign_host_certificate: true\nssh_add_host_certificate_to_known_hosts: true\n\n# ssh config options\nssh_print_motd: true\nssh_permit_root_login: false\n\nssh_host_certificate_validity: \"\" # 2w for 2 weeks\n# lookups work well for keys, like \"{{ lookup('ansible.builtin.file', '....pub') }} }}\" or lookup('ansible.builtin.vars', '....') }}\n# but it depends on your usage\n# take care that your resulting key is formatted correctly (e.g. it has a trailing newline) (consider using rstrip=false, within the lookup plugin)\nssh_host_ca_public_key: \"\"\nssh_host_ca_private_key: \"\"\nssh_host_ca_private_key_pass: \"\"\n\nssh_enable_validity_check: false # this role has an optional systemd service that can check the validity of hostkeys\nssh_script_folder: /usr/local/bin/\nssh_admin_email: \"\"\n\nssh_trusted_user_ca_keys: []\n# - \"key1\"\n# - \"key2\"\n\nssh_authorized_principals: []\n# - user: johndoe\n#   principals:\n#     - john\n#     - doe\n# - user: root\n#   principals:\n#     - all\n#     - root\n\nssh_host_domain: \"\"\n\nssh_revoked_keys: []\n\nssh_match_directives: []\n# For example:\n# - note: Permit Root from certain IP\n#     rule: Address 10.10.10.10\n#     results:\n#   - PermitRootLogin prohibit-password\n\n```\n\nThe ansible playbook will validate whether the correct variables are passed to the role using an argument_spec.\n\n# Example playbook\n\nMinimal (assuming you passed variables elsewhere):\n\n```\nhosts:\n  - foo\nroles:\n  - pimvh.ssh\n\n```\n\n# TLDR - What will happen if I run this\n\n- validate certain nested variables\n- configure the user SSH Certificate Authority\n  - gather the host keys from the system\n  - sign the current hostkeys with the passed ssh_host_key\n  - add the certificate to the controllers known_hosts file\n  - gather the found certificates\n- configure the host SSH Certificate Authority\n  - move the trusted user Certificate public key to the host\n  - make the authorized principle directory, and create mapping from principals to users\n  - add revoked keys\n- optionally push a service that check the validity of hostkeys every week, and email when it is about to expire.\n- template the sshd configuration file\n\n# Future Improvements\n\n- consider move logic to scripts instead of using Ansible tasks\n- allow hostkey rollover directives\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpimvh%2Fssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpimvh%2Fssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpimvh%2Fssh/lists"}