본문 바로가기

네임서버

named 실행 시 initgroups(): Operation not permitted 오류 발생 시 조치 방법

반응형

named 실행 시 initgroups(): Operation not permitted 오류 발생 시 조치 방법

1. 문제 현상

named 서비스 재시작 시 다음과 같은 오류가 발생하며 서비스가 정상적으로 시작되지 않는다.

[root@dns3 slaves]# service named restart
named를 정지 중: [ OK ]
named를 시작 중: named: initgroups(): Operation not permitted [실패]

또한 /var/log/messages 로그를 확인하면 다음과 같은 SELinux 관련 메시지가 기록된다.

[root@dns3 slaves]# vim /var/log/messages
Mar 26 21:50:03 dns3 kernel: type=1400 audit(1301143803.811:5): avc: denied { getcap } for pid=1776 comm="named" scontext=root:system_r:named_t:s0 tcontext=root:system_r:named_t:s0 tclass=process

2. 원인

위 로그의 avc: denied 메시지는 SELinux 정책에 의해 named 프로세스의 권한이 제한되어 발생하는 문제이다.

SELinux가 enforcing 모드로 동작 중일 때 named 프로세스가 필요한 권한(getcap, initgroups)을 얻지 못하면 서비스 시작이 실패할 수 있다.

3. SELinux 상태 확인

현재 SELinux 동작 상태는 다음 명령으로 확인할 수 있다.

getenforce
Enforcing

또는

sestatus
728x90

4. 해결 방법

SELinux 비활성화 설정

  • SELinux 설정 파일을 수정하여 disabled로 변경한다.
vim /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   - SELinux is fully disabled.

SELINUX=disabled

# SELINUXTYPE= type of policy in use.
# targeted - Only targeted network daemons are protected.
# strict   - Full SELinux protection.

SELINUXTYPE=targeted

시스템 재부팅

  • 설정 변경 후에는 반드시 시스템을 재부팅해야 적용된다.
reboot

서비스 재시작 확인

  • 재부팅 후 named 서비스를 다시 시작한다.
service named restart
named를 정지 중: [ OK ]
named를 시작 중: [ OK ]

5. 참고 사항 (권장 방법)

운영 환경에서는 SELinux를 완전히 비활성화하는 것보다 정책을 수정하여 사용하는 것이 권장된다.

 

예를 들어 다음 방법을 고려할 수 있다.

  • SELinux를 permissive 모드로 변경
  • audit2allow를 이용하여 정책 생성
  • BIND 관련 SELinux 정책 패키지 설치
setenforce 0   # 임시 permissive 모드

 

[root@dns3 슬레이브]# vim /var/log/messages Mar 26 21:50:03 dns3 커널: 유형=1400 감사(1301143803.811:5): avc: 거부됨 { getcap } for pid=1776 comm="named" scontext=root:system_r:named_t:s0 tcontext=root:system_r:named_t:s0 tclass=process
 
728x90
반응형