본문 바로가기

IT 엔지니어/Linux server

Web Security

사용자별 가상호스팅

vi  /etc/httpd/conf.d/userdir.conf

<Directory "/home/*/public_html">
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>

userdir public_html //// 주석 해제

 

Indexes 삭제

 

 

 

 

아파치 디렉터리 리스팅 서비스 해제

/etc/httpd/conf.d/userdir.conf
1. index 옵션 삭제
2. index.html 파일 생성

 

 

vi /etc/httpd/conf.d/welcome.conf

[테스팅 화면]

<LocationMatch "^/+$">
    Options -Indexes -> 테스팅 화면 /// - 삭제, 전체 삭제시 리스팅 확인
    ErrorDocument 403 /.noindex.html
</LocationMatch>

<Directory /usr/share/httpd/noindex>
    AllowOverride None
    Require all granted -> denied // 거부
</Directory>

주석 처리 시 테스팅 화면 없이 출력

ctrl+ v 방향키 후   Shift + I → # 입력 후 ESC 
ctrl+ v 방향키 후 + X - 동시 삭제
192.168.10.50/~test

useradd test
passwd test

cd /home

chmord 775 test

cd test

mkdir pulic_html

cd public_html

vi index.html

[디렉터리 서비스]

아파치 디폴트 리스팅
보안상 취약점
디렉터리 리스팅

kernel.org
vi /var/www/html/index.html
/home/test/public_html

mv index.html in.html

 

 

 

 

vi /etc/httpd/conf/httpd.conf

158     Options Indexes FollowSymLinks

index.html -> in.html 변경 후
Indexes 옵션 삭제 시 리스팅 서비스 확인 가능
-indexes 시 재시작 불가
삭제만 가능

index.html 변경 필요
Indexes 확인 필요
 34 ServerRoot "/etc/httpd"
홈 디렉터리

6  Listen 12.34.56.78:80
47 Listen 80
두 개의 인터페이스 경우 특정 인터페이스 설정 가능

 71 User apache
 72 Group apache / 미설정 시 root 권한 자동 부여됨

 

 

 

 

 

 

 

 

 

 

 

 

 

cd /etc/httpd/logs

access_log
error_log

Possible values include: debug, info, notice, warn, error, crit, alert, emerg.

261     ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
주석처리로 보안성 강화 가능

319     AddType text/html .shtml
320     AddOutputFilter INCLUDES .shtml
321 </IfModule>
<2.2 변경 전>
order deny,allow
deny from all
allow from all

<2.4 변경 후>
Required all denied

'IT 엔지니어 > Linux server' 카테고리의 다른 글

Web security 취약점  (0) 2025.04.25
SSL/TLS  (0) 2025.04.24
TOMCAT  (0) 2025.04.23
Web Security  (0) 2025.04.23
KAIL linux & UTM  (0) 2025.04.22