IT

NOVNC Directory Listing 끄기

쏘펀 2024. 3. 15.

 

NOVNC를 VM위에 구축해서 잘 사용하고 있다가 취약점 점검을 진행해봤더니만.....

Directory Listing이 되고 있었다 ㄷㄷㄷ 

 

 

다행히 novnc폴더 상위로는 접근 못하고, 해당 부분은 novnc에서 사용하는 websockify쪽 관련 소스들뿐이라 크게 문제는 없을 것 같긴 하지만 찝찝해서 directory listing을 끄는 방법을 찾아봄

 

expose websockify's --file-only option to disable dir listing by msays2000 · Pull Request #1707 · novnc/noVNC · GitHub

 

expose websockify's --file-only option to disable dir listing by msays2000 · Pull Request #1707 · novnc/noVNC

expose --file-only option to disable dir listing novnc_proxy optionally passes the flag to WEBSOCKIFY to disable dir listing novnc/websockify#536

github.com

찾아 보니까....novnc 실행할 때 옵션으로 추가한 버전도 있던데 내꺼는 그 버전은 아닌지라....그냥 websockifyserver.py쪽 소스에 값을 수정하기로 함.

 

/usr/lib/python3/dist-packages/websockify/websockifyserver.py 이경로에 있는 파일을 아래와 같이 수정하면 됨.

# file_only을 검색해서 값을 True로 수정

self.file_only = getattr(server, "file_only", True)
...
...
...
def __init__(self, RequestHandlerClass, listen_fd=None,
            listen_host='', listen_port=None, source_is_ipv6=False,
            verbose=False, cert='', key='', key_password=None, ssl_only=None,
            verify_client=False, cafile=None,
            daemon=False, record='', web='', web_auth=False,
            file_only=True,
            run_once=False, timeout=0, idle_timeout=0, traffic=False,
            tcp_keepalive=True, tcp_keepcnt=None, tcp_keepidle=None,
            tcp_keepintvl=None, ssl_ciphers=None, ssl_options=0):

 

 

 

내용 수정 후 novnc를 재시작 해주고 나면....이제 이렇게 directory가 보이진 않게 된다

댓글