diff --git a/README.md b/README.md index f1aee98..ab66176 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Individual modifications can be dropped by setting `state` to `absent`. ```yaml selinux_ports: - - { ports: '22100', proto: 'tcp', setype: 'ssh_port_t', state: 'present' } + - { ports: '22100', proto: 'tcp', setype: 'ssh_port_t', state: 'present', local: true } ``` #### run restorecon on filesystem trees diff --git a/tasks/main.yml b/tasks/main.yml index 020a6e3..60cbe1a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -93,6 +93,7 @@ proto: "{{ item.proto | default('tcp') }}" setype: "{{ item.setype }}" state: "{{ item.state | default('present') }}" + local: "{{ item.local | default(False) }}" with_items: "{{ selinux_ports }}" - name: Set linux user to SELinux user mapping diff --git a/tests/tests_port.yml b/tests/tests_port.yml index 81f8bf7..d83296d 100644 --- a/tests/tests_port.yml +++ b/tests/tests_port.yml @@ -31,6 +31,8 @@ selinux_ports: - { ports: '22022', proto: 'tcp', setype: 'ssh_port_t', state: 'present' } + - { ports: '22023', proto: 'tcp', setype: 'ssh_port_t', + state: 'present', local: true } - name: include test variables import_tasks: set_selinux_variables.yml @@ -51,6 +53,12 @@ selinux_ports: - { ports: '22022', proto: 'tcp', setype: 'ssh_port_t', state: 'absent' } + - { ports: '22', proto: 'tcp', setype: 'ssh_port_t', + state: 'absent', local: true } + - { ports: '22023', proto: 'tcp', setype: 'ssh_port_t', + state: 'absent', local: true } + - { ports: '22023', proto: 'tcp', setype: 'ssh_port_t', + state: 'absent', local: true } - name: include test variables import_tasks: set_selinux_variables.yml