mirror of
https://github.com/dev-sec/ansible-collection-hardening
synced 2024-11-10 09:14:18 +00:00
Merge branch 'migrate_ssh' into collection
This commit is contained in:
commit
d49e05f8e8
30 changed files with 2138 additions and 0 deletions
714
roles/ssh_hardening/CHANGELOG.md
Normal file
714
roles/ssh_hardening/CHANGELOG.md
Normal file
|
@ -0,0 +1,714 @@
|
|||
# Changelog
|
||||
|
||||
## [9.8.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.8.0) (2020-10-15)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/9.7.0...9.8.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- add SuSE support [\#328](https://github.com/dev-sec/ansible-ssh-hardening/pull/328) ([schurzi](https://github.com/schurzi))
|
||||
- update readme to new layout for vars [\#326](https://github.com/dev-sec/ansible-ssh-hardening/pull/326) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- fix litner errors [\#322](https://github.com/dev-sec/ansible-ssh-hardening/pull/322) ([schurzi](https://github.com/schurzi))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Fix PasswordAuthentication for sftponly [\#327](https://github.com/dev-sec/ansible-ssh-hardening/pull/327) ([danmichaelo](https://github.com/danmichaelo))
|
||||
|
||||
## [9.7.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.7.0) (2020-08-16)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/9.6.0...9.7.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- add separate option for controlling motd via pam [\#320](https://github.com/dev-sec/ansible-ssh-hardening/pull/320) ([schurzi](https://github.com/schurzi))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- MOTD Enabled prints MOTD twice on Ubuntu [\#319](https://github.com/dev-sec/ansible-ssh-hardening/issues/319)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- install systemd in fedora [\#321](https://github.com/dev-sec/ansible-ssh-hardening/pull/321) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [9.6.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.6.0) (2020-07-28)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/9.5.0...9.6.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- add SmartOS support [\#294](https://github.com/dev-sec/ansible-ssh-hardening/pull/294) ([aqw](https://github.com/aqw))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- fix local kitchen tests [\#318](https://github.com/dev-sec/ansible-ssh-hardening/pull/318) ([schurzi](https://github.com/schurzi))
|
||||
- fix sftp\_umask; store as literal not octal [\#317](https://github.com/dev-sec/ansible-ssh-hardening/pull/317) ([aqw](https://github.com/aqw))
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Make SSH banner path configurable [\#315](https://github.com/dev-sec/ansible-ssh-hardening/issues/315)
|
||||
|
||||
## [9.5.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.5.0) (2020-07-27)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/9.4.0...9.5.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- add ssh\_banner\_path variable [\#316](https://github.com/dev-sec/ansible-ssh-hardening/pull/316) ([liteua](https://github.com/liteua))
|
||||
- rework CRYPTO\_POLICY handling for fedora [\#314](https://github.com/dev-sec/ansible-ssh-hardening/pull/314) ([schurzi](https://github.com/schurzi))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- network\_ipv6\_enable: true not working [\#311](https://github.com/dev-sec/ansible-ssh-hardening/issues/311)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- RHEL/CentOS 8 requires removal or editing of /etc/crypto-policies/back-ends/openssh\*.config [\#275](https://github.com/dev-sec/ansible-ssh-hardening/issues/275)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- improve testing in kitchen and travis [\#313](https://github.com/dev-sec/ansible-ssh-hardening/pull/313) ([schurzi](https://github.com/schurzi))
|
||||
|
||||
## [9.4.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.4.0) (2020-07-21)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/9.3.0...9.4.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Add CentOS 8 support for ansible-ssh-hardening [\#247](https://github.com/dev-sec/ansible-ssh-hardening/issues/247)
|
||||
- adding specific things for IPv6 support [\#312](https://github.com/dev-sec/ansible-ssh-hardening/pull/312) ([altf4arnold](https://github.com/altf4arnold))
|
||||
- add support for CentOS8 [\#309](https://github.com/dev-sec/ansible-ssh-hardening/pull/309) ([schurzi](https://github.com/schurzi))
|
||||
- README: New section on server port and idempotency [\#307](https://github.com/dev-sec/ansible-ssh-hardening/pull/307) ([nununo](https://github.com/nununo))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- CBC Ciphers should be disabled by default. [\#308](https://github.com/dev-sec/ansible-ssh-hardening/issues/308)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Idempotency when changing sshd ports [\#299](https://github.com/dev-sec/ansible-ssh-hardening/issues/299)
|
||||
- Simplify crypto.yml checks with blocks [\#256](https://github.com/dev-sec/ansible-ssh-hardening/issues/256)
|
||||
- Possibility for customising host key algorithms? [\#243](https://github.com/dev-sec/ansible-ssh-hardening/issues/243)
|
||||
|
||||
## [9.3.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.3.0) (2020-07-09)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/9.2.0...9.3.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Add support for X11 configuration [\#297](https://github.com/dev-sec/ansible-ssh-hardening/issues/297)
|
||||
- add blocks to crypto.yml checks [\#305](https://github.com/dev-sec/ansible-ssh-hardening/pull/305) ([schurzi](https://github.com/schurzi))
|
||||
- fix typo in hardening.yml [\#304](https://github.com/dev-sec/ansible-ssh-hardening/pull/304) ([schurzi](https://github.com/schurzi))
|
||||
- allow customization of X11Forwarding [\#300](https://github.com/dev-sec/ansible-ssh-hardening/pull/300) ([divialth](https://github.com/divialth))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- fix package install in tests [\#301](https://github.com/dev-sec/ansible-ssh-hardening/pull/301) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Typo in hardening.yml [\#303](https://github.com/dev-sec/ansible-ssh-hardening/issues/303)
|
||||
- Task create sshd\_config and set permissions fails [\#302](https://github.com/dev-sec/ansible-ssh-hardening/issues/302)
|
||||
|
||||
## [9.2.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.2.0) (2020-06-25)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/9.1.1...9.2.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Add RHEL 8 Support [\#261](https://github.com/dev-sec/ansible-ssh-hardening/issues/261)
|
||||
- Add option to create 'LocalPort' match blocks [\#295](https://github.com/dev-sec/ansible-ssh-hardening/pull/295) ([aisbergg](https://github.com/aisbergg))
|
||||
- Add archlinux support [\#291](https://github.com/dev-sec/ansible-ssh-hardening/pull/291) ([djesionek](https://github.com/djesionek))
|
||||
- Harmonize style [\#290](https://github.com/dev-sec/ansible-ssh-hardening/pull/290) ([aisbergg](https://github.com/aisbergg))
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- add centos 8 to meta [\#298](https://github.com/dev-sec/ansible-ssh-hardening/pull/298) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [9.1.1](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.1.1) (2020-06-06)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/9.1.0...9.1.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- unify changelog and release actions [\#289](https://github.com/dev-sec/ansible-ssh-hardening/pull/289) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- AllowTCPForwarding set to `no` although I have `ssh\_allow\_tcp\_forwarding: yes` [\#286](https://github.com/dev-sec/ansible-ssh-hardening/issues/286)
|
||||
- `ssh\_allow\_tcp\_forwarding`: use quotes for values [\#288](https://github.com/dev-sec/ansible-ssh-hardening/pull/288) ([jeanmonet](https://github.com/jeanmonet))
|
||||
|
||||
## [9.1.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.1.0) (2020-06-02)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/9.0.0...9.1.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- allow customization of login gracetime and max sessins [\#287](https://github.com/dev-sec/ansible-ssh-hardening/pull/287) ([chris-rock](https://github.com/chris-rock))
|
||||
|
||||
## [9.0.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/9.0.0) (2020-05-18)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/8.1.0...9.0.0)
|
||||
|
||||
**Breaking changes:**
|
||||
|
||||
- make ssh client-side compression configurable [\#284](https://github.com/dev-sec/ansible-ssh-hardening/pull/284) ([aqw](https://github.com/aqw))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Disable Ubuntu dynamic login MOTD [\#271](https://github.com/dev-sec/ansible-ssh-hardening/issues/271)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Ubuntu disable dynamic MOTD failing [\#283](https://github.com/dev-sec/ansible-ssh-hardening/issues/283)
|
||||
|
||||
## [8.1.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/8.1.0) (2020-05-09)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/8.0.0...8.1.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- add changelog and release workflow [\#282](https://github.com/dev-sec/ansible-ssh-hardening/pull/282) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- fix: Ansible part of Fedora build [\#281](https://github.com/dev-sec/ansible-ssh-hardening/pull/281) ([kostasns](https://github.com/kostasns))
|
||||
- Add changelog action [\#280](https://github.com/dev-sec/ansible-ssh-hardening/pull/280) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- fix: Amazon linux build [\#279](https://github.com/dev-sec/ansible-ssh-hardening/pull/279) ([kostasns](https://github.com/kostasns))
|
||||
- feat: Allow to set custom list of HostKeyAlgorithms [\#278](https://github.com/dev-sec/ansible-ssh-hardening/pull/278) ([kostasns](https://github.com/kostasns))
|
||||
- fix\(ansible\_facts\): replace few remaining facts from 'ansible\_' to using 'ansible\_facts' dictionary [\#277](https://github.com/dev-sec/ansible-ssh-hardening/pull/277) ([kostasns](https://github.com/kostasns))
|
||||
|
||||
## [8.0.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/8.0.0) (2020-04-21)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/7.0.0...8.0.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Remove dependency on bash [\#265](https://github.com/dev-sec/ansible-ssh-hardening/issues/265)
|
||||
- Possibility to use other value than yes/no for AllowTCPforwarding [\#255](https://github.com/dev-sec/ansible-ssh-hardening/issues/255)
|
||||
- Add support for Debian Buster in ansible-ssh-hardening [\#248](https://github.com/dev-sec/ansible-ssh-hardening/issues/248)
|
||||
- Some options not configurable via the role [\#239](https://github.com/dev-sec/ansible-ssh-hardening/issues/239)
|
||||
- PermitUserEnvironment should not be conflated with AcceptEnv [\#232](https://github.com/dev-sec/ansible-ssh-hardening/issues/232)
|
||||
- Disable also dynamic MOTD via PAM if enabled - refs \#271 [\#273](https://github.com/dev-sec/ansible-ssh-hardening/pull/273) ([ancoron](https://github.com/ancoron))
|
||||
- Use sha2 HMACs on RHEL 6 / CentOS 6. [\#270](https://github.com/dev-sec/ansible-ssh-hardening/pull/270) ([foonix](https://github.com/foonix))
|
||||
- Removing 2fa [\#269](https://github.com/dev-sec/ansible-ssh-hardening/pull/269) ([dennisse](https://github.com/dennisse))
|
||||
- Renaming Ansible variables discovered from systems [\#268](https://github.com/dev-sec/ansible-ssh-hardening/pull/268) ([PovilasGT](https://github.com/PovilasGT))
|
||||
- Do not use bash to get ssh version [\#266](https://github.com/dev-sec/ansible-ssh-hardening/pull/266) ([kljensen](https://github.com/kljensen))
|
||||
- Add 'all', 'local', 'yes', 'no' options support for AllowTcpForwarding variable [\#257](https://github.com/dev-sec/ansible-ssh-hardening/pull/257) ([brnck](https://github.com/brnck))
|
||||
- Support KEX for OpenSSH 8.0+ & quantum resistant KEX [\#254](https://github.com/dev-sec/ansible-ssh-hardening/pull/254) ([lunarthegrey](https://github.com/lunarthegrey))
|
||||
- SFTP: set default umask to 0027 [\#252](https://github.com/dev-sec/ansible-ssh-hardening/pull/252) ([Slamdunk](https://github.com/Slamdunk))
|
||||
- Separate PermitUserEnviroment from AcceptEnv [\#251](https://github.com/dev-sec/ansible-ssh-hardening/pull/251) ([szEvEz](https://github.com/szEvEz))
|
||||
- Feature: Debian 10 \(Buster\) support [\#249](https://github.com/dev-sec/ansible-ssh-hardening/pull/249) ([jaredledvina](https://github.com/jaredledvina))
|
||||
- fix broken packages, extend README with furhter development instructions [\#246](https://github.com/dev-sec/ansible-ssh-hardening/pull/246) ([szEvEz](https://github.com/szEvEz))
|
||||
- refactor authenticationmethod settings, allow user to set authenticat… [\#245](https://github.com/dev-sec/ansible-ssh-hardening/pull/245) ([szEvEz](https://github.com/szEvEz))
|
||||
- RHEL/OL/CentOS 8 support [\#242](https://github.com/dev-sec/ansible-ssh-hardening/pull/242) ([Furragen](https://github.com/Furragen))
|
||||
- Added ssh\_syslog\_facility, ssh\_log\_level and ssh\_strict\_modes parameters [\#240](https://github.com/dev-sec/ansible-ssh-hardening/pull/240) ([bschonec](https://github.com/bschonec))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- HostKey comment "\# Req 20" breaks key based auth [\#262](https://github.com/dev-sec/ansible-ssh-hardening/issues/262)
|
||||
- SSH fails to start/connect if custom server ports is set on CentOS 7.6 [\#212](https://github.com/dev-sec/ansible-ssh-hardening/issues/212)
|
||||
- Google 2fa authentication problem [\#170](https://github.com/dev-sec/ansible-ssh-hardening/issues/170)
|
||||
- vars: remove empty main.yml file [\#274](https://github.com/dev-sec/ansible-ssh-hardening/pull/274) ([paulfantom](https://github.com/paulfantom))
|
||||
- Only manage moduli when hardening server [\#267](https://github.com/dev-sec/ansible-ssh-hardening/pull/267) ([jbronn](https://github.com/jbronn))
|
||||
- Remove comment from sshd config HostKey param [\#263](https://github.com/dev-sec/ansible-ssh-hardening/pull/263) ([abtreece](https://github.com/abtreece))
|
||||
|
||||
## [7.0.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/7.0.0) (2019-09-15)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/6.2.0...7.0.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Add new option ssh\_server\_match\_address [\#230](https://github.com/dev-sec/ansible-ssh-hardening/issues/230)
|
||||
- set UsePAM to yes by default [\#233](https://github.com/dev-sec/ansible-ssh-hardening/pull/233) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Unable to connect after applying the role \(Ubuntu 18.04, AWS EC2\) [\#229](https://github.com/dev-sec/ansible-ssh-hardening/issues/229)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Can't connect to new instance created from hardened image [\#189](https://github.com/dev-sec/ansible-ssh-hardening/issues/189)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- changed string comparison to version comparison [\#234](https://github.com/dev-sec/ansible-ssh-hardening/pull/234) ([gobind-singh](https://github.com/gobind-singh))
|
||||
|
||||
## [6.2.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/6.2.0) (2019-08-05)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/6.1.3...6.2.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- added support for `ssh\_server\_match\_address` \(\#230\) [\#231](https://github.com/dev-sec/ansible-ssh-hardening/pull/231) ([MatthiasLohr](https://github.com/MatthiasLohr))
|
||||
|
||||
## [6.1.3](https://github.com/dev-sec/ansible-ssh-hardening/tree/6.1.3) (2019-06-09)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/6.1.2...6.1.3)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Fix squash\_actions deprecation in test playbooks [\#228](https://github.com/dev-sec/ansible-ssh-hardening/pull/228) ([Normo](https://github.com/Normo))
|
||||
- Fix deprecation warnings in Ansible 2.8 [\#227](https://github.com/dev-sec/ansible-ssh-hardening/pull/227) ([Normo](https://github.com/Normo))
|
||||
- Make ansible-lint happy [\#204](https://github.com/dev-sec/ansible-ssh-hardening/pull/204) ([alexclear](https://github.com/alexclear))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- deprecation warnings in Ansible 2.8 [\#226](https://github.com/dev-sec/ansible-ssh-hardening/issues/226)
|
||||
|
||||
## [6.1.2](https://github.com/dev-sec/ansible-ssh-hardening/tree/6.1.2) (2019-05-17)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/6.1.1...6.1.2)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- sshd\_custom\_options used in ssh\_config generation [\#224](https://github.com/dev-sec/ansible-ssh-hardening/issues/224)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- use correct variable ssh\_custom\_options in ssh\_config template [\#225](https://github.com/dev-sec/ansible-ssh-hardening/pull/225) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [6.1.1](https://github.com/dev-sec/ansible-ssh-hardening/tree/6.1.1) (2019-05-07)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/6.1.0...6.1.1)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Missing indent for `ChrootDirectory` in `Match Group sftponly` [\#221](https://github.com/dev-sec/ansible-ssh-hardening/issues/221)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fix indentation for matches [\#222](https://github.com/dev-sec/ansible-ssh-hardening/pull/222) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [6.1.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/6.1.0) (2019-05-04)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/6.0.0...6.1.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- PermitRootLogin yes [\#190](https://github.com/dev-sec/ansible-ssh-hardening/issues/190)
|
||||
- Match Group' in configuration but 'user' not in connection test specification [\#188](https://github.com/dev-sec/ansible-ssh-hardening/issues/188)
|
||||
- Allow custom values [\#175](https://github.com/dev-sec/ansible-ssh-hardening/issues/175)
|
||||
- use selinux fact to check if selinux is used [\#220](https://github.com/dev-sec/ansible-ssh-hardening/pull/220) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Remove eol os and add fedora [\#218](https://github.com/dev-sec/ansible-ssh-hardening/pull/218) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- document and move custom variables [\#217](https://github.com/dev-sec/ansible-ssh-hardening/pull/217) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- fix: allow other ssh ports using selinux [\#214](https://github.com/dev-sec/ansible-ssh-hardening/pull/214) ([guilieb](https://github.com/guilieb))
|
||||
- Fix ssh and sshd config files to satisfy inspec reqs on all Testkitchen setups [\#203](https://github.com/dev-sec/ansible-ssh-hardening/pull/203) ([alexclear](https://github.com/alexclear))
|
||||
- enable ssh 7.7p1 support [\#202](https://github.com/dev-sec/ansible-ssh-hardening/pull/202) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Using more than one rule in a Group or User Match block? [\#207](https://github.com/dev-sec/ansible-ssh-hardening/issues/207)
|
||||
- fix multiple match rules not working \#207 [\#208](https://github.com/dev-sec/ansible-ssh-hardening/pull/208) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [6.0.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/6.0.0) (2018-11-18)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/5.0.0...6.0.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Ubuntu 18.04 support [\#182](https://github.com/dev-sec/ansible-ssh-hardening/issues/182)
|
||||
- Removed DEPRECATION WARNING for apt, using list instead of with\_items [\#201](https://github.com/dev-sec/ansible-ssh-hardening/pull/201) ([jonaswre](https://github.com/jonaswre))
|
||||
- Update opensshd.conf.js [\#196](https://github.com/dev-sec/ansible-ssh-hardening/pull/196) ([ikr0m](https://github.com/ikr0m))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- GSSAPI support broken. Can't be enabled. [\#192](https://github.com/dev-sec/ansible-ssh-hardening/issues/192)
|
||||
- Unsupported option "rhostsrsaauthentication" "rsaauthentication" [\#184](https://github.com/dev-sec/ansible-ssh-hardening/issues/184)
|
||||
- Weak kex are controlled by wrong variable ? [\#174](https://github.com/dev-sec/ansible-ssh-hardening/issues/174)
|
||||
- Can't connect to server by SSH after applying this role [\#115](https://github.com/dev-sec/ansible-ssh-hardening/issues/115)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Support StreamLocalBindUnlink [\#197](https://github.com/dev-sec/ansible-ssh-hardening/issues/197)
|
||||
- Add molecule testing [\#183](https://github.com/dev-sec/ansible-ssh-hardening/issues/183)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Support for custom configuration [\#199](https://github.com/dev-sec/ansible-ssh-hardening/pull/199) ([MatthiasLohr](https://github.com/MatthiasLohr))
|
||||
- parameterize PermitRootLogin [\#195](https://github.com/dev-sec/ansible-ssh-hardening/pull/195) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- set 'GSSAPIAuthentication yes' if variable 'ssh\_gssapi\_support' is set to 'true' [\#194](https://github.com/dev-sec/ansible-ssh-hardening/pull/194) ([szEvEz](https://github.com/szEvEz))
|
||||
- Use ansible version compare module [\#187](https://github.com/dev-sec/ansible-ssh-hardening/pull/187) ([BentoumiTech](https://github.com/BentoumiTech))
|
||||
- add ubuntu 18.04 support [\#186](https://github.com/dev-sec/ansible-ssh-hardening/pull/186) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [5.0.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/5.0.0) (2018-09-16)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/4.4.0...5.0.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Fixing the broken Ansible dependency mechanism [\#176](https://github.com/dev-sec/ansible-ssh-hardening/issues/176)
|
||||
- Include new baseline-tests [\#161](https://github.com/dev-sec/ansible-ssh-hardening/issues/161)
|
||||
- GlobalKnownHostsFile missing from ssh\_config [\#155](https://github.com/dev-sec/ansible-ssh-hardening/issues/155)
|
||||
- Options not compatible with OpenSSH server 7.6 [\#151](https://github.com/dev-sec/ansible-ssh-hardening/issues/151)
|
||||
- Kitchen travis [\#180](https://github.com/dev-sec/ansible-ssh-hardening/pull/180) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- update config of kex, macs, ciphers [\#179](https://github.com/dev-sec/ansible-ssh-hardening/pull/179) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- add debian 9 and a comment [\#178](https://github.com/dev-sec/ansible-ssh-hardening/pull/178) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Dependency flag [\#177](https://github.com/dev-sec/ansible-ssh-hardening/pull/177) ([jcheroske](https://github.com/jcheroske))
|
||||
- Travis [\#173](https://github.com/dev-sec/ansible-ssh-hardening/pull/173) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- OpenBSD Support [\#171](https://github.com/dev-sec/ansible-ssh-hardening/pull/171) ([jbronn](https://github.com/jbronn))
|
||||
- Implement disabling chroot for sftp [\#166](https://github.com/dev-sec/ansible-ssh-hardening/pull/166) ([towo](https://github.com/towo))
|
||||
- New tests [\#163](https://github.com/dev-sec/ansible-ssh-hardening/pull/163) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- yaml-lint update, refactor tasks [\#162](https://github.com/dev-sec/ansible-ssh-hardening/pull/162) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Handle a few deprecated OpenSSH options [\#160](https://github.com/dev-sec/ansible-ssh-hardening/pull/160) ([ageis](https://github.com/ageis))
|
||||
- Added support for TrustedUserCAKeys and AuthorizedPrincipalsFile. [\#157](https://github.com/dev-sec/ansible-ssh-hardening/pull/157) ([gdelafond](https://github.com/gdelafond))
|
||||
- Adds sshd config for keyboard-interactive pam device [\#156](https://github.com/dev-sec/ansible-ssh-hardening/pull/156) ([rcII](https://github.com/rcII))
|
||||
- Use package state 'present' since 'installed' is deprecated [\#154](https://github.com/dev-sec/ansible-ssh-hardening/pull/154) ([Normo](https://github.com/Normo))
|
||||
- conform to current dev-sec/ssh-baseline [\#150](https://github.com/dev-sec/ansible-ssh-hardening/pull/150) ([alval5280](https://github.com/alval5280))
|
||||
- new parameter: ssh\_max\_startups [\#149](https://github.com/dev-sec/ansible-ssh-hardening/pull/149) ([aeschbacher](https://github.com/aeschbacher))
|
||||
- Update syntax to 2.4 [\#148](https://github.com/dev-sec/ansible-ssh-hardening/pull/148) ([thomasjpfan](https://github.com/thomasjpfan))
|
||||
- Amazonlinux-Testing [\#147](https://github.com/dev-sec/ansible-ssh-hardening/pull/147) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Fixed trailing whitespace [\#146](https://github.com/dev-sec/ansible-ssh-hardening/pull/146) ([zbrojny120](https://github.com/zbrojny120))
|
||||
- Add support for Amazon Linux [\#145](https://github.com/dev-sec/ansible-ssh-hardening/pull/145) ([woneill](https://github.com/woneill))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- ssh\_server\_weak\_kex variable is not used any where [\#167](https://github.com/dev-sec/ansible-ssh-hardening/issues/167)
|
||||
- opensshd.conf.j2 template type error [\#159](https://github.com/dev-sec/ansible-ssh-hardening/issues/159)
|
||||
- line 56: Bad SSH2 mac spec [\#135](https://github.com/dev-sec/ansible-ssh-hardening/issues/135)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Travis & Debian 9 "Stretch" [\#158](https://github.com/dev-sec/ansible-ssh-hardening/issues/158)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- remove oracle7 from travis tests for the time being [\#181](https://github.com/dev-sec/ansible-ssh-hardening/pull/181) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [4.4.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/4.4.0) (2017-12-29)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/4.3.1...4.4.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Changes in selinux section to avoid confusion and some inconsistencies [\#127](https://github.com/dev-sec/ansible-ssh-hardening/issues/127)
|
||||
- Issue \#137: Fix sshd\_config's "Match Group sftponly" [\#138](https://github.com/dev-sec/ansible-ssh-hardening/pull/138) ([kekumu](https://github.com/kekumu))
|
||||
- allow configuration of GatewayPorts [\#136](https://github.com/dev-sec/ansible-ssh-hardening/pull/136) ([pwyliu](https://github.com/pwyliu))
|
||||
- Added support for AuthorizedKeysFile config setting [\#132](https://github.com/dev-sec/ansible-ssh-hardening/pull/132) ([hyrsky](https://github.com/hyrsky))
|
||||
- corrected comments explaining the task's behaviour [\#131](https://github.com/dev-sec/ansible-ssh-hardening/pull/131) ([martinbydefault](https://github.com/martinbydefault))
|
||||
- Feature/2fa auth [\#123](https://github.com/dev-sec/ansible-ssh-hardening/pull/123) ([lazzurs](https://github.com/lazzurs))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- ssh\_use\_dns used twice in defaults/main.yml [\#129](https://github.com/dev-sec/ansible-ssh-hardening/issues/129)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- coreos support? [\#142](https://github.com/dev-sec/ansible-ssh-hardening/issues/142)
|
||||
- UseLogin is deprecated on CentOS 7 [\#140](https://github.com/dev-sec/ansible-ssh-hardening/issues/140)
|
||||
- sftp Match Group settings overriding global sshd\_config settings [\#137](https://github.com/dev-sec/ansible-ssh-hardening/issues/137)
|
||||
- get openssh-version fails on FreeBSD \(with ansible 2.4.0.0\) [\#133](https://github.com/dev-sec/ansible-ssh-hardening/issues/133)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Remove deprecated UseLogin option [\#141](https://github.com/dev-sec/ansible-ssh-hardening/pull/141) ([syhe](https://github.com/syhe))
|
||||
- Macs kex ciphers [\#139](https://github.com/dev-sec/ansible-ssh-hardening/pull/139) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- force /bin/sh when getting openssh-version [\#134](https://github.com/dev-sec/ansible-ssh-hardening/pull/134) ([gtz42](https://github.com/gtz42))
|
||||
|
||||
## [4.3.1](https://github.com/dev-sec/ansible-ssh-hardening/tree/4.3.1) (2017-08-14)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/4.3.0...4.3.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Remove duplicate ssh\_use\_dns [\#130](https://github.com/dev-sec/ansible-ssh-hardening/pull/130) ([MagnusEnger](https://github.com/MagnusEnger))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- System completely unresponsive after role execution [\#126](https://github.com/dev-sec/ansible-ssh-hardening/issues/126)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- role creates duplicate parameter/values after run [\#124](https://github.com/dev-sec/ansible-ssh-hardening/issues/124)
|
||||
|
||||
## [4.3.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/4.3.0) (2017-08-03)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/4.2.0...4.3.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Fix ansible.cfg settings [\#122](https://github.com/dev-sec/ansible-ssh-hardening/pull/122) ([fazlearefin](https://github.com/fazlearefin))
|
||||
- Finish 94 [\#116](https://github.com/dev-sec/ansible-ssh-hardening/pull/116) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Don't overwrite ssh\_host\_key\_files if set manually [\#125](https://github.com/dev-sec/ansible-ssh-hardening/pull/125) ([oakey-b1](https://github.com/oakey-b1))
|
||||
- Add comment filter to {{ansible\_managed}} string [\#121](https://github.com/dev-sec/ansible-ssh-hardening/pull/121) ([fazlearefin](https://github.com/fazlearefin))
|
||||
|
||||
## [4.2.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/4.2.0) (2017-06-30)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/4.1.3...4.2.0)
|
||||
|
||||
## [4.1.3](https://github.com/dev-sec/ansible-ssh-hardening/tree/4.1.3) (2017-06-30)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/4.1.2...4.1.3)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Add support to specify a list of revoked public keys [\#120](https://github.com/dev-sec/ansible-ssh-hardening/pull/120) ([bachp](https://github.com/bachp))
|
||||
- use package instead of yum so the operation works on Fedora [\#119](https://github.com/dev-sec/ansible-ssh-hardening/pull/119) ([stenwt](https://github.com/stenwt))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- fails in --check mode [\#111](https://github.com/dev-sec/ansible-ssh-hardening/issues/111)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Do not use shell when not needed + Lint whitespaces [\#118](https://github.com/dev-sec/ansible-ssh-hardening/pull/118) ([krhubert](https://github.com/krhubert))
|
||||
|
||||
## [4.1.2](https://github.com/dev-sec/ansible-ssh-hardening/tree/4.1.2) (2017-05-31)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/4.1.1...4.1.2)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- added check\_mode: no to "get openssh-version" task, so it won't fail … [\#117](https://github.com/dev-sec/ansible-ssh-hardening/pull/117) ([wschaft](https://github.com/wschaft))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- User login failed after running this module [\#114](https://github.com/dev-sec/ansible-ssh-hardening/issues/114)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Update readme to include baselines [\#110](https://github.com/dev-sec/ansible-ssh-hardening/issues/110)
|
||||
|
||||
## [4.1.1](https://github.com/dev-sec/ansible-ssh-hardening/tree/4.1.1) (2017-05-18)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/4.1.0...4.1.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- fix validation error [\#113](https://github.com/dev-sec/ansible-ssh-hardening/pull/113) ([pwyliu](https://github.com/pwyliu))
|
||||
|
||||
## [4.1.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/4.1.0) (2017-05-09)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/4.0.0...4.1.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Provide option to allow password server login [\#106](https://github.com/dev-sec/ansible-ssh-hardening/issues/106)
|
||||
- Deprecation warning always\_run [\#82](https://github.com/dev-sec/ansible-ssh-hardening/issues/82)
|
||||
- Added support for UseDNS config switch [\#109](https://github.com/dev-sec/ansible-ssh-hardening/pull/109) ([ftaeger](https://github.com/ftaeger))
|
||||
- Added support for UseDNS config switch [\#108](https://github.com/dev-sec/ansible-ssh-hardening/pull/108) ([ftaeger](https://github.com/ftaeger))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- `create ssh\_config and set permissions to root/644` step repeated [\#104](https://github.com/dev-sec/ansible-ssh-hardening/issues/104)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Added support for PermitTunnel config switch [\#112](https://github.com/dev-sec/ansible-ssh-hardening/pull/112) ([fti7](https://github.com/fti7))
|
||||
- Adds option to enable password based authentication on the server [\#107](https://github.com/dev-sec/ansible-ssh-hardening/pull/107) ([colin-nolan](https://github.com/colin-nolan))
|
||||
|
||||
## [4.0.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/4.0.0) (2017-04-22)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/3.2.0...4.0.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Avoid small primes for DH and allow rebuild of DH primes [\#89](https://github.com/dev-sec/ansible-ssh-hardening/issues/89)
|
||||
- Accommodate missing plugins in kitchen\_vagrant\_block.rb [\#100](https://github.com/dev-sec/ansible-ssh-hardening/pull/100) ([fullyint](https://github.com/fullyint))
|
||||
- Use different Hostkeys according to installed ssh version [\#99](https://github.com/dev-sec/ansible-ssh-hardening/pull/99) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Remove small dh primes [\#97](https://github.com/dev-sec/ansible-ssh-hardening/pull/97) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Add Ed25519 SSH host key to match commit 28b4df3 in ssh-baseline [\#96](https://github.com/dev-sec/ansible-ssh-hardening/pull/96) ([techraf](https://github.com/techraf))
|
||||
- Add support for FreeBSD OpenSSH server and client [\#95](https://github.com/dev-sec/ansible-ssh-hardening/pull/95) ([jbenden](https://github.com/jbenden))
|
||||
- Replace deprecated always\_run with check\_mode [\#93](https://github.com/dev-sec/ansible-ssh-hardening/pull/93) ([jbenden](https://github.com/jbenden))
|
||||
- Defaults: Remove DSA from SSH host keys to match ssh-baseline profile [\#92](https://github.com/dev-sec/ansible-ssh-hardening/pull/92) ([techraf](https://github.com/techraf))
|
||||
- use new docker images [\#91](https://github.com/dev-sec/ansible-ssh-hardening/pull/91) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- use centos 7 in vagrant, limit ssh conns [\#88](https://github.com/dev-sec/ansible-ssh-hardening/pull/88) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- remove support for ansible 1.9 [\#87](https://github.com/dev-sec/ansible-ssh-hardening/pull/87) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- make ChallengeResponseAuthentication configurable [\#85](https://github.com/dev-sec/ansible-ssh-hardening/pull/85) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- List only one Port in ssh config [\#84](https://github.com/dev-sec/ansible-ssh-hardening/pull/84) ([fullyint](https://github.com/fullyint))
|
||||
- Fix ssh config to handle custom options per Host [\#83](https://github.com/dev-sec/ansible-ssh-hardening/pull/83) ([fullyint](https://github.com/fullyint))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- SELinux-specific task still runs on SELinux-disabled systems [\#74](https://github.com/dev-sec/ansible-ssh-hardening/issues/74)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Should compression be opt-in? [\#90](https://github.com/dev-sec/ansible-ssh-hardening/issues/90)
|
||||
- The role fails when conditionally included [\#86](https://github.com/dev-sec/ansible-ssh-hardening/issues/86)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- remove duplicate section [\#105](https://github.com/dev-sec/ansible-ssh-hardening/pull/105) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Fix ssh\_server\_ports and ssh\_client\_ports documentation bug [\#80](https://github.com/dev-sec/ansible-ssh-hardening/pull/80) ([kivilahtio](https://github.com/kivilahtio))
|
||||
|
||||
## [3.2.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/3.2.0) (2016-10-24)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/3.1.0...3.2.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- CentOS 7 selinux dependencies [\#76](https://github.com/dev-sec/ansible-ssh-hardening/issues/76)
|
||||
- install selinux dependencies, check for already installed semodule [\#79](https://github.com/dev-sec/ansible-ssh-hardening/pull/79) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Parameterise Banner and DebianBanner as defaults [\#77](https://github.com/dev-sec/ansible-ssh-hardening/pull/77) ([tsenart](https://github.com/tsenart))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Some tasks are always run even if they are not needed [\#78](https://github.com/dev-sec/ansible-ssh-hardening/issues/78)
|
||||
- Selinux issue [\#75](https://github.com/dev-sec/ansible-ssh-hardening/issues/75)
|
||||
- Running the tests locally [\#61](https://github.com/dev-sec/ansible-ssh-hardening/issues/61)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Applied-Crypto-Hardening project and new cyphers. [\#28](https://github.com/dev-sec/ansible-ssh-hardening/issues/28)
|
||||
|
||||
## [3.1.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/3.1.0) (2016-08-03)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/3.1...3.1.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- use new ciphers, kex, macs and privilege separation for redhat family 7 or later [\#72](https://github.com/dev-sec/ansible-ssh-hardening/issues/72)
|
||||
|
||||
## [3.1](https://github.com/dev-sec/ansible-ssh-hardening/tree/3.1) (2016-08-03)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/3.0.0...3.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Add Xenial / Ubuntu 16.04 LTS to meta/main.yml [\#63](https://github.com/dev-sec/ansible-ssh-hardening/issues/63)
|
||||
- Use new ciphers, kex, macs and priv separation sandbox for redhat family 7 [\#73](https://github.com/dev-sec/ansible-ssh-hardening/pull/73) ([atomic111](https://github.com/atomic111))
|
||||
- add docker support [\#71](https://github.com/dev-sec/ansible-ssh-hardening/pull/71) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- add always\_run: true to task. fix \#64 [\#69](https://github.com/dev-sec/ansible-ssh-hardening/pull/69) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Debian8 [\#68](https://github.com/dev-sec/ansible-ssh-hardening/pull/68) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Fixed KexAlgorithms Conditional Statement [\#66](https://github.com/dev-sec/ansible-ssh-hardening/pull/66) ([cjsheets](https://github.com/cjsheets))
|
||||
- Moves vars to defaults [\#60](https://github.com/dev-sec/ansible-ssh-hardening/pull/60) ([conorsch](https://github.com/conorsch))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- semodule ssh\_password error on AWS Centos 7 [\#64](https://github.com/dev-sec/ansible-ssh-hardening/issues/64)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- `ssh\_server\_ports` a bit misleading in the vars section? [\#62](https://github.com/dev-sec/ansible-ssh-hardening/issues/62)
|
||||
- sftp\_enabled: false will break Ansible's template module [\#55](https://github.com/dev-sec/ansible-ssh-hardening/issues/55)
|
||||
- Move cipher/kex/mac vars to defaults [\#53](https://github.com/dev-sec/ansible-ssh-hardening/issues/53)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Add SCP/SFTP to FAQ [\#58](https://github.com/dev-sec/ansible-ssh-hardening/pull/58) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [3.0.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/3.0.0) (2016-03-13)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/2.0.0...3.0.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Added sftp\_enabled, sftp\_chroot\_dir, and ssh\_client\_roaming from the … [\#57](https://github.com/dev-sec/ansible-ssh-hardening/pull/57) ([ghost](https://github.com/ghost))
|
||||
- add test support for ansible 1.9 and 2.0 [\#56](https://github.com/dev-sec/ansible-ssh-hardening/pull/56) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- update platforms in meta-file [\#52](https://github.com/dev-sec/ansible-ssh-hardening/pull/52) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- add webhook for ansible galaxy [\#51](https://github.com/dev-sec/ansible-ssh-hardening/pull/51) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Disable experimental client roaming. [\#49](https://github.com/dev-sec/ansible-ssh-hardening/pull/49) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- use inspec as test framework [\#48](https://github.com/dev-sec/ansible-ssh-hardening/pull/48) ([chris-rock](https://github.com/chris-rock))
|
||||
- Change categories to tags for upcoming ansible 2.0 [\#47](https://github.com/dev-sec/ansible-ssh-hardening/pull/47) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- add changelog generator [\#46](https://github.com/dev-sec/ansible-ssh-hardening/pull/46) ([chris-rock](https://github.com/chris-rock))
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Install from ansible galaxy missing files \(tasks\) [\#50](https://github.com/dev-sec/ansible-ssh-hardening/issues/50)
|
||||
- should generate new ssh host key files [\#45](https://github.com/dev-sec/ansible-ssh-hardening/issues/45)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- New release 3.0.0 [\#59](https://github.com/dev-sec/ansible-ssh-hardening/pull/59) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [2.0.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/2.0.0) (2015-11-28)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/1.2.1...2.0.0)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Fix directory structure. [\#43](https://github.com/dev-sec/ansible-ssh-hardening/issues/43)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- New dir layout. Fix \#43 [\#44](https://github.com/dev-sec/ansible-ssh-hardening/pull/44) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Add var to travis job [\#42](https://github.com/dev-sec/ansible-ssh-hardening/pull/42) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- sftp\_enable option [\#41](https://github.com/dev-sec/ansible-ssh-hardening/pull/41) ([fitz123](https://github.com/fitz123))
|
||||
|
||||
## [1.2.1](https://github.com/dev-sec/ansible-ssh-hardening/tree/1.2.1) (2015-10-16)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/1.2.0...1.2.1)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Allow whitelisted groups on ssh [\#40](https://github.com/dev-sec/ansible-ssh-hardening/pull/40) ([fheinle](https://github.com/fheinle))
|
||||
|
||||
## [1.2.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/1.2.0) (2015-09-28)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/1.2...1.2.0)
|
||||
|
||||
## [1.2](https://github.com/dev-sec/ansible-ssh-hardening/tree/1.2) (2015-09-28)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/1.1.0...1.2)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- bugfix. Now option true for PrintLastLog is available again [\#39](https://github.com/dev-sec/ansible-ssh-hardening/pull/39) ([fitz123](https://github.com/fitz123))
|
||||
- Add more travis-tests [\#38](https://github.com/dev-sec/ansible-ssh-hardening/pull/38) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Support for selinux and pam. fix \#23 [\#35](https://github.com/dev-sec/ansible-ssh-hardening/pull/35) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [1.1.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/1.1.0) (2015-09-01)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/1.1...1.1.0)
|
||||
|
||||
## [1.1](https://github.com/dev-sec/ansible-ssh-hardening/tree/1.1) (2015-09-01)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/1.0.0...1.1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- ssh\_ports - individual client/server config [\#33](https://github.com/dev-sec/ansible-ssh-hardening/issues/33)
|
||||
- UsePAM should probably default to yes on Red Hat Linux 7 [\#23](https://github.com/dev-sec/ansible-ssh-hardening/issues/23)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Change variable for hmac from server to client [\#37](https://github.com/dev-sec/ansible-ssh-hardening/pull/37) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Update kitchen-ansible, remove separate debian install [\#36](https://github.com/dev-sec/ansible-ssh-hardening/pull/36) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Separate ssh client and server ports. Fix \#33 [\#34](https://github.com/dev-sec/ansible-ssh-hardening/pull/34) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- update common kitchen.yml platforms \(ansible\), kitchen\_debian.yml platforms \(ansible\) [\#32](https://github.com/dev-sec/ansible-ssh-hardening/pull/32) ([chris-rock](https://github.com/chris-rock))
|
||||
- Make MaxAuthTries configurable [\#31](https://github.com/dev-sec/ansible-ssh-hardening/pull/31) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Change oneliner if-statements to be more readable [\#30](https://github.com/dev-sec/ansible-ssh-hardening/pull/30) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Make ssh client password login configurable. [\#29](https://github.com/dev-sec/ansible-ssh-hardening/pull/29) ([ypid](https://github.com/ypid))
|
||||
- Fix join-filter, jinja-cases, intendation [\#27](https://github.com/dev-sec/ansible-ssh-hardening/pull/27) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Short role review. Fixed role when ssh\_client\_weak\_kex == true. [\#26](https://github.com/dev-sec/ansible-ssh-hardening/pull/26) ([ypid](https://github.com/ypid))
|
||||
- Make it configurable to only harden ssh client/server or both \(default\). [\#25](https://github.com/dev-sec/ansible-ssh-hardening/pull/25) ([ypid](https://github.com/ypid))
|
||||
- Separate system-vars from editable vars [\#24](https://github.com/dev-sec/ansible-ssh-hardening/pull/24) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Add correct CONTRIB-file [\#22](https://github.com/dev-sec/ansible-ssh-hardening/pull/22) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Add Ansible Galaxy badge [\#21](https://github.com/dev-sec/ansible-ssh-hardening/pull/21) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- fix configuration of playbook path [\#20](https://github.com/dev-sec/ansible-ssh-hardening/pull/20) ([chris-rock](https://github.com/chris-rock))
|
||||
- Debian install script [\#19](https://github.com/dev-sec/ansible-ssh-hardening/pull/19) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
## [1.0.0](https://github.com/dev-sec/ansible-ssh-hardening/tree/1.0.0) (2015-04-30)
|
||||
|
||||
[Full Changelog](https://github.com/dev-sec/ansible-ssh-hardening/compare/a9591764206b79a4ed324bb8576151ebac0127b1...1.0.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Update variable-documentation [\#12](https://github.com/dev-sec/ansible-ssh-hardening/pull/12) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- add travis test for ubuntu 12.04 [\#7](https://github.com/dev-sec/ansible-ssh-hardening/issues/7)
|
||||
- Use handler for sshd restart [\#6](https://github.com/dev-sec/ansible-ssh-hardening/issues/6)
|
||||
- Running test-kitchen fails [\#2](https://github.com/dev-sec/ansible-ssh-hardening/issues/2)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- add self as author [\#18](https://github.com/dev-sec/ansible-ssh-hardening/pull/18) ([chris-rock](https://github.com/chris-rock))
|
||||
- add badges [\#17](https://github.com/dev-sec/ansible-ssh-hardening/pull/17) ([chris-rock](https://github.com/chris-rock))
|
||||
- fix meta.yml [\#16](https://github.com/dev-sec/ansible-ssh-hardening/pull/16) ([chris-rock](https://github.com/chris-rock))
|
||||
- add more information to changelog [\#15](https://github.com/dev-sec/ansible-ssh-hardening/pull/15) ([chris-rock](https://github.com/chris-rock))
|
||||
- Add meta-information for Ansible Galaxy [\#14](https://github.com/dev-sec/ansible-ssh-hardening/pull/14) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Update CHANGELOG.md [\#13](https://github.com/dev-sec/ansible-ssh-hardening/pull/13) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Add handler to restart ssh only if necessary. Fix \#6 [\#11](https://github.com/dev-sec/ansible-ssh-hardening/pull/11) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- add more descriptions [\#10](https://github.com/dev-sec/ansible-ssh-hardening/pull/10) ([chris-rock](https://github.com/chris-rock))
|
||||
- add travis config for ansible [\#9](https://github.com/dev-sec/ansible-ssh-hardening/pull/9) ([chris-rock](https://github.com/chris-rock))
|
||||
- update .kitchen.yml to find playbook role in tests [\#8](https://github.com/dev-sec/ansible-ssh-hardening/pull/8) ([chris-rock](https://github.com/chris-rock))
|
||||
- Oracle support [\#5](https://github.com/dev-sec/ansible-ssh-hardening/pull/5) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Remove custom Vagrantfile-reference. Fix \#2 [\#4](https://github.com/dev-sec/ansible-ssh-hardening/pull/4) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Remove custom Vagrantfile-reference. Fix \#2 [\#3](https://github.com/dev-sec/ansible-ssh-hardening/pull/3) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||
- Fix missing gem [\#1](https://github.com/dev-sec/ansible-ssh-hardening/pull/1) ([chris-rock](https://github.com/chris-rock))
|
||||
|
||||
|
||||
|
||||
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
264
roles/ssh_hardening/README.md
Normal file
264
roles/ssh_hardening/README.md
Normal file
|
@ -0,0 +1,264 @@
|
|||
# dev-sec.ssh_hardening
|
||||
|
||||
![devsec.ssh_hardening](https://github.com/dev-sec/ansible-os-hardening/workflows/devsec.ssh_hardening/badge.svg)
|
||||
|
||||
## Description
|
||||
|
||||
This role provides secure ssh-client and ssh-server configurations. It is intended to be compliant with the [DevSec SSH Baseline](https://github.com/dev-sec/ssh-baseline).
|
||||
|
||||
Warning: This role disables root-login on the target server! Please make sure you have another user with su or sudo permissions that can login into the server.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Ansible >= 2.9
|
||||
|
||||
## Role Variables
|
||||
|
||||
* `network_ipv6_enable`
|
||||
* Default: false
|
||||
* Description: true if IPv6 is needed. `ssh_listen_to` must also be set to listen to IPv6 addresses (for example `[::]`).
|
||||
* `ssh_server_ports`
|
||||
* Default: ['22']
|
||||
* Description: ports on which ssh-server should listen
|
||||
* `ssh_client_port`
|
||||
* Default: '22'
|
||||
* Description: port to which ssh-client should connect
|
||||
* `ssh_listen_to`
|
||||
* Default: ['0.0.0.0']
|
||||
* Description: one or more ip addresses, to which ssh-server should listen to. Default is all IPv4 adresses, but should be configured to specific addresses for security reasons!
|
||||
* `ssh_host_key_files`
|
||||
* Default: []
|
||||
* Description: Host keys for sshd. If empty ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key', '/etc/ssh/ssh_host_ed25519_key'] will be used, as far as supported by the installed sshd version
|
||||
* `ssh_host_key_algorithms`
|
||||
* Default: []
|
||||
* Description: Host key algorithms that the server offers. If empty the [default list](https://man.openbsd.org/sshd_config#HostKeyAlgorithms) will be used, otherwise overrides the setting with specified list of algorithms
|
||||
* `ssh_client_alive_interval`
|
||||
* Default: 600
|
||||
* Description: specifies an interval for sending keepalive messages
|
||||
* `ssh_client_alive_count`
|
||||
* Default: 3
|
||||
* Description: defines how often keep-alive messages are sent
|
||||
* `ssh_permit_tunnel`
|
||||
* Default: false
|
||||
* Description: true if SSH Port Tunneling is required
|
||||
* `ssh_remote_hosts`
|
||||
* Default: []
|
||||
* Description: one or more hosts and their custom options for the ssh-client. Default is empty. See examples in `defaults/main.yml`.
|
||||
* `ssh_permit_root_login`
|
||||
* Default: no
|
||||
* Description: Disable root-login. Set to `without-password` or `yes` to enable root-login
|
||||
* `ssh_allow_tcp_forwarding`
|
||||
* Default: no
|
||||
* Description: `'no'` to disable TCP Forwarding. Set to `'yes'` to allow TCP Forwarding. If you are using OpenSSH >= 6.2 version, you can specify `'yes'`, `'no'`, `'all'` or `'local'`. <br> *Note*: values passed to this variable must be strings, thus values `'yes'` and `'no'` should be passed with quotes.
|
||||
* `ssh_gateway_ports`
|
||||
* Default: `false`
|
||||
* Description: `false` to disable binding forwarded ports to non-loopback addresses. Set to `true` to force binding on wildcard address. Set to `clientspecified` to allow the client to specify which address to bind to.
|
||||
* `ssh_allow_agent_forwarding`
|
||||
* Default: false
|
||||
* Description: false to disable Agent Forwarding. Set to true to allow Agent Forwarding.
|
||||
* `ssh_x11_forwarding`
|
||||
* Default: false
|
||||
* Description: false to disable X11 Forwarding. Set to true to allow X11 Forwarding.
|
||||
* `ssh_pam_support`
|
||||
* Default: true
|
||||
* Description: true if SSH has PAM support.
|
||||
* `ssh_use_pam`
|
||||
* Default: true
|
||||
* Description: false to disable pam authentication.
|
||||
* `ssh_gssapi_support`
|
||||
* Default: false
|
||||
* Description: true if SSH has GSSAPI support.
|
||||
* `ssh_kerberos_support`
|
||||
* Default: true
|
||||
* Description: true if SSH has Kerberos support.
|
||||
* `ssh_deny_users`
|
||||
* Default: ''
|
||||
* Description: if specified, login is disallowed for user names that match one of the patterns.
|
||||
* `ssh_allow_users`
|
||||
* Default: ''
|
||||
* Description: if specified, login is allowed only for user names that match one of the patterns.
|
||||
* `ssh_deny_groups`
|
||||
* Default: ''
|
||||
* Description: if specified, login is disallowed for users whose primary group or supplementary group list matches one of the patterns.
|
||||
* `ssh_allow_groups`
|
||||
* Default: ''
|
||||
* Description: if specified, login is allowed only for users whose primary group or supplementary group list matches one of the patterns.
|
||||
* `ssh_authorized_keys_file`
|
||||
* Default: ''
|
||||
* Description: change default file that contains the public keys that can be used for user authentication.
|
||||
* `ssh_trusted_user_ca_keys_file`
|
||||
* Default: ''
|
||||
* Description: specifies the file containing trusted certificate authorities public keys used to sign user certificates.
|
||||
* `ssh_trusted_user_ca_keys`
|
||||
* Default: []
|
||||
* Description: set the trusted certificate authorities public keys used to sign user certificates. Only used if `ssh_trusted_user_ca_keys_file` is set.
|
||||
* `ssh_authorized_principals_file`
|
||||
* Default: ''
|
||||
* Description: specifies the file containing principals that are allowed. Only used if `ssh_trusted_user_ca_keys_file` is set.
|
||||
* `ssh_authorized_principals`
|
||||
* Default: []
|
||||
* Description: list of hashes containing file paths and authorized principals, see `default_custom.yml` for all options. Only used if `ssh_authorized_principals_file` is set.
|
||||
* `ssh_print_motd`
|
||||
* Default: false
|
||||
* Description: false to disable printing of the MOTD
|
||||
* `ssh_print_pam_motd`
|
||||
* Default: false
|
||||
* Description: false to disable printing of the MOTD via pam (Debian and Ubuntu)
|
||||
* `ssh_print_last_log`
|
||||
* Default: false
|
||||
* Description: false to disable display of last login information
|
||||
* `sftp_enabled`
|
||||
* Default: false
|
||||
* Description: true to enable sftp configuration
|
||||
* `sftp_umask`
|
||||
* Default: '0027'
|
||||
* Description: Specifies the umask for sftp
|
||||
* `sftp_chroot`
|
||||
* Default: true
|
||||
* Description: false to disable chroot for sftp
|
||||
* `sftp_chroot_dir`
|
||||
* Default: /home/%u
|
||||
* Description: change default sftp chroot location
|
||||
* `ssh_client_roaming`
|
||||
* Default: false
|
||||
* Description: enable experimental client roaming
|
||||
* `sshd_moduli_file`
|
||||
* Default: '/etc/ssh/moduli'
|
||||
* Description: path to the SSH moduli file
|
||||
* `sshd_moduli_minimum`
|
||||
* Default: 2048
|
||||
* Description: remove Diffie-Hellman parameters smaller than the defined size to mitigate logjam
|
||||
* `ssh_challengeresponseauthentication`
|
||||
* Default: false
|
||||
* Description: Specifies whether challenge-response authentication is allowed (e.g. via PAM)
|
||||
* `ssh_client_password_login`
|
||||
* Default: false
|
||||
* Description: `true` to allow password-based authentication with the ssh client
|
||||
* `ssh_server_password_login`
|
||||
* Default: false
|
||||
* Description: `true` to allow password-based authentication with the ssh server
|
||||
* `ssh_banner`
|
||||
* Default: `false`
|
||||
* Description: `true` to print a banner on login
|
||||
* `ssh_banner_path`
|
||||
* Default: '/etc/sshd/banner.txt'
|
||||
* Description: path to the SSH banner file
|
||||
* `ssh_client_hardening`
|
||||
* Default: `true`
|
||||
* Description: `false` to stop harden the client
|
||||
* `ssh_client_port`
|
||||
* Default: `'22'`
|
||||
* Description: Specifies the port number to connect on the remote host.
|
||||
* `ssh_client_compression`
|
||||
* Default: `false`
|
||||
* Description: Specifies whether the client requests compression.
|
||||
* `ssh_compression`
|
||||
* Default: `false`
|
||||
* Description: Specifies whether server-side compression is enabled after the user has authenticated successfully.
|
||||
* `ssh_login_grace_time`
|
||||
* Default: `30s`
|
||||
* Description: specifies the time allowed for successful authentication to the SSH server
|
||||
* `ssh_max_auth_retries`
|
||||
* Default: `2`
|
||||
* Description: Specifies the maximum number of authentication attempts permitted per connection.
|
||||
* `ssh_max_sessions`
|
||||
* Default: `10`
|
||||
* Description: Specifies the maximum number of open sessions permitted from a given connection.
|
||||
* `ssh_print_debian_banner`
|
||||
* Default: `false`
|
||||
* Description: `true` to print debian specific banner
|
||||
* `ssh_server_enabled`
|
||||
* Default: `true`
|
||||
* Description: `false` to disable the opensshd server
|
||||
* `ssh_server_hardening`
|
||||
* Default: `true`
|
||||
* Description: `false` to stop harden the server
|
||||
* `ssh_server_match_address`
|
||||
* Default: ''
|
||||
* Description: Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file.
|
||||
* `ssh_server_match_group`
|
||||
* Default: ''
|
||||
* Description: Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file.
|
||||
* `ssh_server_match_user`
|
||||
* Default: ''
|
||||
* Description: Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file.
|
||||
* `ssh_server_match_local_port`
|
||||
* Default: ''
|
||||
* Description: Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file.
|
||||
* `ssh_server_permit_environment_vars`
|
||||
* Default: `no`
|
||||
* Description: `yes` to specify that ~/.ssh/environment and environment= options in ~/.ssh/authorized_keys are processed by sshd. With openssh version 7.8 it is possible to specify a whitelist of environment variable names in addition to global "yes" or "no" settings
|
||||
* `ssh_server_accept_env_vars`
|
||||
* Default: ''
|
||||
* Description: Specifies what environment variables sent by the client will be copied into the session's environment, multiple environment variables may be separated by whitespace
|
||||
* `ssh_use_dns`
|
||||
* Default: `false`
|
||||
* Description: Specifies whether sshd should look up the remote host name, and to check that the resolved host name for the remote IP address maps back to the very same IP address.
|
||||
* `ssh_server_revoked_keys`
|
||||
* Default: []
|
||||
* Description: a list of revoked public keys that the ssh server will always reject, useful to revoke known weak or compromised keys.
|
||||
* `ssh_max_startups`
|
||||
* Default: '10:30:100'
|
||||
* Description: Specifies the maximum number of concurrent unauthenticated connections to the SSH daemon.
|
||||
* `ssh_macs`
|
||||
* Default: []
|
||||
* Description: Change this list to overwrite macs. Defaults found in `defaults/main.yml`
|
||||
* `ssh_kex`
|
||||
* Default: []
|
||||
* Description: Change this list to overwrite kexs. Defaults found in `defaults/main.yml`
|
||||
* `ssh_ciphers`
|
||||
* Default: []
|
||||
* Description: Change this list to overwrite ciphers. Defaults found in `defaults/main.yml`
|
||||
* `ssh_custom_options`
|
||||
* Default: []
|
||||
* Description: Custom lines for SSH client configuration
|
||||
* `sshd_custom_options`
|
||||
* Default: []
|
||||
* Description: Custom lines for SSH daemon configuration
|
||||
* `sshd_syslog_facility`
|
||||
* Default: 'AUTH'
|
||||
* Description: The facility code that is used when logging messages from sshd
|
||||
* `sshd_log_level`
|
||||
* Default: 'VERBOSE'
|
||||
* Description: the verbosity level that is used when logging messages from sshd
|
||||
* `sshd_strict_modes`
|
||||
* Default: true
|
||||
* Description: Check file modes and ownership of the user's files and home directory before accepting login
|
||||
* `sshd_authenticationmethods`
|
||||
* Default: `publickey`
|
||||
* Description: Specifies the authentication methods that must be successfully completed for a user to be granted access. Make sure to set all required variables for your selected authentication method. Defaults found in `defaults/main.yml`
|
||||
|
||||
## Example Playbook
|
||||
|
||||
```
|
||||
- hosts: localhost
|
||||
collections:
|
||||
- devsec.hardening
|
||||
roles:
|
||||
- devsec.ssh_hardening
|
||||
```
|
||||
|
||||
## Configuring settings not listed in role-variables
|
||||
|
||||
If you want to configure ssh options that are not listed above, you can use `ssh_custom_options` (for `/etc/ssh/ssh_config`) or `sshd_custom_options` (for `/etc/ssh/sshd_config`) to set them. These options will be set on the **beginning** of the file so you can override options further down in the file.
|
||||
|
||||
Example playbook:
|
||||
|
||||
```
|
||||
- hosts: localhost
|
||||
collections:
|
||||
- devsec.hardening
|
||||
roles:
|
||||
- devsec.ssh_hardening
|
||||
vars:
|
||||
ssh_custom_options:
|
||||
- "Include /etc/ssh/ssh_config.d/*"
|
||||
sshd_custom_options:
|
||||
- "AcceptEnv LANG"
|
||||
```
|
||||
|
||||
## Changing the default port and idempotency
|
||||
|
||||
This role uses the default port 22 or the port configured in the inventory to connect to the server. If the default `ssh` port is changed via `ssh_server_ports`, once the ssh server is restarted, it will still try to connect using the previous port. In order to run this role again on the same server the inventory will have to be updated to use the new ssh port.
|
||||
|
||||
If idempotency is important, please consider using role [`ssh-hardening-fallback`](https://github.com/nununo/ansible-ssh-hardening-fallback), which is a wrapper around this role that falls back to port 22 if the configured port is unreachable.
|
273
roles/ssh_hardening/defaults/main.yml
Normal file
273
roles/ssh_hardening/defaults/main.yml
Normal file
|
@ -0,0 +1,273 @@
|
|||
---
|
||||
# true if IPv6 is needed
|
||||
network_ipv6_enable: false # sshd + ssh
|
||||
|
||||
# true if sshd should be started and enabled
|
||||
ssh_server_enabled: true # sshd
|
||||
|
||||
# true if DNS resolutions are needed, look up the remote host name, defaults to false from 6.8, see: http://www.openssh.com/txt/release-6.8
|
||||
ssh_use_dns: false # sshd
|
||||
|
||||
# true or value if compression is needed
|
||||
ssh_client_compression: false # ssh
|
||||
ssh_compression: false # sshd
|
||||
|
||||
# For which components (client and server) to generate the configuration for. Can be useful when running against a client without an SSH server.
|
||||
ssh_client_hardening: true # ssh
|
||||
ssh_server_hardening: true # sshd
|
||||
|
||||
# If true, password login is allowed
|
||||
ssh_client_password_login: false # ssh
|
||||
ssh_server_password_login: false # sshd
|
||||
|
||||
# ports on which ssh-server should listen
|
||||
ssh_server_ports: ['22'] # sshd
|
||||
|
||||
# port to which ssh-client should connect
|
||||
ssh_client_port: '22' # ssh
|
||||
|
||||
# one or more ip addresses, to which ssh-server should listen to. Default is empty, but should be configured for security reasons!
|
||||
ssh_listen_to: ['0.0.0.0'] # sshd
|
||||
|
||||
# Host keys to look for when starting sshd.
|
||||
ssh_host_key_files: [] # sshd
|
||||
|
||||
# Specifies the host key algorithms that the server offers
|
||||
ssh_host_key_algorithms: [] # sshd
|
||||
|
||||
# specifies the time allowed for successful authentication to the SSH server
|
||||
ssh_login_grace_time: 30s
|
||||
|
||||
# Specifies the maximum number of authentication attempts permitted per connection. Once the number of failures reaches half this value, additional failures are logged.
|
||||
ssh_max_auth_retries: 2
|
||||
|
||||
# Specifies the maximum number of open sessions permitted from a given connection
|
||||
ssh_max_sessions: 10
|
||||
|
||||
ssh_client_alive_interval: 300 # sshd
|
||||
ssh_client_alive_count: 3 # sshd
|
||||
|
||||
# Allow SSH Tunnels
|
||||
ssh_permit_tunnel: false
|
||||
|
||||
# Hosts with custom options. # ssh
|
||||
# Example:
|
||||
# ssh_remote_hosts:
|
||||
# - names: ['example.com', 'example2.com']
|
||||
# options: ['Port 2222', 'ForwardAgent yes']
|
||||
# - names: ['example3.com']
|
||||
# options: ['StrictHostKeyChecking no']
|
||||
ssh_remote_hosts: []
|
||||
|
||||
# Set this to "without-password" or "yes" to allow root to login
|
||||
ssh_permit_root_login: 'no' # sshd
|
||||
|
||||
# false to disable TCP Forwarding. Set to true to allow TCP Forwarding.
|
||||
ssh_allow_tcp_forwarding: 'no' # sshd
|
||||
|
||||
# false to disable binding forwarded ports to non-loopback addresses. Set to true to force binding on wildcard address.
|
||||
# Set to 'clientspecified' to allow the client to specify which address to bind to.
|
||||
ssh_gateway_ports: false # sshd
|
||||
|
||||
# false to disable Agent Forwarding. Set to true to allow Agent Forwarding.
|
||||
ssh_allow_agent_forwarding: false # sshd
|
||||
|
||||
# false to disable X11 Forwarding. Set to true to allow X11 Forwarding.
|
||||
ssh_x11_forwarding: false # sshd
|
||||
|
||||
# true if SSH has PAM support
|
||||
ssh_pam_support: true
|
||||
|
||||
# false to disable pam authentication.
|
||||
ssh_use_pam: true # sshd
|
||||
|
||||
# specify AuthenticationMethods
|
||||
sshd_authenticationmethods: 'publickey'
|
||||
|
||||
# true if SSH support GSSAPI
|
||||
ssh_gssapi_support: false
|
||||
|
||||
# true if SSH support Kerberos
|
||||
ssh_kerberos_support: true
|
||||
|
||||
# if specified, login is disallowed for user names that match one of the patterns.
|
||||
ssh_deny_users: '' # sshd
|
||||
|
||||
# if specified, login is allowed only for user names that match one of the patterns.
|
||||
ssh_allow_users: '' # sshd
|
||||
|
||||
# if specified, login is disallowed for users whose primary group or supplementary group list matches one of the patterns.
|
||||
ssh_deny_groups: '' # sshd
|
||||
|
||||
# if specified, login is allowed only for users whose primary group or supplementary group list matches one of the patterns.
|
||||
ssh_allow_groups: '' # sshd
|
||||
|
||||
# change default file that contains the public keys that can be used for user authentication.
|
||||
ssh_authorized_keys_file: '' # sshd
|
||||
|
||||
# specifies the file containing trusted certificate authorities public keys used to sign user certificates.
|
||||
ssh_trusted_user_ca_keys_file: '' # sshd
|
||||
|
||||
# set the trusted certificate authorities public keys used to sign user certificates.
|
||||
# Example:
|
||||
# ssh_trusted_user_ca_keys:
|
||||
# - 'ssh-rsa ... comment1'
|
||||
# - 'ssh-rsa ... comment2'
|
||||
ssh_trusted_user_ca_keys: [] # sshd
|
||||
|
||||
# specifies the file containing principals that are allowed. Only used if ssh_trusted_user_ca_keys_file is set.
|
||||
# Example:
|
||||
# ssh_authorized_principals_file: '/etc/ssh/auth_principals/%u'
|
||||
#
|
||||
# %h is replaced by the home directory of the user being authenticated, and %u is
|
||||
# replaced by the username of that user. After expansion, the path is taken to be
|
||||
# an absolute path or one relative to the user's home directory.
|
||||
#
|
||||
ssh_authorized_principals_file: '' # sshd
|
||||
|
||||
# list of hashes containing file paths and authorized principals. Only used if ssh_authorized_principals_file is set.
|
||||
# Example:
|
||||
# ssh_authorized_principals:
|
||||
# - { path: '/etc/ssh/auth_principals/root', principals: [ 'root' ], owner: "{{ ssh_owner }}", group: "{{ ssh_group }}", directoryowner: "{{ ssh_owner }}", directorygroup: "{{ ssh_group}}" }
|
||||
# - { path: '/etc/ssh/auth_principals/myuser', principals: [ 'masteradmin', 'webserver' ] }
|
||||
ssh_authorized_principals: [] # sshd
|
||||
|
||||
# false to disable printing of the MOTD
|
||||
ssh_print_motd: false # sshd
|
||||
ssh_print_pam_motd: false # sshd
|
||||
|
||||
# false to disable display of last login information
|
||||
ssh_print_last_log: false # sshd
|
||||
|
||||
# false to disable serving ssh warning banner before authentication is allowed
|
||||
ssh_banner: false # sshd
|
||||
|
||||
# path to file with ssh warning banner
|
||||
ssh_banner_path: '/etc/ssh/banner.txt'
|
||||
|
||||
# false to disable distribution version leakage during initial protocol handshake
|
||||
ssh_print_debian_banner: false # sshd (Debian OS family only)
|
||||
|
||||
# true to enable sftp configuration
|
||||
sftp_enabled: false
|
||||
|
||||
# false to disable sftp chroot
|
||||
sftp_chroot: true
|
||||
|
||||
# sftp default umask
|
||||
sftp_umask: '0027'
|
||||
|
||||
# change default sftp chroot location
|
||||
sftp_chroot_dir: /home/%u
|
||||
|
||||
# enable experimental client roaming
|
||||
ssh_client_roaming: false
|
||||
|
||||
# list of hashes (containing user and rules) to generate Match User blocks for
|
||||
ssh_server_match_user: false # sshd
|
||||
|
||||
# list of hashes (containing group and rules) to generate Match Group blocks for
|
||||
ssh_server_match_group: false # sshd
|
||||
|
||||
# list of hashes (containing addresses/subnets and rules) to generate Match Address blocks for
|
||||
ssh_server_match_address: false # sshd
|
||||
|
||||
# list of hashes (containing port and rules) to generate Match LocalPort blocks for
|
||||
ssh_server_match_local_port: false # sshd
|
||||
|
||||
ssh_server_permit_environment_vars: 'no'
|
||||
ssh_server_accept_env_vars: ''
|
||||
|
||||
# maximum number of concurrent unauthenticated connections to the SSH daemon
|
||||
ssh_max_startups: '10:30:100' # sshd
|
||||
|
||||
ssh_ps53: 'yes'
|
||||
ssh_ps59: 'sandbox'
|
||||
|
||||
ssh_macs: []
|
||||
ssh_ciphers: []
|
||||
ssh_kex: []
|
||||
|
||||
ssh_macs_53_default:
|
||||
- hmac-ripemd160
|
||||
- hmac-sha1
|
||||
|
||||
ssh_macs_53_el_6_5_default:
|
||||
- hmac-sha2-512
|
||||
- hmac-sha2-256
|
||||
|
||||
ssh_macs_59_default:
|
||||
- hmac-sha2-512
|
||||
- hmac-sha2-256
|
||||
- hmac-ripemd160
|
||||
|
||||
ssh_macs_66_default:
|
||||
- hmac-sha2-512-etm@openssh.com
|
||||
- hmac-sha2-256-etm@openssh.com
|
||||
- umac-128-etm@openssh.com
|
||||
- hmac-sha2-512
|
||||
- hmac-sha2-256
|
||||
|
||||
ssh_macs_76_default:
|
||||
- hmac-sha2-512-etm@openssh.com
|
||||
- hmac-sha2-256-etm@openssh.com
|
||||
- umac-128-etm@openssh.com
|
||||
- hmac-sha2-512
|
||||
- hmac-sha2-256
|
||||
|
||||
ssh_ciphers_53_default:
|
||||
- aes256-ctr
|
||||
- aes192-ctr
|
||||
- aes128-ctr
|
||||
|
||||
ssh_ciphers_66_default:
|
||||
- chacha20-poly1305@openssh.com
|
||||
- aes256-gcm@openssh.com
|
||||
- aes128-gcm@openssh.com
|
||||
- aes256-ctr
|
||||
- aes192-ctr
|
||||
- aes128-ctr
|
||||
|
||||
ssh_kex_59_default:
|
||||
- diffie-hellman-group-exchange-sha256
|
||||
|
||||
ssh_kex_66_default:
|
||||
- curve25519-sha256@libssh.org
|
||||
- diffie-hellman-group-exchange-sha256
|
||||
|
||||
ssh_kex_80_default:
|
||||
- sntrup4591761x25519-sha512@tinyssh.org
|
||||
- curve25519-sha256@libssh.org
|
||||
- diffie-hellman-group-exchange-sha256
|
||||
|
||||
# directory where to store ssh_password policy
|
||||
ssh_custom_selinux_dir: '/etc/selinux/local-policies'
|
||||
|
||||
sshd_moduli_file: '/etc/ssh/moduli'
|
||||
sshd_moduli_minimum: 2048
|
||||
|
||||
# disable ChallengeResponseAuthentication
|
||||
ssh_challengeresponseauthentication: false
|
||||
|
||||
# a list of public keys that are never accepted by the ssh server
|
||||
ssh_server_revoked_keys: []
|
||||
|
||||
# Set to false to turn the role into a no-op. Useful when using
|
||||
# the Ansible role dependency mechanism.
|
||||
ssh_hardening_enabled: true
|
||||
|
||||
# Custom options for SSH client configuration file
|
||||
ssh_custom_options: []
|
||||
|
||||
# Custom options for SSH daemon configuration file
|
||||
sshd_custom_options: []
|
||||
|
||||
# Logging
|
||||
sshd_syslog_facility: 'AUTH'
|
||||
sshd_log_level: 'VERBOSE'
|
||||
|
||||
sshd_strict_modes: true
|
||||
|
||||
# disable CRYPTO_POLICY to take settings from sshd configuration
|
||||
# see: https://access.redhat.com/solutions/4410591
|
||||
sshd_disable_crypto_policy: true
|
10
roles/ssh_hardening/files/ssh_password
Normal file
10
roles/ssh_hardening/files/ssh_password
Normal file
|
@ -0,0 +1,10 @@
|
|||
module ssh_password 1.0;
|
||||
|
||||
require {
|
||||
type sshd_t;
|
||||
type shadow_t;
|
||||
class file { read open };
|
||||
}
|
||||
|
||||
#============= sshd_t ==============
|
||||
allow sshd_t shadow_t:file { read open };
|
17
roles/ssh_hardening/files/sshd
Normal file
17
roles/ssh_hardening/files/sshd
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Configuration file for the sshd service.
|
||||
|
||||
# The server keys are automatically generated if they are missing.
|
||||
# To change the automatic creation, adjust sshd.service options for
|
||||
# example using systemctl enable sshd-keygen@dsa.service to allow creation
|
||||
# of DSA key or systemctl mask sshd-keygen@rsa.service to disable RSA key
|
||||
# creation.
|
||||
|
||||
# Do not change this option unless you have hardware random
|
||||
# generator and you REALLY know what you are doing
|
||||
|
||||
SSH_USE_STRONG_RNG=0
|
||||
# SSH_USE_STRONG_RNG=1
|
||||
|
||||
# System-wide crypto policy:
|
||||
# To opt-out, uncomment the following line
|
||||
CRYPTO_POLICY=
|
7
roles/ssh_hardening/handlers/main.yml
Normal file
7
roles/ssh_hardening/handlers/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: restart sshd
|
||||
service:
|
||||
name: '{{ sshd_service_name }}'
|
||||
state: restarted
|
||||
when: ssh_server_enabled | bool
|
||||
become: true
|
30
roles/ssh_hardening/meta/main.yml
Normal file
30
roles/ssh_hardening/meta/main.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
galaxy_info:
|
||||
author: "Sebastian Gumprich"
|
||||
description: 'This Ansible role provides numerous security-related ssh configurations, providing all-round base protection.'
|
||||
company: Hardening Framework Team
|
||||
license: Apache License 2.0
|
||||
min_ansible_version: '2.5'
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
- 8
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- xenial
|
||||
- bionic
|
||||
- name: Debian
|
||||
versions:
|
||||
- stretch
|
||||
- buster
|
||||
- name: Amazon
|
||||
- name: Fedora
|
||||
- name: Archlinux
|
||||
- name: SmartOS
|
||||
galaxy_tags:
|
||||
- system
|
||||
- security
|
||||
- hardening
|
||||
dependencies: []
|
27
roles/ssh_hardening/tasks/ca_keys_and_principals.yml
Normal file
27
roles/ssh_hardening/tasks/ca_keys_and_principals.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
- name: set ssh CA pub keys
|
||||
template:
|
||||
src: 'trusted_user_ca_keys.j2'
|
||||
dest: '{{ ssh_trusted_user_ca_keys_file }}'
|
||||
mode: '0644'
|
||||
owner: '{{ ssh_owner }}'
|
||||
group: '{{ ssh_group }}'
|
||||
notify: restart sshd
|
||||
|
||||
- name: create ssh authorized principals directories
|
||||
file:
|
||||
path: '{{ item.path | dirname }}'
|
||||
mode: '{{ item.directorymode | default(0700) }}'
|
||||
owner: '{{ item.directoryowner | default(ssh_owner) }}'
|
||||
group: '{{ item.directorygroup | default(ssh_group) }}'
|
||||
state: directory
|
||||
loop: '{{ ssh_authorized_principals }}'
|
||||
|
||||
- name: set ssh authorized principals
|
||||
template:
|
||||
src: 'authorized_principals.j2'
|
||||
dest: '{{ item.path }}'
|
||||
mode: '{{ item.filemode | default(0600) }}'
|
||||
owner: '{{ item.owner| default(ssh_owner) }}'
|
||||
group: '{{ item.group | default(ssh_group) }}'
|
||||
loop: '{{ ssh_authorized_principals }}'
|
10
roles/ssh_hardening/tasks/crypto_ciphers.yml
Normal file
10
roles/ssh_hardening/tasks/crypto_ciphers.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- name: set ciphers according to openssh-version if openssh >= 5.3
|
||||
set_fact:
|
||||
ssh_ciphers: '{{ ssh_ciphers_53_default }}'
|
||||
when: sshd_version is version('5.3', '>=')
|
||||
|
||||
- name: set ciphers according to openssh-version if openssh >= 6.6
|
||||
set_fact:
|
||||
ssh_ciphers: '{{ ssh_ciphers_66_default }}'
|
||||
when: sshd_version is version('6.6', '>=')
|
21
roles/ssh_hardening/tasks/crypto_hostkeys.yml
Normal file
21
roles/ssh_hardening/tasks/crypto_hostkeys.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- name: set hostkeys according to openssh-version if openssh >= 5.3
|
||||
set_fact:
|
||||
ssh_host_key_files:
|
||||
- "{{ ssh_host_keys_dir }}/ssh_host_rsa_key"
|
||||
when: sshd_version is version('5.3', '>=')
|
||||
|
||||
- name: set hostkeys according to openssh-version if openssh >= 6.0
|
||||
set_fact:
|
||||
ssh_host_key_files:
|
||||
- "{{ ssh_host_keys_dir }}/ssh_host_rsa_key"
|
||||
- "{{ ssh_host_keys_dir }}/ssh_host_ecdsa_key"
|
||||
when: sshd_version is version('6.0', '>=')
|
||||
|
||||
- name: set hostkeys according to openssh-version if openssh >= 6.3
|
||||
set_fact:
|
||||
ssh_host_key_files:
|
||||
- "{{ ssh_host_keys_dir }}/ssh_host_rsa_key"
|
||||
- "{{ ssh_host_keys_dir }}/ssh_host_ecdsa_key"
|
||||
- "{{ ssh_host_keys_dir }}/ssh_host_ed25519_key"
|
||||
when: sshd_version is version('6.3', '>=')
|
15
roles/ssh_hardening/tasks/crypto_kex.yml
Normal file
15
roles/ssh_hardening/tasks/crypto_kex.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: set kex according to openssh-version if openssh >= 5.9
|
||||
set_fact:
|
||||
ssh_kex: '{{ ssh_kex_59_default }}'
|
||||
when: sshd_version is version('5.9', '>=')
|
||||
|
||||
- name: set kex according to openssh-version if openssh >= 6.6
|
||||
set_fact:
|
||||
ssh_kex: '{{ ssh_kex_66_default }}'
|
||||
when: sshd_version is version('6.6', '>=')
|
||||
|
||||
- name: set kex according to openssh-version if openssh >= 8.0
|
||||
set_fact:
|
||||
ssh_kex: '{{ ssh_kex_80_default }}'
|
||||
when: sshd_version is version('8.0', '>=')
|
27
roles/ssh_hardening/tasks/crypto_macs.yml
Normal file
27
roles/ssh_hardening/tasks/crypto_macs.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
- name: set macs according to openssh-version if openssh >= 5.3
|
||||
set_fact:
|
||||
ssh_macs: '{{ ssh_macs_53_default }}'
|
||||
when: sshd_version is version('5.3', '>=')
|
||||
|
||||
- name: set macs for Enterprise Linux >= 6.5 (openssh 5.3 with backports)
|
||||
set_fact:
|
||||
ssh_macs: '{{ ssh_macs_53_el_6_5_default }}'
|
||||
when:
|
||||
- ansible_facts.distribution in ['CentOS', 'OracleLinux', 'RedHat']
|
||||
- ansible_facts.distribution_version is version('6.5', '>=')
|
||||
|
||||
- name: set macs according to openssh-version if openssh >= 5.9
|
||||
set_fact:
|
||||
ssh_macs: '{{ ssh_macs_59_default }}'
|
||||
when: sshd_version is version('5.9', '>=')
|
||||
|
||||
- name: set macs according to openssh-version if openssh >= 6.6
|
||||
set_fact:
|
||||
ssh_macs: '{{ ssh_macs_66_default }}'
|
||||
when: sshd_version is version('6.6', '>=')
|
||||
|
||||
- name: set macs according to openssh-version if openssh >= 7.6
|
||||
set_fact:
|
||||
ssh_macs: '{{ ssh_macs_76_default }}'
|
||||
when: sshd_version is version('7.6', '>=')
|
117
roles/ssh_hardening/tasks/hardening.yml
Normal file
117
roles/ssh_hardening/tasks/hardening.yml
Normal file
|
@ -0,0 +1,117 @@
|
|||
---
|
||||
- name: set OS dependent variables
|
||||
include_vars: '{{ item }}'
|
||||
with_first_found:
|
||||
- '{{ ansible_facts.distribution }}_{{ ansible_facts.distribution_major_version }}.yml'
|
||||
- '{{ ansible_facts.distribution }}.yml'
|
||||
- '{{ ansible_facts.os_family }}_{{ ansible_facts.distribution_major_version }}.yml'
|
||||
- '{{ ansible_facts.os_family }}.yml'
|
||||
|
||||
- name: get openssh-version
|
||||
command: ssh -V
|
||||
register: sshd_version_raw
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
|
||||
- name: parse openssh-version
|
||||
set_fact:
|
||||
sshd_version: "{{ sshd_version_raw.stderr | regex_replace('.*_([0-9]*.[0-9]).*', '\\1') }}"
|
||||
|
||||
- name: set default for ssh_host_key_files if not supplied
|
||||
include_tasks: crypto_hostkeys.yml
|
||||
when: not ssh_host_key_files
|
||||
|
||||
- name: set default for ssh_macs if not supplied
|
||||
include_tasks: crypto_macs.yml
|
||||
when: not ssh_macs
|
||||
|
||||
- name: set default for ssh_ciphers if not supplied
|
||||
include_tasks: crypto_ciphers.yml
|
||||
when: not ssh_ciphers
|
||||
|
||||
- name: set default for ssh_kex if not supplied
|
||||
include_tasks: crypto_kex.yml
|
||||
when: not ssh_kex
|
||||
|
||||
- name: create revoked_keys and set permissions to root/600
|
||||
template:
|
||||
src: 'revoked_keys.j2'
|
||||
dest: '/etc/ssh/revoked_keys'
|
||||
mode: '0600'
|
||||
owner: '{{ ssh_owner }}'
|
||||
group: '{{ ssh_group }}'
|
||||
notify: restart sshd
|
||||
when: ssh_server_hardening | bool
|
||||
|
||||
- name: create sshd_config and set permissions to root/600
|
||||
template:
|
||||
src: 'opensshd.conf.j2'
|
||||
dest: '/etc/ssh/sshd_config'
|
||||
mode: '0600'
|
||||
owner: '{{ ssh_owner }}'
|
||||
group: '{{ ssh_group }}'
|
||||
validate: '{{ sshd_path }} -T -C user=root -C host=localhost -C addr=localhost -C lport=22 -f %s'
|
||||
notify: restart sshd
|
||||
when: ssh_server_hardening | bool
|
||||
|
||||
- name: disable dynamic MOTD
|
||||
pamd:
|
||||
name: sshd
|
||||
type: session
|
||||
control: optional
|
||||
module_path: pam_motd.so
|
||||
state: absent
|
||||
backup: true
|
||||
when:
|
||||
- ssh_server_hardening | bool
|
||||
- ssh_pam_support | bool
|
||||
- not (ssh_print_pam_motd | bool)
|
||||
|
||||
- name: create ssh_config and set permissions to root/644
|
||||
template:
|
||||
src: 'openssh.conf.j2'
|
||||
dest: '/etc/ssh/ssh_config'
|
||||
mode: '0644'
|
||||
owner: '{{ ssh_owner }}'
|
||||
group: '{{ ssh_group }}'
|
||||
when: ssh_client_hardening | bool
|
||||
|
||||
- name: check if {{ sshd_moduli_file }} contains weak DH parameters
|
||||
shell: awk '$5 < {{ sshd_moduli_minimum }}' {{ sshd_moduli_file }}
|
||||
register: sshd_register_moduli
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
when: ssh_server_hardening | bool
|
||||
|
||||
- name: remove all small primes
|
||||
shell: awk '$5 >= {{ sshd_moduli_minimum }}' {{ sshd_moduli_file }} > {{ sshd_moduli_file }}.new ;
|
||||
[ -r {{ sshd_moduli_file }}.new -a -s {{ sshd_moduli_file }}.new ] && mv {{ sshd_moduli_file }}.new {{ sshd_moduli_file }} || true
|
||||
notify: restart sshd
|
||||
when:
|
||||
- ssh_server_hardening | bool
|
||||
- sshd_register_moduli.stdout
|
||||
|
||||
- name: include tasks to setup ca keys and principals
|
||||
include_tasks: ca_keys_and_principals.yml
|
||||
when: ssh_trusted_user_ca_keys_file | length > 0
|
||||
|
||||
- name: include selinux specific tasks
|
||||
include_tasks: selinux.yml
|
||||
when: ansible_facts.selinux and ansible_facts.selinux.status == "enabled"
|
||||
|
||||
- name: gather package facts
|
||||
package_facts:
|
||||
check_mode: false
|
||||
when:
|
||||
- sshd_disable_crypto_policy | bool
|
||||
|
||||
- name: disable SSH server CRYPTO_POLICY
|
||||
copy:
|
||||
src: sshd
|
||||
dest: /etc/sysconfig/sshd
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: '0640'
|
||||
when:
|
||||
- sshd_disable_crypto_policy | bool
|
||||
- ('crypto-policies' in ansible_facts.packages)
|
3
roles/ssh_hardening/tasks/main.yml
Normal file
3
roles/ssh_hardening/tasks/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- include_tasks: hardening.yml
|
||||
when: ssh_hardening_enabled | bool
|
64
roles/ssh_hardening/tasks/selinux.yml
Normal file
64
roles/ssh_hardening/tasks/selinux.yml
Normal file
|
@ -0,0 +1,64 @@
|
|||
---
|
||||
- name: install selinux dependencies when selinux is installed
|
||||
package:
|
||||
name: '{{ ssh_selinux_packages }}'
|
||||
state: present
|
||||
|
||||
- name: authorize {{ ssh_server_ports }} ports for selinux
|
||||
seport:
|
||||
ports: '{{ item }}'
|
||||
proto: tcp
|
||||
setype: ssh_port_t
|
||||
state: present
|
||||
loop: '{{ ssh_server_ports }}'
|
||||
|
||||
- name: check if ssh_password module is already installed
|
||||
shell: 'set -o pipefail && semodule -l | grep ssh_password'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: ssh_password_module
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
|
||||
# The following tasks only get executed when selinux is in state enforcing,
|
||||
# UsePam is 'no' and the ssh_password module is not installed. See this issue for
|
||||
# more info: https://github.com/hardening-io/ansible-ssh-hardening/issues/23
|
||||
- when:
|
||||
- not (ssh_use_pam | bool)
|
||||
- ('ssh_password' not in ssh_password_module.stdout)
|
||||
block:
|
||||
- name: create selinux custom policy drop folder
|
||||
file:
|
||||
path: '{{ ssh_custom_selinux_dir }}'
|
||||
state: 'directory'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: '0750'
|
||||
|
||||
- name: distributing custom selinux policies
|
||||
copy:
|
||||
src: 'ssh_password'
|
||||
dest: '{{ ssh_custom_selinux_dir }}'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: '0600'
|
||||
|
||||
- name: check and compile policy
|
||||
command: checkmodule -M -m -o {{ ssh_custom_selinux_dir }}/ssh_password.mod {{ ssh_custom_selinux_dir }}/ssh_password
|
||||
|
||||
- name: create selinux policy module package
|
||||
command: semodule_package -o {{ ssh_custom_selinux_dir }}/ssh_password.pp -m {{ ssh_custom_selinux_dir }}/ssh_password.mod
|
||||
|
||||
- name: install selinux policy
|
||||
command: semodule -i {{ ssh_custom_selinux_dir }}/ssh_password.pp
|
||||
|
||||
|
||||
# The following tasks only get executed when selinux is installed, UsePam is
|
||||
# 'yes' and the ssh_password module is installed. See
|
||||
# http://danwalsh.livejournal.com/12333.html for more info
|
||||
- name: remove selinux-policy when Pam is used, because Allowing sshd to read the shadow file directly is considered a potential security risk
|
||||
command: semodule -r ssh_password
|
||||
when:
|
||||
- ssh_use_pam | bool
|
||||
- ('ssh_password' in ssh_password_module.stdout)
|
5
roles/ssh_hardening/templates/authorized_principals.j2
Normal file
5
roles/ssh_hardening/templates/authorized_principals.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{ ansible_managed | comment }}
|
||||
|
||||
{% for principal in item.principals %}
|
||||
{{ principal }}
|
||||
{% endfor %}
|
125
roles/ssh_hardening/templates/openssh.conf.j2
Normal file
125
roles/ssh_hardening/templates/openssh.conf.j2
Normal file
|
@ -0,0 +1,125 @@
|
|||
#jinja2: trim_blocks: "true", lstrip_blocks: "true"
|
||||
{{ ansible_managed | comment }}
|
||||
|
||||
# This is the ssh client system-wide configuration file.
|
||||
# See ssh_config(5) for more information on any settings used. Comments will be added only to clarify why a configuration was chosen.
|
||||
|
||||
{% if ssh_custom_options %}
|
||||
# Custom configuration that overwrites default configuration
|
||||
# ==========================================================
|
||||
{% for line in ssh_custom_options %}
|
||||
{{ line }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
# Basic configuration
|
||||
# ===================
|
||||
|
||||
# Address family should always be limited to the active network configuration.
|
||||
AddressFamily {{ 'any' if network_ipv6_enable else 'inet' }}
|
||||
|
||||
{% for host in ssh_remote_hosts %}
|
||||
{% if loop.first %}
|
||||
# Host-specific configuration
|
||||
{% endif %}
|
||||
Host {{ host.names | join(' ') }}
|
||||
{{ host.options | join('\n') | indent(2) }}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
# Global defaults for all Hosts
|
||||
Host *
|
||||
|
||||
# The port at the destination should be defined
|
||||
Port {{ ssh_client_port }}
|
||||
|
||||
# Identity file configuration. You may restrict available identity files. Otherwise ssh will search for a pattern and use any that matches.
|
||||
#IdentityFile ~/.ssh/identity
|
||||
#IdentityFile ~/.ssh/id_rsa
|
||||
#IdentityFile ~/.ssh/id_dsa
|
||||
|
||||
|
||||
# Security configuration
|
||||
# ======================
|
||||
|
||||
# Set the protocol version to 2 for security reasons. Disables legacy support.
|
||||
Protocol 2
|
||||
|
||||
# Make sure passphrase querying is enabled
|
||||
BatchMode no
|
||||
|
||||
# Prevent IP spoofing by checking to host IP against the `known_hosts` file.
|
||||
CheckHostIP yes
|
||||
|
||||
# Always ask before adding keys to the `known_hosts` file. Do not set to `yes`.
|
||||
StrictHostKeyChecking ask
|
||||
|
||||
|
||||
# **Ciphers** -- If your clients don't support CTR (eg older versions), cbc will be added
|
||||
# CBC: is true if you want to connect with OpenSSL-base libraries
|
||||
# eg ruby Net::SSH::Transport::CipherFactory requires cbc-versions of the given openssh ciphers to work
|
||||
# -- see: (http://net-ssh.github.com/net-ssh/classes/Net/SSH/Transport/CipherFactory.html)
|
||||
#
|
||||
|
||||
{# This outputs 'Ciphers <list-of-ciphers>' if ssh_ciphers is defined or '#Ciphers' if ssh_ciphers is undefined #}
|
||||
{{ 'Ciphers ' ~ ssh_ciphers|join(',') if ssh_ciphers else 'Ciphers'|comment }}
|
||||
|
||||
# **Hash algorithms** -- Make sure not to use SHA1 for hashing, unless it is really necessary.
|
||||
# Weak HMAC is sometimes required if older package versions are used
|
||||
# eg Ruby's Net::SSH at around 2.2.* doesn't support sha2 for hmac, so this will have to be set true in this case.
|
||||
#
|
||||
|
||||
{# This outputs 'MACs <list-of-macs>' if ssh_macs is defined or '#MACs' if ssh_macs is undefined #}
|
||||
{{ 'MACs ' ~ ssh_macs|join(',') if ssh_macs else 'MACs'|comment }}
|
||||
|
||||
# Alternative setting, if OpenSSH version is below v5.9
|
||||
#MACs hmac-ripemd160
|
||||
|
||||
# **Key Exchange Algorithms** -- Make sure not to use SHA1 for kex, unless it is really necessary
|
||||
# Weak kex is sometimes required if older package versions are used
|
||||
# eg ruby's Net::SSH at around 2.2.* doesn't support sha2 for kex, so this will have to be set true in this case.
|
||||
# based on: https://bettercrypto.org/static/applied-crypto-hardening.pdf
|
||||
|
||||
{# This outputs 'KexAlgorithms <list-of-algos>' if ssh_kex is defined or '#KexAlgorithms' if ssh_kex is undefined #}
|
||||
{{ 'KexAlgorithms ' ~ ssh_kex|join(',') if ssh_kex else 'KexAlgorithms'|comment }}
|
||||
|
||||
# Disable agent forwarding, since local agent could be accessed through forwarded connection.
|
||||
ForwardAgent no
|
||||
|
||||
# Disable X11 forwarding, since local X11 display could be accessed through forwarded connection.
|
||||
ForwardX11 no
|
||||
|
||||
# Never use host-based authentication. It can be exploited.
|
||||
HostbasedAuthentication no
|
||||
{% if sshd_version is version('7.6', '<') %}
|
||||
RhostsRSAAuthentication no
|
||||
# Enable RSA authentication via identity files.
|
||||
RSAAuthentication yes
|
||||
{% endif %}
|
||||
|
||||
# Disable password-based authentication, it can allow for potentially easier brute-force attacks.
|
||||
PasswordAuthentication {{ 'yes' if ssh_client_password_login else 'no' }}
|
||||
|
||||
# Only use GSSAPIAuthentication if implemented on the network.
|
||||
GSSAPIAuthentication no
|
||||
GSSAPIDelegateCredentials no
|
||||
|
||||
# Disable tunneling
|
||||
Tunnel no
|
||||
|
||||
# Disable local command execution.
|
||||
PermitLocalCommand no
|
||||
|
||||
|
||||
# Misc. configuration
|
||||
# ===================
|
||||
|
||||
Compression {{ 'yes' if (ssh_client_compression|bool) else 'no' }}
|
||||
|
||||
#EscapeChar ~
|
||||
#VisualHostKey yes
|
||||
|
||||
{% if sshd_version is version('7.1', '<=') %}
|
||||
# Disable experimental client roaming. This is known to cause potential issues with secrets being disclosed to malicious servers and defaults to being disabled.
|
||||
UseRoaming {{ 'yes' if ssh_client_roaming else 'no' }}
|
||||
{% endif %}
|
311
roles/ssh_hardening/templates/opensshd.conf.j2
Normal file
311
roles/ssh_hardening/templates/opensshd.conf.j2
Normal file
|
@ -0,0 +1,311 @@
|
|||
#jinja2: trim_blocks: "true", lstrip_blocks: "true"
|
||||
{{ ansible_managed | comment }}
|
||||
|
||||
# This is the ssh client system-wide configuration file.
|
||||
# See sshd_config(5) for more information on any settings used. Comments will be added only to clarify why a configuration was chosen.
|
||||
|
||||
{% if sshd_custom_options %}
|
||||
# Custom configuration that overwrites default configuration
|
||||
# ==========================================================
|
||||
{% for line in sshd_custom_options %}
|
||||
{{ line }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
# Basic configuration
|
||||
# ===================
|
||||
|
||||
# Either disable or only allow root login via certificates.
|
||||
PermitRootLogin {{ ssh_permit_root_login }}
|
||||
|
||||
# Define which port sshd should listen to. Default to `22`.
|
||||
{% for port in ssh_server_ports %}
|
||||
Port {{ port }}
|
||||
{% endfor %}
|
||||
|
||||
# Address family should always be limited to the active network configuration.
|
||||
AddressFamily {{ 'any' if (network_ipv6_enable|bool) else 'inet' }}
|
||||
|
||||
# Define which addresses sshd should listen to. Default to `0.0.0.0`, ie make sure you put your desired address in here, since otherwise sshd will listen to everyone.
|
||||
{% for address in ssh_listen_to %}
|
||||
ListenAddress {{ address }}
|
||||
{% endfor %}
|
||||
|
||||
# List HostKeys here.
|
||||
{% for key in ssh_host_key_files %}
|
||||
HostKey {{ key }}
|
||||
{% endfor %}
|
||||
|
||||
# Specifies the host key algorithms that the server offers.
|
||||
{% if sshd_version is version('5.8', '>=') %}
|
||||
{{ "HostKeyAlgorithms " ~ ssh_host_key_algorithms|join(',') if ssh_host_key_algorithms else "HostKeyAlgorithms"|comment }}
|
||||
{% endif %}
|
||||
|
||||
# Security configuration
|
||||
# ======================
|
||||
|
||||
# Set the protocol version to 2 for security reasons. Disables legacy support.
|
||||
Protocol 2
|
||||
|
||||
# Make sure sshd checks file modes and ownership before accepting logins. This prevents accidental misconfiguration.
|
||||
StrictModes {{ 'yes' if (sshd_strict_modes|bool) else 'no' }}
|
||||
|
||||
# Logging, obsoletes QuietMode and FascistLogging
|
||||
SyslogFacility {{ sshd_syslog_facility }}
|
||||
LogLevel {{ sshd_log_level }}
|
||||
|
||||
# Cryptography
|
||||
# ------------
|
||||
|
||||
# **Ciphers** -- If your clients don't support CTR (eg older versions), cbc will be added
|
||||
# CBC: is true if you want to connect with OpenSSL-base libraries
|
||||
# eg ruby Net::SSH::Transport::CipherFactory requires cbc-versions of the given openssh ciphers to work
|
||||
# -- see: (http://net-ssh.github.com/net-ssh/classes/Net/SSH/Transport/CipherFactory.html)
|
||||
#
|
||||
|
||||
{# This outputs 'Ciphers <list-of-ciphers>' if ssh_ciphers is defined or '#Ciphers' if ssh_ciphers is undefined #}
|
||||
{{ 'Ciphers ' ~ ssh_ciphers|join(',') if ssh_ciphers else 'Ciphers'|comment }}
|
||||
|
||||
# **Hash algorithms** -- Make sure not to use SHA1 for hashing, unless it is really necessary.
|
||||
# Weak HMAC is sometimes required if older package versions are used
|
||||
# eg Ruby's Net::SSH at around 2.2.* doesn't support sha2 for hmac, so this will have to be set true in this case.
|
||||
#
|
||||
|
||||
{# This outputs 'MACs <list-of-macs>' if ssh_macs is defined or '#MACs' if ssh_macs is undefined #}
|
||||
{{ 'MACs ' ~ ssh_macs|join(',') if ssh_macs else 'MACs'|comment }}
|
||||
|
||||
# Alternative setting, if OpenSSH version is below v5.9
|
||||
#MACs hmac-ripemd160
|
||||
|
||||
# **Key Exchange Algorithms** -- Make sure not to use SHA1 for kex, unless it is really necessary
|
||||
# Weak kex is sometimes required if older package versions are used
|
||||
# eg ruby's Net::SSH at around 2.2.* doesn't support sha2 for kex, so this will have to be set true in this case.
|
||||
# based on: https://bettercrypto.org/static/applied-crypto-hardening.pdf
|
||||
|
||||
{# This outputs 'KexAlgorithms <list-of-algos>' if ssh_kex is defined or '#KexAlgorithms' if ssh_kex is undefined #}
|
||||
{{ 'KexAlgorithms ' ~ ssh_kex|join(',') if ssh_kex else 'KexAlgorithms'|comment }}
|
||||
|
||||
# Authentication
|
||||
# --------------
|
||||
|
||||
# Secure Login directives.
|
||||
{% if sshd_version is version('7.4', '<') %}
|
||||
UseLogin no
|
||||
{% endif %}
|
||||
{% if sshd_version is version('7.5', '<') %}
|
||||
UsePrivilegeSeparation {{
|
||||
(ansible_facts.distribution == 'Debian' and ansible_facts.distribution_major_version <= '6')
|
||||
or (ansible_facts.os_family in ['Oracle Linux', 'RedHat'] and ansible_facts.distribution_major_version <= '6' and not ansible_facts.distribution == 'Amazon')
|
||||
| ternary(ssh_ps53, ssh_ps59)
|
||||
}}
|
||||
{% endif %}
|
||||
|
||||
LoginGraceTime {{ ssh_login_grace_time }}
|
||||
MaxAuthTries {{ ssh_max_auth_retries }}
|
||||
MaxSessions {{ ssh_max_sessions }}
|
||||
MaxStartups {{ ssh_max_startups }}
|
||||
|
||||
# Enable public key authentication
|
||||
PubkeyAuthentication yes
|
||||
|
||||
# Never use host-based authentication. It can be exploited.
|
||||
IgnoreRhosts yes
|
||||
IgnoreUserKnownHosts yes
|
||||
HostbasedAuthentication no
|
||||
|
||||
# Enable PAM to enforce system wide rules
|
||||
{% if ssh_pam_support %}
|
||||
UsePAM {{ 'yes' if (ssh_use_pam|bool) else 'no' }}
|
||||
{% endif %}
|
||||
|
||||
# Set AuthenticationMethods per default to publickey
|
||||
# AuthenticationMethods was introduced in OpenSSH 6.2 - https://www.openssh.com/txt/release-6.2
|
||||
{% if sshd_version is version('6.2', '>=') %}
|
||||
AuthenticationMethods {{ sshd_authenticationmethods }}
|
||||
{% endif %}
|
||||
|
||||
# Disable password-based authentication, it can allow for potentially easier brute-force attacks.
|
||||
PasswordAuthentication {{ 'yes' if (ssh_server_password_login|bool) else 'no' }}
|
||||
PermitEmptyPasswords no
|
||||
ChallengeResponseAuthentication {{ 'yes' if (ssh_challengeresponseauthentication|bool) else 'no' }}
|
||||
|
||||
{% if ssh_kerberos_support %}
|
||||
# Only enable Kerberos authentication if it is configured.
|
||||
KerberosAuthentication no
|
||||
KerberosOrLocalPasswd no
|
||||
KerberosTicketCleanup yes
|
||||
#KerberosGetAFSToken no
|
||||
{% endif %}
|
||||
|
||||
# Only enable GSSAPI authentication if it is configured.
|
||||
GSSAPIAuthentication {{ 'yes' if ssh_gssapi_support else 'no' }}
|
||||
GSSAPICleanupCredentials yes
|
||||
|
||||
# In case you don't use PAM (`UsePAM no`), you can alternatively restrict users and groups here. For key-based authentication this is not necessary, since all keys must be explicitely enabled.
|
||||
{% if ssh_deny_users %}
|
||||
DenyUsers {{ ssh_deny_users }}
|
||||
{% endif %}
|
||||
|
||||
{% if ssh_allow_users %}
|
||||
AllowUsers {{ ssh_allow_users }}
|
||||
{% endif %}
|
||||
|
||||
{% if ssh_deny_groups %}
|
||||
DenyGroups {{ ssh_deny_groups }}
|
||||
{% endif %}
|
||||
|
||||
{% if ssh_allow_groups %}
|
||||
AllowGroups {{ ssh_allow_groups }}
|
||||
{% endif %}
|
||||
|
||||
{% if ssh_authorized_keys_file %}
|
||||
AuthorizedKeysFile {{ ssh_authorized_keys_file }}
|
||||
{% endif %}
|
||||
|
||||
{% if ssh_trusted_user_ca_keys_file %}
|
||||
TrustedUserCAKeys {{ ssh_trusted_user_ca_keys_file }}
|
||||
{% if ssh_authorized_principals_file %}
|
||||
AuthorizedPrincipalsFile {{ ssh_authorized_principals_file }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
# Network
|
||||
# -------
|
||||
|
||||
# Disable TCP keep alive since it is spoofable. Use ClientAlive messages instead, they use the encrypted channel
|
||||
TCPKeepAlive no
|
||||
|
||||
# Manage `ClientAlive..` signals via interval and maximum count. This will periodically check up to a `..CountMax` number of times within `..Interval` timeframe, and abort the connection once these fail.
|
||||
ClientAliveInterval {{ ssh_client_alive_interval }}
|
||||
ClientAliveCountMax {{ ssh_client_alive_count }}
|
||||
|
||||
# Disable tunneling
|
||||
PermitTunnel {{ 'yes' if (ssh_permit_tunnel|bool) else 'no' }}
|
||||
|
||||
# Disable forwarding tcp connections.
|
||||
# no real advantage without denied shell access
|
||||
{% if sshd_version is version('6.2', '>=') %}
|
||||
AllowTcpForwarding {{ ssh_allow_tcp_forwarding if (ssh_allow_tcp_forwarding in ('yes', 'no', 'local', 'all')) else 'no' }}
|
||||
{% else %}
|
||||
AllowTcpForwarding {{ ssh_allow_tcp_forwarding if (ssh_allow_tcp_forwarding in ('yes', 'no')) else 'no' }}
|
||||
{% endif %}
|
||||
|
||||
# Disable agent forwarding, since local agent could be accessed through forwarded connection.
|
||||
# no real advantage without denied shell access
|
||||
AllowAgentForwarding {{ 'yes' if (ssh_allow_agent_forwarding|bool) else 'no' }}
|
||||
|
||||
{% if ssh_gateway_ports|bool %}
|
||||
# Port forwardings are forced to bind to the wildcard address
|
||||
GatewayPorts yes
|
||||
{% elif ssh_gateway_ports == 'clientspecified' %}
|
||||
# Clients allowed to specify which address to bind port forwardings to
|
||||
GatewayPorts clientspecified
|
||||
{% else %}
|
||||
# Do not allow remote port forwardings to bind to non-loopback addresses.
|
||||
GatewayPorts no
|
||||
{% endif %}
|
||||
|
||||
# Disable X11 forwarding, since local X11 display could be accessed through forwarded connection.
|
||||
X11Forwarding {{ 'yes' if (ssh_x11_forwarding|bool) else 'no' }}
|
||||
X11UseLocalhost yes
|
||||
|
||||
# User environment configuration
|
||||
# ==============================
|
||||
|
||||
PermitUserEnvironment {{ ssh_server_permit_environment_vars }}
|
||||
|
||||
{% if ssh_server_accept_env_vars %}
|
||||
AcceptEnv {{ ssh_server_accept_env_vars }}
|
||||
{% endif %}
|
||||
|
||||
# Misc. configuration
|
||||
# ===================
|
||||
|
||||
Compression {{ 'yes' if (ssh_compression|bool) else 'no' }}
|
||||
|
||||
UseDNS {{ 'yes' if (ssh_use_dns|bool) else 'no' }}
|
||||
|
||||
PrintMotd {{ 'yes' if (ssh_print_motd|bool) else 'no' }}
|
||||
|
||||
{% if ansible_facts.os_family != 'FreeBSD' %}
|
||||
PrintLastLog {{ 'yes' if (ssh_print_last_log|bool) else 'no' }}
|
||||
{% endif %}
|
||||
|
||||
Banner {{ ssh_banner_path if (ssh_banner|bool) else 'none' }}
|
||||
|
||||
{% if ansible_facts.os_family == 'Debian' %}
|
||||
DebianBanner {{ 'yes' if (ssh_print_debian_banner|bool) else 'no' }}
|
||||
{% endif %}
|
||||
|
||||
# Reject keys that are explicitly blacklisted
|
||||
RevokedKeys /etc/ssh/revoked_keys
|
||||
|
||||
{% if sftp_enabled %}
|
||||
# SFTP matching configuration
|
||||
# ===========================
|
||||
# Configuration, in case SFTP is used
|
||||
# override default of no subsystems
|
||||
# Subsystem sftp /opt/app/openssh5/libexec/sftp-server
|
||||
|
||||
Subsystem sftp internal-sftp -l INFO -f LOCAL6 -u {{ sftp_umask }}
|
||||
|
||||
# These lines must appear at the *end* of sshd_config
|
||||
Match Group sftponly
|
||||
ForceCommand internal-sftp -l INFO -f LOCAL6 -u {{ sftp_umask }}
|
||||
{% if sftp_chroot %}
|
||||
ChrootDirectory {{ sftp_chroot_dir }}
|
||||
{% endif %}
|
||||
AllowTcpForwarding no
|
||||
AllowAgentForwarding no
|
||||
PasswordAuthentication {{ 'yes' if (ssh_server_password_login|bool) else 'no' }}
|
||||
PermitRootLogin no
|
||||
X11Forwarding no
|
||||
{% endif %}
|
||||
{% if ssh_server_match_address %}
|
||||
|
||||
# Address matching configuration
|
||||
# ============================
|
||||
|
||||
{% for item in ssh_server_match_address %}
|
||||
Match Address {{ item.address }}
|
||||
{% for rule in item.rules %}
|
||||
{{ rule | indent(4) }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if ssh_server_match_group %}
|
||||
|
||||
# Group matching configuration
|
||||
# ============================
|
||||
|
||||
{% for item in ssh_server_match_group %}
|
||||
Match Group {{ item.group }}
|
||||
{% for rule in item.rules %}
|
||||
{{ rule | indent(4) }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if ssh_server_match_user %}
|
||||
|
||||
# User matching configuration
|
||||
# ===========================
|
||||
|
||||
{% for item in ssh_server_match_user %}
|
||||
Match User {{ item.user }}
|
||||
{% for rule in item.rules %}
|
||||
{{ rule | indent(4) }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if ssh_server_match_local_port %}
|
||||
|
||||
# LocalPort matching configuration
|
||||
# ================================
|
||||
|
||||
{% for item in ssh_server_match_local_port %}
|
||||
Match LocalPort {{ item.port }}
|
||||
{% for rule in item.rules %}
|
||||
{{ rule | indent(4) }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
5
roles/ssh_hardening/templates/revoked_keys.j2
Normal file
5
roles/ssh_hardening/templates/revoked_keys.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{ ansible_managed | comment }}
|
||||
|
||||
{% for key in ssh_server_revoked_keys %}
|
||||
{{ key }}
|
||||
{% endfor %}
|
5
roles/ssh_hardening/templates/trusted_user_ca_keys.j2
Normal file
5
roles/ssh_hardening/templates/trusted_user_ca_keys.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{ ansible_managed | comment }}
|
||||
|
||||
{% for key in ssh_trusted_user_ca_keys %}
|
||||
{{ key }}
|
||||
{% endfor %}
|
10
roles/ssh_hardening/vars/Archlinux.yml
Normal file
10
roles/ssh_hardening/vars/Archlinux.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
sshd_path: /usr/sbin/sshd
|
||||
ssh_host_keys_dir: '/etc/ssh'
|
||||
sshd_service_name: sshd
|
||||
ssh_owner: root
|
||||
ssh_group: root
|
||||
|
||||
# CRYPTO_POLICY is not supported on Archlinux
|
||||
# and the package check only works in Ansible >2.10
|
||||
sshd_disable_crypto_policy: false
|
9
roles/ssh_hardening/vars/Debian.yml
Normal file
9
roles/ssh_hardening/vars/Debian.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
sshd_path: /usr/sbin/sshd
|
||||
ssh_host_keys_dir: '/etc/ssh'
|
||||
sshd_service_name: ssh
|
||||
ssh_owner: root
|
||||
ssh_group: root
|
||||
ssh_selinux_packages:
|
||||
- policycoreutils-python
|
||||
- checkpolicy
|
9
roles/ssh_hardening/vars/Fedora.yml
Normal file
9
roles/ssh_hardening/vars/Fedora.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
sshd_path: /usr/sbin/sshd
|
||||
ssh_host_keys_dir: '/etc/ssh'
|
||||
sshd_service_name: sshd
|
||||
ssh_owner: root
|
||||
ssh_group: root
|
||||
ssh_selinux_packages:
|
||||
- python3-policycoreutils
|
||||
- checkpolicy
|
6
roles/ssh_hardening/vars/FreeBSD.yml
Normal file
6
roles/ssh_hardening/vars/FreeBSD.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
sshd_path: /usr/sbin/sshd
|
||||
ssh_host_keys_dir: '/etc/ssh'
|
||||
sshd_service_name: sshd
|
||||
ssh_owner: root
|
||||
ssh_group: wheel
|
11
roles/ssh_hardening/vars/OpenBSD.yml
Normal file
11
roles/ssh_hardening/vars/OpenBSD.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
sshd_path: /usr/sbin/sshd
|
||||
ssh_host_keys_dir: '/etc/ssh'
|
||||
sshd_service_name: sshd
|
||||
ssh_owner: root
|
||||
ssh_group: wheel
|
||||
|
||||
ssh_gssapi_support: false
|
||||
ssh_kerberos_support: false
|
||||
ssh_pam_support: false
|
||||
sshd_moduli_file: '/etc/moduli'
|
9
roles/ssh_hardening/vars/Oracle Linux.yml
Normal file
9
roles/ssh_hardening/vars/Oracle Linux.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
sshd_path: /usr/sbin/sshd
|
||||
ssh_host_keys_dir: '/etc/ssh'
|
||||
sshd_service_name: sshd
|
||||
ssh_owner: root
|
||||
ssh_group: root
|
||||
ssh_selinux_packages:
|
||||
- policycoreutils-python
|
||||
- checkpolicy
|
9
roles/ssh_hardening/vars/RedHat.yml
Normal file
9
roles/ssh_hardening/vars/RedHat.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
sshd_path: /usr/sbin/sshd
|
||||
ssh_host_keys_dir: '/etc/ssh'
|
||||
sshd_service_name: sshd
|
||||
ssh_owner: root
|
||||
ssh_group: root
|
||||
ssh_selinux_packages:
|
||||
- policycoreutils-python
|
||||
- checkpolicy
|
9
roles/ssh_hardening/vars/RedHat_8.yml
Normal file
9
roles/ssh_hardening/vars/RedHat_8.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
sshd_path: /usr/sbin/sshd
|
||||
ssh_host_keys_dir: '/etc/ssh'
|
||||
sshd_service_name: sshd
|
||||
ssh_owner: root
|
||||
ssh_group: root
|
||||
ssh_selinux_packages:
|
||||
- python3-policycoreutils
|
||||
- checkpolicy
|
8
roles/ssh_hardening/vars/SmartOS.yml
Normal file
8
roles/ssh_hardening/vars/SmartOS.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
sshd_path: /usr/lib/ssh/sshd
|
||||
ssh_host_keys_dir: '/var/ssh'
|
||||
sshd_service_name: ssh
|
||||
ssh_owner: root
|
||||
ssh_group: root
|
||||
|
||||
ssh_pam_support: false
|
8
roles/ssh_hardening/vars/Suse.yml
Normal file
8
roles/ssh_hardening/vars/Suse.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
sshd_path: /usr/sbin/sshd
|
||||
ssh_host_keys_dir: '/etc/ssh'
|
||||
sshd_service_name: sshd
|
||||
ssh_owner: root
|
||||
ssh_group: root
|
||||
|
||||
sshd_disable_crypto_policy: false
|
Loading…
Reference in a new issue