Ansible role to configure the OpenSSH Server SSHD.
The main goal of this role is to manage the sshd.conf file. And some additional parts like deploying the defined ssh host keys at the configured path.
Use Eliptic cureve cryptografie for your ssh keys:
ssh-keygen -t ed25519The default values of this role will only allow ed25519 keys. But you can change that obviously if you like.
This role is designed to manage linux hosts with the following roles. This role here basically only focuses on a good configuration of sshd and can define which users are allowd to use connect via ssh and which ssh key types are allowd. Other roles distribute ssh public keys, creating users and configure sudo permission, roll out dotfiles or install a number of useful packages.
A list of suggested roles to manage your linux host:
- do1jlr.base install some useful packages
- do1jlr.users create user and manage sudoers
- do1jlr.auth deploy ssh pubkeys
- do1jlr.sshd (this one)
- do1jlr.dotfiles deploy some fancy dotfiles
The listed roles use the same variables to create accounts, admins and so on. But the roles have to run in the correct order to work properly. For example you can't deploy a ssh public key for a user that is not created.
Remember: Have a look into defaults/main.yml for all possible variables.
- 
SSH Port 
 The OpenSSH Port is defined with the variablesshd__port: 22. Change it if you wish.
- 
Allowed Users and Groups 
 The default users that are allowd to login come from theusers: {}list.
 The sameusers: {}variable is used in the other recomended ssh roles.
 A example to allow the login for the users and groups calledl3dandottojoare:
users:
  l3d:
    - l3d
  ottojo:
   - ottojo@uni
   - ottojo@home
- 
SSH Login via Passwort 
 The SSH Passwort auth is set to false viasshd__password_authentication: false. This won't allow you to use your passwort to login via SSH.
- 
Manage SSH Key Types 
 By default this role configure which ssh key types are allowed to login. If you don't want to define that change thesshd__manage_key_types: truevariable.
- 
Define allowed ssh key types 
 The allowed SSH Key Types are defined with this list. Some of them are commented out.
 Please not that by defualt onlyed25519keys are allowed. Keep that in mind if you are using a rsa key.
  sshd__key_types:
  - 'ed25519'
  # - 'rsa'
  # - 'ecdsa'
  # - 'dsa' # (do not use!)
- 
Advanced SSH Algorithm Settings 
 You can define the used Key and Kex Algorithm here to. For the default values and some examples for the variablessshd__key_algorithmusandsshd__kex_algorithmushave a look intodefaults/main.yml. You can disable it by settingsshd__manage_key_algorithmusandsshd__manage_kex_algorithmustofalse.
- 
force new SSH Features 
 If you know that you use a ssh version>8you can optionally define it withtrue/falsewith thesshd__version_is_above_eightvariable.
The main task of this role is to configure the sshd.conf file.
This role is tested with some linting tests. Sadly I don't know how to run this role in a docker container because systemd is involved... If you have ideas how to improve testing please dend me a message, open a issue or Pull Request. If you want to find out more about our tests, please have a look at the github marketplace.
| test status | Github Marketplace | 
|---|---|
| publish-ansible-role-to-galaxy | |
| yamllint-github-action | |
| ansible-lint action |