SELinux로 인해 발생하는 이상한 audit2why 메시지

SELinux로 인해 발생하는 이상한 audit2why 메시지

내가 달릴 때2가지 이유에 대한 검토SCP를 통해 폴더에 파일을 업로드하려는 시도가 실패하는 이유를 확인하세요./foo/바원격 서버에서는 다음과 같은 결과가 발생합니다./foo/bar 폴더에 대한 액세스가 거부되었습니다., 다음 텍스트가 표시됩니다.

 

Was caused by:
                Unknown - would be allowed by active policy
                Possible mismatch between this policy and the one 
under which the audit message was generated.

                Possible mismatch between current in-memory 
boolean settings vs. permanent ones.

 

나는 그것이 원인임에 틀림없다는 것을 안다.SELinux명령을 실행할 때:

setenforce 0

SCP를 통해 파일을 업로드할 수 있습니다./foo/바. 또한 주목할 만한 점은 SSH를 통해 로그인하면CD폴더로/foo/바SELinux를 활성화하면 이 폴더에 파일을 만들 수 있습니다.

 

SELinux에서 문제의 원인이 무엇인지 확인하기 위해 어떻게 디버깅합니까?

편집하다

ls -lZ이것은의 출력입니다/foo/바

drwxrwx--T. root foo-users user_u:object_r:default_t:s0     bar

그리고 출력은AVC가 거부됨~에서audit2allow

type=AVC msg=audit(1519304988.434:6984): avc:  denied  { write } for  pid=26506 comm="scp" name="event-20180203.log.gz" dev="dm-4" ino=7260 scontext=user_u:user_r:user_t:s0 tcontext=user_u:object_r:default_t:s0 tclass=file
    Was caused by:
        Unknown - would be allowed by active policy
        Possible mismatch between this policy and the one under which the audit message was generated.

답변1

AVC는 이렇게 말합니다.

$ echo "type=AVC msg=audit(1519304988.434:6984): avc:  denied  { write } for  pid=26506 comm="scp" name="event-20180203.log.gz" dev="dm-4" ino=7260 scontext=user_u:user_r:user_t:s0 tcontext=user_u:object_r:default_t:s0 tclass=file" |audit2allow     
#============= user_t ==============
#!!!! WARNING: 'default_t' is a base type.
allow user_t default_t:file write;

==> user_t SElinux 컨텍스트 유형에서 실행 중인 프로세스가 default_t 유형의 디렉토리에 쓰려고 합니다.

이 문제를 해결하는 다른 방법은 다음과 같습니다.

  • user_t가 쓸 수 있도록 대상 디렉터리를 표시합니다.

    $ sesearch -s user_t --allow |grep "file.*write"

    파일 쓰기 작업에 허용된 대상 컨텍스트가 표시됩니다. 예를 들어 foo/bar는 허용 목록에서 ssh_home_t로 표시될 수 있습니다.

    $ sudo chcon -R -t ssh_home_t /foo/bar

  • 또는 가능하다면 대상 디렉터리를 허용된 디렉터리로 변경하세요.

  • 또는 audit2allow를 사용하여 제어를 우회하는 새로운 규칙을 생성할 수 있지만 이는 권한을 개방하고 SELinux의 목표를 무효화하므로 최후의 수단이 되어야 합니다. '바라보다http://selinuxproject.org/page/Audit2allowRecipe)

답변2

Unknown - would be allowed by active policy
Possible mismatch between this policy and the one 
under which the audit message was generated.

수정 정책을 적용한 후에도 동일한 메시지를 받았습니다. 이전에 감사된 모든 avc는 새 정책에서 허용되므로 해석될 수 없습니다.
새로운 이벤트가 계속 발생하는지 확인하세요.

관련 정보