Convert setup_iptables to ansible role + Fix usertwist group don't exist error + Hardened Systemd unit #5

Closed
Mateo wants to merge 10 commits from dev into main
7 changed files with 98 additions and 19 deletions
Showing only changes of commit daa4a1c745 - Show all commits

View File

@@ -15,6 +15,7 @@ ProtectKernelModules=yes
ProtectControlGroups=yes
PrivateDevices=yes
RestrictSUIDSGID=true
Mateo marked this conversation as resolved
Review

What about ProtectHome ?

What about `ProtectHome` ?
ProtectHome=true
[Install]
WantedBy=multi-user.target

View File

@@ -1,31 +1,14 @@
Role Name
Setup IPTables
Mateo marked this conversation as resolved Outdated
Outdated
Review

This looks a bit generic !

This looks a bit generic !
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Create iptables rules on the remote server to allow connection on WEB and SSH ports only
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
- setup_iptables
License
-------
@@ -35,4 +18,5 @@ BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
Motysten
E-Mail : mdm@athelas.fr

View File

@@ -14,4 +14,9 @@
- name: Set INPUT policy to DROP
ansible.builtin.iptables:
chain: INPUT
policy: DROP
policy: DROP
- name: Save rules to keep them on reboot
ansible.builtin.iptables_state:
state: saved
path: /etc/iptables/iptables