
저는 CentOS Linux 릴리스 7.5.1804(Core)를 실행 중이고 일반적인 SELinux 설정을 Permissive 작업으로 설정했습니다. 그러나 내 두 소스는 구성을 설정해야 하는 두 가지 다른 위치를 제공했습니다.
- /etc/sysconfig/selinux
고양이 /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
- /etc/selinux/config
고양이 /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# permissive - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of permissive.
# disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
관련 RedHat 포럼을 읽었지만 특별히 / 또는 중 하나에 매달리는 사람은 없는 것 같습니다. 또한 읽어보세요Selinux - centos - /etc/selinux/config 누락, 두 솔루션 모두 답변을 제공합니다.
현재 버전에는 어떤 것을 사용해야 합니까?
최신 버전에서는 어느 것을 사용해야 합니까?
업데이트: 내 시스템에서는 심볼릭 링크되지 않았습니다. 지방에서는 두 개의 다소 다른 파일입니다.
ls -la /etc/selinux/ | grep config
-rw-r--r--. 1 root root 550 Jan 14 15:55 config
ls -la /etc/sysconfig/ | grep selinux
-rw-r--r--. 1 root root 543 Jan 10 14:12 selinux
답변1
CentOS 7 시스템에서 손을 봐야 하는데 CentOS 6과 Fedora 31은 동일합니다.
lrwxrwxrwx. 1 root root 17 Oct 31 2018 selinux -> ../selinux/config
같은 파일인 것 같습니다. 근육 기억 때문에 개인적으로 /etc/selinx/config를 사용하십시오.
하지만 내 시스템에서는 파일이 다르고 크기도 다르며 변경 시간도 다릅니다.
그런 다음 시스템이 '깨졌다'고 생각하십시오. 이는 테스트하기 쉽고, 하나에서는 허용하도록 설정하고 다른 하나에서는 시행합니다. 재부팅 ...
답변2
기본 selinux 구성 파일은 /etc/selinux/config
per man 8 selinux
. 부록 D에는RHEL 6 배포 가이드(RHEL 7 문서에서는 찾을 수 없음) 다음 /etc/sysconfig
에 대한 기호 링크라고 언급되어 있습니다 /etc/selinux/config
.
/etc/sysconfig/selinux 파일에는 SELinux에 대한 기본 구성 옵션이 포함되어 있습니다. /etc/selinux/config에 대한 심볼릭 링크입니다.
출력 을 보면 ls -la
첫 번째 필드가 l
링크의 경우이고 에 다음이 ugo
있으므로 출력이 심볼릭 링크라는 것을 알 수 있습니다 rwx
.
[root@test sysconfig]# ls -lah selinux
lrwxrwxrwx. 1 root root 19 Nov 24 00:58 selinux -> /etc/selinux/config
이것이 심볼릭 링크라는 것을 알기 전에 sed
기본적으로 sed
심볼릭 링크를 따르지 않기 때문에 실수로 파일을 덮어썼습니다.
[root@test sysconfig]# ls -lah selinux
lrwxrwxrwx. 1 root root 17 Jul 24 23:16 selinux -> ../selinux/config
[root@test sysconfig]# grep '^SELINUX=' selinux
SELINUX=enforcing
[root@test sysconfig]# sed -i 's/SELINUX=enforcing/SELINUX=permissive/' selinux
[root@test sysconfig]# ls -lah selinux
-rw-r--r--. 1 root root 544 Nov 24 00:50 selinux
이러한 상황이 발생하면 심볼릭 링크를 복원하는 것이 쉬운 해결 방법입니다.
[root@test sysconfig]# rm /etc/sysconfig/selinux
rm: remove regular file ‘/etc/sysconfig/selinux’? y
[root@test sysconfig]# ln -s /etc/selinux/config selinux
[root@test sysconfig]# ls -lah selinux
lrwxrwxrwx. 1 root root 19 Nov 24 00:52 selinux -> /etc/selinux/config
저는 개인적으로 를 수정하고 있습니다 /etc/selinux/config
. 하나는 심볼릭 링크에서 또 다른 실수를 하지 않도록 하기 위함이고, 두 개는 해당 디렉토리의 일부 구성 파일이 최신 릴리스에서 더 이상 사용되지 않기 때문입니다. 예를 들어,nfs
RHEL 8에서.