Created
February 13, 2017 18:53
-
-
Save michailw/a30442c9a8f18575fc5ef95b6758cd88 to your computer and use it in GitHub Desktop.
SELinux Nginx socket write Ansible
This file contains hidden or 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
module nginx_socket_write 1.0; | |
require { | |
type httpd_t; | |
type var_t; | |
type http_cache_port_t; | |
class sock_file write; | |
class tcp_socket name_connect; | |
} | |
#============= httpd_t ============== | |
#!!!! This avc is allowed in the current policy | |
allow httpd_t http_cache_port_t:tcp_socket name_connect; | |
#!!!! This avc is allowed in the current policy | |
allow httpd_t var_t:sock_file write; |
This file contains hidden or 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
--- | |
- name: "SELinux - allow nginx write to socket - check if module was loaded" | |
shell: "semodule --list-modules | grep nginx_socket_write" | |
register: nginx_socket_write_loaded | |
ignore_errors: true | |
- name: "SELinux - allow nginx write to socket - copy type enforcement file" | |
template: | |
src: nginx_socket_write.te | |
dest: /root/nginx_socket_write.te | |
mode: 0644 | |
when: nginx_socket_write_loaded|failed | |
- name: "SELinux - allow nginx write to socket - checkmodule" | |
command: "checkmodule -M -m -o nginx_socket_write.mod nginx_socket_write.te" | |
args: | |
chdir: /root | |
creates: nginx_socket_write.mod | |
when: nginx_socket_write_loaded|failed | |
- name: "SELinux - allow nginx write to socket - semodule_package" | |
command: "semodule_package -o nginx_socket_write.pp -m nginx_socket_write.mod" | |
args: | |
chdir: /root | |
creates: nginx_socket_write.pp | |
when: nginx_socket_write_loaded|failed | |
- name: "SELinux - allow nginx write to socket - semodule install" | |
command: "semodule -i nginx_socket_write.pp" | |
when: nginx_socket_write_loaded|failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment