Commit graph

283 commits

Author SHA1 Message Date
Jacob Sievert
ade6deeba2
Updates handlers for new ansible syntax and deprecated options for legacy commands (#602)
* Update main.yml

fixes the handler file and set new syntax

Signed-off-by: Jacob Sievert <jacob.sievert@sievert-mail.de>

* changes command module from legacy to builtin.

Signed-off-by: Jacob Sievert <jacob.sievert@sievert-mail.de>

Signed-off-by: Jacob Sievert <jacob.sievert@sievert-mail.de>
2022-11-24 08:39:05 +01:00
Cristian Baldi
7d1da63c94
Allow ssh_allow_tcp_forwarding to be a boolean (#600)
* Allow ssh_allow_tcp_forwarding to be a boolean

Signed-off-by: Cristian Baldi <cristian.baldi@scrive.com>

* Update documentation related to ssh_allow_tcp_forwarding

Signed-off-by: Cristian Baldi <cristian.baldi@scrive.com>

Signed-off-by: Cristian Baldi <cristian.baldi@scrive.com>
2022-11-23 13:45:01 +01:00
Dennis Eriksen
681898bd96 OpenBSD does not support GSSAPIAuthentication
... and freaks out when it is mentioned in the config files. So let's
just remove the GSSAPI-stuff.

Signed-off-by: Dennis Eriksen <d@ennis.no>
2022-11-08 09:12:18 +01:00
Dennis Eriksen
4df95e3733
OpenBSD does not set distributiuon_major_version (#597)
This role fails with `The task includes an option with an undefined variable` on OpenBSD because `distributiuon_major_version` is not set on OpenBSD.

We should either default to "" if the variable is not set, or remove `vars/OpenBSD.yml`. I would prefer the former :)

Signed-off-by: Dennis Eriksen <d@ennis.no>

Signed-off-by: Dennis Eriksen <d@ennis.no>
2022-11-04 12:00:55 +01:00
Diego Louzán
f8295d5248 fix(os_hardening): cast expected int types in pam tasks
Signed-off-by: Diego Louzán <diego.louzan@gmail.com>
2022-10-27 16:50:08 +02:00
Sebastian Gumprich
dac66f4a88 simplify OS-vars files
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-10-25 18:59:11 +02:00
Sebastian Gumprich
3b8b394f10 add ssh-vars for new OS
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-10-25 18:59:11 +02:00
Sebastian Gumprich
b27ffd08b0 add mysql-vars for new OS
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-10-25 18:58:53 +02:00
schurzi
a1b80fe657
adopt all current suggestions from ansible-lint (#592) 2022-10-24 09:42:23 +02:00
donestefan
464d8df8e8
add hardening of root user account(s) (#579) 2022-10-21 11:05:43 +02:00
Benedikt Böhm
802bad48e6
do not manage trusted user ca keys if none exist (#580)
Signed-off-by: Benedikt Böhm <bb@xnull.de>

Signed-off-by: Benedikt Böhm <bb@xnull.de>
2022-10-20 14:44:14 +02:00
hagenbauer
500cd24beb
nginx variables for configuration and owner (#578)
Signed-off-by: hagen.bauer@caserio.de <hagen.bauer@caserio.de>

Signed-off-by: hagen.bauer@caserio.de <hagen.bauer@caserio.de>
2022-09-08 14:58:10 +02:00
Simon Baerlocher
883effef82
add centos >8 Support (#573)
Signed-off-by: Simon Baerlocher <s.baerlocher@sbaerlocher.ch>

Signed-off-by: Simon Baerlocher <s.baerlocher@sbaerlocher.ch>
2022-09-06 16:31:43 +02:00
Sebastian Gumprich
9ac01fb358
add always-tag to include so other tags can be used (#569)
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-08-26 13:45:05 +02:00
Sebastian Gumprich
11d187e62e
update supported OS in meta and fix linting (#572)
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-08-26 13:44:51 +02:00
donestefan
38e1c3bbeb
fix misleading comment (#571)
also RHEL6 is not supported anymore
2022-08-26 09:17:54 +02:00
divialth
fb8b9142c8
rework filesystem hardening (#555)
* rework filesystem hardening

-  removed a lot duplicated code by using a loop
-  added new hardening options for /tmp
-  added new options "passno" and "dump" for every filesystem.
   currently ansible changed that values to 0 for every fs
   new default depends on fstype, can be overwriten in config
-  removed default fstype in config
   the type will now be autodetected,  can be overwriten in config
-  mount src setting is now optional
   the source will now be autodetected,  can be overwriten in config
-  it will be now checked, if it is really a mount
-  changed fs reload to handler
-  removed check os_auditd_enabled on /var/log/audit

Signed-off-by: divialth <65872926+divialth@users.noreply.github.com>

* fix lint errors

Signed-off-by: divialth <65872926+divialth@users.noreply.github.com>

* implemented the name suggestions

Signed-off-by: divialth <65872926+divialth@users.noreply.github.com>

Signed-off-by: divialth <65872926+divialth@users.noreply.github.com>
2022-08-22 11:16:57 +02:00
schurzi
c1cd6c5ac3
change default to allow SFTP (#564)
* change default to allow SFTP

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* add documentation

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* diasble sftp for default tests

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* extend documentation

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* fix typo

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* correct ssh version

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-08-22 10:03:37 +02:00
PhilippFunk
fd3fc1cfba
add option to bypass .netrc check function (#563)
add option to whitelist specific user that need a .netrc file in there home dirs
add test for .netrc files if option os_netrc_enabled is false

Signed-off-by: Philipp Funk <philipp.funk@t-systems.com>

Signed-off-by: Philipp Funk <philipp.funk@t-systems.com>
Co-authored-by: Philipp Funk <philipp.funk@t-systems.com>
2022-08-17 09:09:00 +02:00
Daya Adianto
eef8708918
Add full support for Debian 11 (#538)
* Include Debian 11 into Molecule test suites (#527)

Signed-off-by: Daya Adianto <dayaadianto@cs.ui.ac.id>

* Fix Ansible Lint GitHub Action version (#527)

Signed-off-by: Daya Adianto <dayaadianto@cs.ui.ac.id>

* Update .gitignore

Signed-off-by: Daya Adianto <dayaadianto@cs.ui.ac.id>

* mysql_hardening: Use Python 3 as Ansible interpreter (#527)

Signed-off-by: Daya Adianto <dayaadianto@cs.ui.ac.id>

* Note Debian 11 support for os_hardening & nginx_hardening (#527)

Signed-off-by: Daya Adianto <dayaadianto@cs.ui.ac.id>

* Fix lint issues & Ansible Lint configuration in CI

Signed-off-by: Daya Adianto <dayaadianto@cs.ui.ac.id>

* Try to fix YAML lint issues, again

Re-ordered YAML comments at the end of `.yamllint` file.

Signed-off-by: Daya Adianto <dayaadianto@cs.ui.ac.id>

* rm debian9 from tests, add debian 11 where missing

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>

* fix mysql molecule tests

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>

Signed-off-by: Daya Adianto <dayaadianto@cs.ui.ac.id>
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
Co-authored-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
Co-authored-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-08-16 15:02:27 +02:00
Sebastian Gumprich
d11595d81a
revert debian 9 change, only one tls variable now (#562)
fixes #528

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-08-15 16:01:49 +02:00
schurzi
a806ec8598
add posibility to run ssh_hardening as unprivileged user (#561)
* add VM tests for ssh_hardening

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* remove VM tests from ssh_hardening

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* run ssh_hardening test as unprivileged user

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* add link for documentation

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* use different config

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* remove become

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* re-add become

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* move become into role

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* indentation

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* try args apply

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* fix linting

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

* add documentation

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-08-15 13:19:07 +02:00
schurzi
b56c801574
add basic support for ubuntu22.04 (#554)
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-08-15 13:05:09 +02:00
Benedikt Böhm
2265497e75
Fix broken mode for /var/log/audit (#552)
```
Unable to open /var/log/audit/audit.log (Permission denied)
```

This PR fixes the issue by using the default permission set by auditd (`0700`).

Signed-off-by: Benedikt Böhm <bb@xnull.de>
2022-07-26 15:57:39 +02:00
David James
8c82af9c98
Only run hardening if /var/log/audit exists (#550)
* Only run harding if /var/log/audit exists

Signed-off-by: GitHub <noreply@github.com>

* Update roles/os_hardening/tasks/minimize_access.yml

* add more conditionals to when auditd show be hardened

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>

* add more tests to the os-hardening vm tests

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>

* Revert "add more tests to the os-hardening vm tests"

This reverts commit c05fe8b520.

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>

Co-authored-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
Co-authored-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-07-15 11:41:01 +02:00
Martin Schurz
edda7075a2 add badge for tests
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-07-11 12:17:34 +02:00
Martin Schurz
0f631c1405 add sysctl exclude
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-07-11 09:39:52 +02:00
Martin Schurz
5d50b5b130 add sysctl exclude
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-07-11 09:32:02 +02:00
Martin Schurz
28baf0d581 add sysctl exclude
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-07-11 09:17:44 +02:00
Martin Schurz
4b519e8b13 add sysctl exclude
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-07-11 09:13:26 +02:00
Martin Schurz
92dc094022 add sysctl exclude
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-07-11 09:05:58 +02:00
Martin Schurz
cd45a58683 fix yum gpg-check task
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-07-10 20:22:39 +02:00
Martin Schurz
fa7f8597d9 fix bug in check for /boot
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-07-10 13:36:19 +02:00
Sebastian Gumprich
73f84ae2a9 fix wrong indentation
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-07-08 16:04:37 +02:00
Sebastian Gumprich
9b50392d8a fix linting
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-07-07 16:12:06 +02:00
rndmh3ro
e28e09cd0e Prettified Code! 2022-07-07 07:02:50 +00:00
balu
488ff6a7c3
Harden mountpoints (#531)
* first testing with tasks and variables

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* update variables for dir options

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* updated permissions and defaults

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* fix home dir permissions

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* updated tasks with useful variables

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* reorder tasks. first remount, then manage fstab and fix permissions on directories. Renaming task names with mountpoints (slashes)

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* shorten tasks with list items

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* change defaults for /boot directory, because its a bad behaviour, if ansible changes boot entries with a default value

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* Update documentation for new parameters to manage mountpoints

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* Update roles/os_hardening/tasks/minimize_access.yml

Co-authored-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* Update roles/os_hardening/tasks/minimize_access.yml

Co-authored-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* Fix state on every new task

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* loop instead of list

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* testing remount with register

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* add remounts with loop over all changed folders

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* testing and solving trouble with variable names

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* optimize default permissions for var-log-audit

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* optimize default permissions for var-log-audit

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* change to new optimizied permissions of var-log-audit

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* fix some defaults in fstab to configure as mounted

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

* add stat and check, if boot folder exists

Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

Co-authored-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>
Co-authored-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
2022-07-07 09:02:25 +02:00
Sebastian Gumprich
3f50b6e94b update os-hardening readme with os_ignore_users
fixes #542

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2022-05-30 13:29:45 +02:00
Martin Schurz
46b436fc9b update description of ssh_client_alive_count
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2022-05-04 13:48:38 +02:00
abejotaR
8edd650135
change permissions of the tmout.sh file (#520)
Co-authored-by: Abraham Rebori <abraham.rebori@nexa.com.uy>
2022-02-21 14:01:19 +01:00
rndmh3ro
468e4674b8 debian 9's nginx doesnt support tls1.3
while this could be better solved by checking what nginx version is used, debian9 is eol'd in 4 months. if there will be again a need to check for nginx versions, we'll add it then

Signed-off-by: rndmh3ro <github@gumpri.ch>
2022-02-21 10:02:54 +01:00
Sebastian Gumprich
2ba40b0891
move sysctls to debian specific vars (#524)
* fix ansible-lint issue

https://github.com/ansible-community/ansible-lint/issues/1795
Signed-off-by: rndmh3ro <github@gumpri.ch>

* move 2 sysctls to debian specific

Signed-off-by: rndmh3ro <github@gumpri.ch>

* fix ansible-lint issue

https://github.com/ansible-community/ansible-lint/issues/1795
Signed-off-by: rndmh3ro <github@gumpri.ch>

* add arch linux sysctls

* simplify sysctl settings

Signed-off-by: rndmh3ro <github@gumpri.ch>

* ove overwrite to the bottom to let it acutally overwrite something

Signed-off-by: rndmh3ro <github@gumpri.ch>

* fix typo

Signed-off-by: rndmh3ro <github@gumpri.ch>
2022-02-18 15:30:32 +01:00
lbayerlein
1a97c6cf87
new feautre tmout in a new pr (#516)
Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

Co-authored-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>
2021-12-16 11:39:24 +01:00
Sebastian Gumprich
8f22ce788c
Feature coredump (#513)
* restructure limits-tasks

* disable coredumps in tests

* use notify-task for systemd-reload

Signed-off-by: rndmh3ro <github@gumpri.ch>

* add notify to another task

Signed-off-by: rndmh3ro <github@gumpri.ch>

* rm obsolete task and rename handler

Signed-off-by: rndmh3ro <github@gumpri.ch>
2021-12-10 22:10:14 +01:00
lbayerlein
bb8e3e375e
add feature to disable coredump to limit task (#511)
Signed-off-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>

Co-authored-by: Ludwig Bayerlein <bayerlein@bayerlein-networks.com>
2021-12-08 14:25:49 +01:00
alegrey91
8805d9c14a fix: change hidepid mount task state to mounted 2021-11-29 22:37:21 +01:00
schurzi
ad43f908df
prettify nginx options (#509)
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2021-11-29 10:25:43 +01:00
schurzi
cb3574ed56
Merge pull request #501 from ksaadDE/patch-3
Updated dh_params to 4096
2021-11-28 11:38:39 +01:00
duffn
1d25d4185c
Update nginx_add_header README to match default (#506)
Signed-off-by: Nicholas Duffy <3457341+duffn@users.noreply.github.com>
2021-11-26 11:31:47 +01:00
tekicat
88893a5d4a
Fix duplicate sysctl config (#505)
Signed-off-by: tekicat <tekicat@amibee.com>
Signed-off-by: gk <ganesh.jayachandran@revolut.com>
Signed-off-by: Tekicat <tekicat@amibee.com>
2021-11-26 11:30:50 +01:00