-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the selinux role from the cockpit role
- Introduce cockpit_manage_selinux to use the selinux role to manage the ports in the cockpit service. Assign websm_port_t to the cockpit service ports. Default to false - means the selinux role is not used. - Add a test playbook tests_port2.yml to check port 443 when cockpit_manage_firewall and cockpit_manage_selinux are yes.
- Loading branch information
Showing
11 changed files
with
136 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SPDX-License-Identifier: MIT | ||
--- | ||
- name: Ensure the service and the ports status with the selinux role | ||
include_role: | ||
name: fedora.linux_system_roles.selinux | ||
vars: | ||
selinux_ports: "{{ [{'ports': cockpit_port, 'proto': 'tcp', | ||
'setype': 'websm_port_t', | ||
'state': 'present', 'local': 'true'}] }}" | ||
when: | ||
- cockpit_manage_selinux | bool | ||
- ansible_facts['os_family'] == 'RedHat' | ||
- cockpit_port is not none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# SPDX-License-Identifier: MIT | ||
--- | ||
- name: Install SELinux python2 tools | ||
package: | ||
name: | ||
- libselinux-python | ||
- policycoreutils-python | ||
state: present | ||
when: ( ansible_python_version is version('3', '<') and | ||
ansible_distribution in ["Fedora", "CentOS", "RedHat", "Rocky"] ) | ||
|
||
- name: Install SELinux python3 tools | ||
package: | ||
name: | ||
- libselinux-python3 | ||
- policycoreutils-python3 | ||
state: present | ||
when: ( ansible_python_version is version('3', '>=') and | ||
ansible_distribution in ["Fedora", "CentOS", "RedHat", "Rocky"] ) | ||
|
||
- name: Install SELinux tool semanage | ||
package: | ||
name: | ||
- policycoreutils-python-utils | ||
state: present | ||
when: ansible_distribution == "Fedora" or | ||
( ansible_distribution_major_version | int > 7 and | ||
ansible_distribution in ["CentOS", "RedHat", "Rocky"] ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
- name: Test cockpit_* role options | ||
hosts: all | ||
gather_facts: true | ||
tasks: | ||
- name: tests | ||
block: | ||
- name: Run cockpit role | ||
include_role: | ||
name: linux-system-roles.cockpit | ||
public: true | ||
vars: | ||
cockpit_manage_firewall: yes | ||
cockpit_manage_selinux: yes | ||
cockpit_packages: minimal | ||
cockpit_port: 443 | ||
|
||
- meta: flush_handlers | ||
|
||
- name: test - cockpit works on customized port | ||
get_url: | ||
dest: /run/out | ||
url: https://localhost | ||
validate_certs: no | ||
|
||
- name: test - HTTP response is something sensible | ||
command: grep 'id="login-user-input"' /run/out | ||
|
||
- name: test - cockpit does not listen on port 9090 | ||
get_url: | ||
dest: /run/out | ||
url: https://localhost:9090 | ||
validate_certs: no | ||
register: result | ||
failed_when: result is succeeded | ||
|
||
- name: test - ensure cockpit_port is configured for firewall | ||
include_tasks: tasks/check_port.yml | ||
|
||
- name: test - clean up output file | ||
file: | ||
path: /run/out | ||
state: absent | ||
|
||
always: | ||
- include_tasks: tasks/cleanup.yml |