TheKoguryo's 기술 블로그

 Version 2024.04.01

8.3 접근 제어를 위한 Export Option

Export Option 설정을 통한 권한 제어

  1. 앞서 만든 File System의 상세화면으로 이동합니다. 아래쪽에 그림과 같이 Export 리스트에서 생성된 Export를 클릭합니다.

    image-20230508182136935

  2. Export 상세화면 아래쪽에 그림과 같이 NFS Export Options이 보입니다.

    기본 생성된 옵션은 모든 클라이언트(0.0.0.0/0)에서 Read/Write로 접근 가능합니다.

    image-20230508182240723

  3. Edit Options을 클릭합니다.

  4. 기존 옵션 위에 테스트 VM이 있는 Public Subnet(10.0.0.0/24)는 읽기만 되게 옵션을 추가합니다.

    테스트 VM의 IP가 10.0.0.xxx라면 두 옵션의 Source에 모두 해당됩니다. 이런 경우 순서에 따라 먼저 매칭되는 것이 적용되어 실제로 첫번째 조건에 따라 Read Only 접근만 가능합니다.

    image-20230508182537132

  5. 설정완료

    image-20230508182703614

File System에 권한 테스트

  1. 앞서 테스트한 VM에 접속합니다.

  2. 기존 파일이 읽기가 되는 지 확인합니다.

    ls -la /mnt/fss-system
    cat /mnt/fss-system/hello1.txt
    
    • 실행결과

      [opc@examplelinuxinstance ~]$ ls -la /mnt/fss-system
      total 9
      drwxrwxrwx. 2 root root  1 May  8 09:28 .
      drwxr-xr-x. 4 root root 36 May  8 09:10 ..
      -rw-rw-r--. 1 opc  opc  19 May  8 09:10 hello1.txt
      drwxrwxrwx. 2 root root  0 May  8 09:28 .snapshot
      [opc@examplelinuxinstance ~]$ cat /mnt/fss-system/hello1.txt
      Hello File Storage
      
  3. 새 파일 쓰기를 시도합니다.

    echo 'Hello File Storage' >/mnt/fss-system/hello2.txt
    
    • 실행결과

      아래와 같이 Public Subnet(10.0.0.0/24)에 해당되어 쓰기시 에러가 발생합니다.

      [opc@examplelinuxinstance ~]$ cat /mnt/fss-system/hello1.txt
      Hello File Storage
      [opc@examplelinuxinstance ~]$ hostname -I
      10.0.0.208 
      [opc@examplelinuxinstance ~]$ echo 'Hello File Storage' >/mnt/fss-system/hello2.txt
      -bash: /mnt/fss-system/hello2.txt: Read-only file system
      

Export Option 순서 변경후 권한 재 확인

  1. NFS Client Export Options 변경 화면 다시 이동합니다.

  2. 각 항목 오른쪽 액션메뉴의 Move Up, Down 메뉴를 통해 순서를 조정하여 업데이트 합니다.

    image-20230508183054388

  3. 변경 완료

    image-20230508183129596

  4. 테스트 VM으로 돌아가 다시 마운트한 파일 시스템에 쓰기를 시도합니다.

    [opc@examplelinuxinstance ~]$ echo 'Hello File Storage' >/mnt/fss-system/hello2.txt
    [opc@examplelinuxinstance ~]$ ls -la /mnt/fss-system/
    total 17
    drwxrwxrwx. 2 root root  2 May  8 09:31 .
    drwxr-xr-x. 4 root root 36 May  8 09:10 ..
    -rw-rw-r--. 1 opc  opc  19 May  8 09:10 hello1.txt
    -rw-rw-r--. 1 opc  opc  19 May  8 09:31 hello2.txt
    drwxrwxrwx. 2 root root  0 May  8 09:32 .snapshot
    
  5. 우선 매칭되는 0.0.0.0/0 Read/Write 권한에 따라 파일쓰기가 되는 것을 알 수 있습니다.



이 글은 개인으로서, 개인의 시간을 할애하여 작성된 글입니다. 글의 내용에 오류가 있을 수 있으며, 글 속의 의견은 개인적인 의견입니다.

Last updated on 14 Jan 2022