Commit graph

180 commits

Author SHA1 Message Date
dev-sec CI
eb972f63f7 update os_hardening readme 2024-05-31 09:42:33 +00:00
Sebastian Gumprich
296f46cc80
centos7 is eol, remove it (#767)
* centos7 is eol, remove it

Signed-off-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>

* change workflow to update readmes when meta/main.yml is changed

Signed-off-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>

* remove mention of centos 7 from readme

Signed-off-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>

---------

Signed-off-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
2024-05-31 11:25:01 +02:00
Sebastian Gumprich
f3a1fcc16a fix spelling
Signed-off-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
2024-05-30 15:01:33 +02:00
schurzi
72eb74a85f Prettified Code! 2024-01-15 13:51:25 +00:00
Sebastian Gumprich
e5cc9bbf43 restructure readme to move known problems up top
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@telekom.de>
2024-01-12 09:30:48 +01:00
Martin Schurz
422fb940a9 manually fix remaining problems
Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
2023-12-06 15:27:21 +01:00
Martin Schurz
54f9ef42a1 don't try to restart audit in check mode
Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
2023-11-22 00:45:38 +01:00
Martin Schurz
25acb76c05 reload systemd after installation
Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
2023-11-21 23:59:22 +01:00
Martin Schurz
0f6b8e4a3a use full service name for handler
Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
2023-11-21 23:04:41 +01:00
Martin Schurz
20dd04c9cb split notify, add tmp options for arch
Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
2023-11-21 21:58:58 +01:00
Martin Schurz
60d10811d4 add separate handlers for audit restart
Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
2023-11-21 21:45:05 +01:00
Aki Kanellis
a15159d072 Make disabling unused filesystems idempotent
The `os_unused_filesystems` was lacking sorting, making the task not
idempotent. This was especially apparent and random in Molecule tests
when this collection was added as a dependency.

Signed-off-by: Aki Kanellis <hello@akikanellis.com>
2023-11-19 19:57:31 +00:00
dev-sec CI
1b69855d51 update os_hardening readme 2023-11-16 14:20:47 +00:00
schurzi
0371a2690b Prettified Code! 2023-11-16 11:35:10 +00:00
Martin Schurz
adda83572a fix mixup, add custom test badge
Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
2023-11-16 12:10:41 +01:00
schurzi
3d98cbf67b
add testing and support for current versions of Fedora and FreeBSD (#709)
* add testing and support for current versions of Fedora and FreeBSD

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* add waivers for FreeBSD

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* use original fedora images

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* also harden /home mount

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* also harden /tmp mount

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* test mock efi directory

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* remove mock

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* umount efi

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* add /tmp to special mountpoints

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* set options for /tmp mount

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* create /tmp mount

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* create /tmp mount and mount it ...

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* make fewer changes to default test run

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* use correct Ansible var

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

---------

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
2023-11-16 09:14:03 +01:00
schurzi
da017fa880
Gather facts when os_hardening role is executed with tags (#708)
* Gather facts when os_hardening role is executed with tags

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

* better when condition

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>

---------

Signed-off-by: Martin Schurz <Martin.Schurz@telekom.de>
2023-11-01 15:54:52 +01:00
dev-sec CI
ac7ef8aae6 update os_hardening readme 2023-10-26 08:43:45 +00:00
rndmh3ro
a08a057f7b Prettified Code! 2023-10-23 10:24:09 +00:00
Sebastian Gumprich
787ac9bd54
fix some wrong defaults and types in the readmes (#703)
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@telekom.de>
2023-10-23 12:23:49 +02:00
Nejc Habjan
35d87aa678
Fix typo in login.defs.j2
Signed-off-by: Nejc Habjan <nejc.habjan@siemens.com>
2023-10-08 14:15:16 +02:00
rndmh3ro
965c9326d0 Prettified Code! 2023-08-24 13:22:18 +00:00
Sebastian Gumprich
9c5b619149
fix descrptions in readme (#693)
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@telekom.de>
2023-08-24 15:21:57 +02:00
Thibault Soubiran
f602bc621a
feat: customize user paths default. Resolves: #689 (#692)
Signed-off-by: Thibault Soubiran <thibault.soubiran@protonmail.com>
2023-08-24 14:02:23 +02:00
rndmh3ro
c1a0bcbe9d Prettified Code! 2023-08-07 12:31:26 +00:00
Sebastian Gumprich
f295397611
add role argument spec for os, ssh, mysql (#687)
* add role argument spec for os, ssh, mysql

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

* add role argument spec for os, ssh, mysql

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

* remove variable in variable as it cannot be used in argument spec

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

* fix wrong syntax

* fix spelling errors

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

* cannot use vars before arg-spec validation

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

* yamllint the arg-spec

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

* add back variable

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

* remove redundant setting in tests

* fix descriptions in mysql hardening to betterreflect what they do

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

* remove duplicate empty line

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

* set correct defaults on to ssl options

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

* remove left-over hidepid argument spec

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

* remove license and author infos, this lives in the collection readme

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

* fix styling

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

* update some descriptions and sort them in the readme

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

* some more linting

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

---------

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
Co-authored-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2023-08-07 14:30:59 +02:00
Dennis Lerch
6bcdb253ec
auditd: add possibility to override config template (#685)
* make template overrideable

by referencing the auditd.conf.j2 template, a custom template can be provided to the role.

Signed-off-by: Dennis Lerch <dennis.lerch@mercedes-benz.com>

* extend auditd config

make freq and log_file configurable
implement write_logs with it's default value in order to be able to disable log writing

Signed-off-by: Dennis Lerch <dennis.lerch@mercedes-benz.com>

* Extend README.md documentation by new variables

reorder `os_auditd_log_format` to keep sequence from defaults

Signed-off-by: Dennis Lerch <dennis.lerch@mercedes-benz.com>

---------

Signed-off-by: Dennis Lerch <dennis.lerch@mercedes-benz.com>
2023-07-24 11:34:47 +02:00
Sebastian Gumprich
7e6a715692
setting gets ignored (#680)
see: https://github.com/authselect/authselect/issues/223

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2023-05-26 14:10:49 +02:00
junicast
f3337f33b3
Add oddjob mkhomedir option rhel pam (#675)
* added support for oddjob mkhomedir via optional var

* optimized conditional

* added variable description

Signed-off-by: Jochen Demmer <jochen.demmer@noris.de>

* added support for oddjob mkhomedir via optional var

Signed-off-by: Jochen Demmer <jochen.demmer@noris.de>

* optimized conditional

Signed-off-by: Jochen Demmer <jochen.demmer@noris.de>

* added variable description

Signed-off-by: Jochen Demmer <jochen.demmer@noris.de>

---------

Signed-off-by: Jochen Demmer <jochen.demmer@noris.de>
Co-authored-by: Jochen Demmer <jochen.demmer@noris.de>
2023-05-23 11:19:40 +02:00
schurzi
1cce7bca9a
Merge pull request #662 from dev-sec/codespell
add spellchecking with codespell
2023-04-17 09:47:53 +02:00
Martin Schurz
7259d6b5fd fix spelling errors
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2023-04-14 23:51:53 +02:00
Martin Schurz
eb47f4dce0 Merge branch 'master' into min_ansible_ver 2023-04-12 22:22:36 +02:00
Martin Schurz
0014a3be36 update metadata
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2023-04-12 20:18:29 +02:00
Martin Schurz
bc9795c215 add noqa for linter
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2023-04-11 07:37:07 +02:00
Martin Schurz
ea922f6dca fix lint error
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2023-04-10 23:49:52 +02:00
Martin Schurz
001900ac35 require ansible.builtin.user to be at least 2.11 since options are needed
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2023-04-10 23:42:27 +02:00
schurzi
5ed3f399f2
add check mode to molecule tests (#644)
* add check mode to molecule tests

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

* bail on undefined variables

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

* bail on undefined variables

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

* execute tasks in check mode

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

* fix error in check mode on SuSE

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

* use when condition on task

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

---------

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2023-03-09 09:37:59 +01:00
George Bolo
3d0b6670d1
fixes #646 - add another condition to getent task (#647)
Signed-off-by: gbolo <george.bolo@gmail.com>
2023-03-06 12:07:40 +01:00
Nejc Habjan
9e4ea20c67
Only skip audit restart handler in docker (#637)
Signed-off-by: Nejc Habjan <nejc.habjan@siemens.com>
2023-02-15 17:58:52 +01:00
Nejc Habjan
1fc2809307
Make action_mail_acct configurable in auditd (#631)
Signed-off-by: Nejc Habjan <nejc.habjan@siemens.com>
2023-02-06 13:24:43 +01:00
schurzi
1ef9171393
remove unneccessary tasks for VM based test (#629)
* add remaining platforms to test

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

* remove unneccessary tasks for test

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

* use current opensuse version

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

* disable sysctl for missing yama in opensuse

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

---------

Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2023-02-06 08:37:40 +01:00
Norman Ziegner
2f60b44cca
os_hardening: Add variable to set the number of days of warning before user password expires
Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
2023-02-01 16:17:36 +01:00
rndmh3ro
bc096e58e5 Prettified Code! 2023-01-28 20:59:35 +00:00
DonEstefan
16e00b02db
rewrite user home dir hardening (#584)
* rewrite user home dir hardening

* delete duplicate var that was missed in a merge conflict

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

* linting

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

* add tests for home rewrites

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

* Apply suggestions from code review

Co-authored-by: schurzi <github@drachen-server.de>

---------

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
Co-authored-by: donestefan <donestefan@users.noreply.github.com>
Co-authored-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
Co-authored-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
Co-authored-by: schurzi <github@drachen-server.de>
2023-01-28 21:59:19 +01:00
Sebastian Gumprich
a75b339526 fix more linting errors
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2023-01-27 11:27:35 +01:00
Sebastian Gumprich
89138be4ec
Rewrite system account detection and hardening and create tests (#621)
* rewrite system account detection and hardening

* resolve failures created when resolving merge conflicts

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

* add tests for shell removal tasks

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

* Update molecule/os_hardening/prepare.yml

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

* split tasks for locking and setting shell

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

* fix some more linting

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

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
Co-authored-by: donestefan <donestefan@users.noreply.github.com>
Co-authored-by: schurzi <Martin.Schurz@t-systems.com>
2023-01-27 11:01:03 +01:00
schurzi
ee80418496
Merge pull request #618 from dev-sec/deprecate_intitramfs
deprecate rebuilding of initramfs
2023-01-25 23:56:36 +01:00
Martin Schurz
7f8e9919ee add readme
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
2023-01-25 22:30:17 +01:00
Sebastian Gumprich
a1028c7504 deprecate initramfs
Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2023-01-25 13:07:37 +01:00
Sebastian Gumprich
bb588bd777
linting (#603)
* linting

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

* more linting

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

* change line length issues

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

* replace yes with true in tasks

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

* use manual line-wrapping because ansible-lint does not support it correctly.

see https://github.com/ansible/ansible-lint/issues/2522

* use manual line-wrapping because ansible-lint does not support it correctly.

see https://github.com/ansible/ansible-lint/issues/2522

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

* use manual line-wrapping because ansible-lint does not support it correctly.

see https://github.com/ansible/ansible-lint/issues/2522

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

* add exception for task

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

* remove trailing whitespace

* add back deleted params

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

* add back deleted params

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

* add back tasks

Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com>
2023-01-24 12:40:27 +01:00