Troubleshooting Case #2. Blobfuse for Apache occurs 403 Forbidden

hyukjun·2022년 12월 11일
0

Troubleshooting Cases

목록 보기
2/2
post-thumbnail

환경

  • Linux (CentOS 7.9)
  • Blobfuse v1
  • Apache Web Service

증상

Blobfuse의 마운트포인트를Apache의 DocumentRoot로 사용할 경우 403 forbidden 발생

  • Apache Error Log → /var/www/httpd/error.log

원인

SELinux로 인한 conext 불일치

Blobfuse로 마운트하는 순간 해당 디렉토리의 SELinux Context는 fusefs_t로 변경됨, 이로 인해 Apache의 SELinux context인 httpd_sys_content_t 와 맞지 않으므로 403 forbidden 발생

SELinux가 활성화 되어 있으면 디렉토리 or 파일의 SELinux Context를 검사하여 프로세스의 권한을 필터링 합니다.

해결

SELinux 종료 하여 SELinux Context 필터링 해제

  • SELinux를 disabled하거나 permissive모드로 변경
    # 1. permissive 
    setenforce 0
    
    # 2. disabled
    vi /etc/selinux/config
    ...
    SELINUX=disabled
    ...

Caution
Blobfuse는 Azure Storage 서비스로서 아직까지 OS Filesystem의 ACL관련 Operation을 허용 하지 않습니다. 따라서, chconrestorecon과 같은 명령 수행이 불가 합니다.
chcon -R -t httpd_sys_content_t /var/www/test

Test

  1. SELINUX=Enforcing

    fusefs_t 컨텍스트 확인 및 restorcecon 동작 불가

    ls -lZ /var/www/test

    enforcing 상태에서 forbidden error 확인

  1. SELINUX=diabled

    컨텍스트 없어진 모습 및 웹페이지 정상 조회

  1. SELINUX=permissive

    컨텍스트는 조회 되지만 웹페이지도 정상 조회

Ref.

profile
slow and steady

0개의 댓글