특정 UID에 대한 발신 연결 차단 (루트, 아파치, 아무도) DROP -A OUTPUT -m owner –uid-owner

CentOS 5 및 6 Linux의 iptables를 사용하면 루트 , 아파치 또는 아무도 실행하지 않는 프로세스가 나가는 연결을 시작 하지 못하게하려면 어떻게해야 합니까?

CentOS 5 Linux에서는 다음 행을 / etc / sysconfig / iptables에 넣었습니다.

-A OUTPUT -m owner --uid-owner root -j DROP
-A OUTPUT -m owner --uid-owner apache -j DROP
-A OUTPUT -m owner --uid-owner nobody -j DROP

그러나 불행히도 오류가 발생합니다.

# sudo service iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules: iptables-restore v1.4.7: owner: Bad value for "--uid-owner" option: "apache"
Error occurred at line: 27
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
                                                           [FAILED]



답변

이름 대신 숫자 UID를 사용해보십시오. 예를 들면 다음과 같습니다.

-A OUTPUT -m owner --uid-owner 400 -j DROP

대신에

-A OUTPUT -m owner --uid-owner apache -j DROP

다음을 입력하여 UID를 찾을 수 있습니다

id user


답변