User Tools

Site Tools


модуль_selinux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
модуль_selinux [2020/07/16 13:55]
val [Конфигурация]
модуль_selinux [2024/04/26 14:33]
val
Line 6: Line 6:
   * [[https://​max-ko.ru/​14-upravlenie-selinux.html|Управление SELinux]]   * [[https://​max-ko.ru/​14-upravlenie-selinux.html|Управление SELinux]]
  
-  ​* [[http://​itstickers.besthw.net/​selinux-%D0%B1%D0%BB%D0%BE%D0%BA%D0%B8%D1%80%D1%83%D0%B5%D1%82-zabbix-%D0%B0%D0%B3%D0%B5%D0%BD%D1%82/​|SELinux блокирует Zabbix-агент]] +  * [[https://habr.com/ru/companies/otus/articles/460387/|Руководство для начинающих ​по SELinux]]
- +
-  ​* [[https://docs.fedoraproject.org/ru-RU/Fedora/13/html/Security-Enhanced_Linux/index.html|Security-Enhanced Linux. Linux с улучшенной безопасностью]]+
   * [[https://​www.opennet.ru/​base/​sec/​selinux_setup.txt.html|Настройка и использование SELinux (selinux limit security linux mac acl)]]   * [[https://​www.opennet.ru/​base/​sec/​selinux_setup.txt.html|Настройка и использование SELinux (selinux limit security linux mac acl)]]
   * [[https://​www.ibm.com/​developerworks/​ru/​library/​l-se_linux_01/​index.html|Часть 1. SELinux - история появления,​ архитектура и принципы работы]]   * [[https://​www.ibm.com/​developerworks/​ru/​library/​l-se_linux_01/​index.html|Часть 1. SELinux - история появления,​ архитектура и принципы работы]]
-  * [[https://​wiki.centos.org/​TipsAndTricks/​SelinuxBooleans|SELinux Booleans]]+
   * [[https://​www.server-world.info/​en/​note?​os=CentOS_7&​p=selinux&​f=11|SELinux : Use sesearch]]   * [[https://​www.server-world.info/​en/​note?​os=CentOS_7&​p=selinux&​f=11|SELinux : Use sesearch]]
-  * [[http://​hansenroy.com/​selinux-run-a-command-or-script-in-a-specific-context/​|SELinux:​ Run a command or script in a specific context]]+
  
  
 <​code>​ <​code>​
-# sestatus+# sestatus ​-v
  
 # id -Z # id -Z
Line 49: Line 47:
 ===== Добавление сетевых портов к типу (домену) контекста безопасности ===== ===== Добавление сетевых портов к типу (домену) контекста безопасности =====
  
-  * [[Сервис Firewall#​CentOS]] firewalld+  * [[Сервис Firewall#​CentOS]] firewalld ​(для демонстрации темы можно отключить) 
 + 
 +  * [[https://​access.redhat.com/​documentation/​ru-ru/​red_hat_enterprise_linux/​5/​html/​deployment_guide/​rhlcommon-section-0085|50.2.11. Running a Command in a Specific Security Context]] 
 +  * [[https://​blog.tinned-software.net/​change-ssh-port-in-centos-with-selinux/​|Change SSH port in CentOS with SELinux]]
  
 <​code>​ <​code>​
Line 56: Line 57:
 # ss -tupanZ | grep ssh # ss -tupanZ | grep ssh
  
-yum install setools-console +runcon ​-t sshd_t -r system_r -u system_u /​usr/​sbin/​sshd -p 2222 -d 
-sesearch ​--allow ​| grep sshd_t | grep port+ 
 +semanage port -| grep ssh
  
 # semanage port -a -t ssh_port_t -p tcp 2222 # semanage port -a -t ssh_port_t -p tcp 2222
-# yum install policycoreutils-devel +
-# sepolicy network -a /​usr/​sbin/​sshd+
 # semanage port -d -t ssh_port_t -p tcp 22 # semanage port -d -t ssh_port_t -p tcp 22
 </​code>​ </​code>​
  
-  * [[Сервис XINETD]] +===== Управление разрешениями с использованием boolean ===== 
-  * [[Средства программирования shell#Web сервер на shell]]+ 
 +  * [[https://​wiki.centos.org/​TipsAndTricks/​SelinuxBooleans|SELinux Booleans]] 
 +  * [[https://​serverfault.com/​questions/​666045/​zabbix-server-selinux-policy|Zabbix server SELinux policy]]
  
 <​code>​ <​code>​
-# runcon -t inetd_child_t -r system_r -u system_u cat /​etc/​passwd +# semanage boolean -l | grep zabbix
-# runcon -t httpd_t -r system_r -u system_u cat /​etc/​passwd +
-</​code><​code>​ +
-# semanage boolean -l+
 ... ...
-httpd_can_connect_ldap+ 
 +или 
 + 
 +# getsebool -a | grep zabbix
 ... ...
 +
 +# setsebool -P httpd_can_connect_zabbix on
 </​code>​ </​code>​
 +
 +===== Аудит SELinux Policy утилитой sesearch =====
 +
 +  * [[https://​www.lisenet.com/​2019/​auditing-the-selinux-policy-with-sesearch/​|Auditing the SELinux Policy with sesearch]]
 +
 +<​code>​
 +# yum install -y setools-console
 +
 +# sesearch --allow | tee se_allow.txt
 +...
 +allow sshd_t ssh_port_t:​tcp_socket name_bind;
 +...
 +allow httpd_t zabbix_port_t:​tcp_socket name_connect;​ [ httpd_can_connect_zabbix ]:True
 +...
 +</​code>​
 +
 ===== Разработка модулей ===== ===== Разработка модулей =====
  
модуль_selinux.txt · Last modified: 2024/08/23 09:32 by val