WEB / FTP 서버 관리

2019. 9. 25. 22:11정보보안과정/리눅스 네트워크 관리자

190925
CGI -> 동적페이지를 제공하는 것이 목적

http://www.linuxXXX.example.com -------> /www1/index.html : 코드를 해석해 달라
http://www.linuxXXX.example.com/cgi-bin/test.cgi ----> /www1/cgi-bin/test.cgi : 실행시켜 달라

가상호스트 설정이 되면 원래 되어 있던 설정을 overwrite 한다.
/var/www/html/* ----> /www1/*

가상호스트 -> 서버에서 하나의 프로그램으로 여러개의 서비스를 하는 것

[실습] ServerName, DocumentRoot, Directory 설정
* /var/www/html -> /www1
[실습] CGI 설정(ScriptAlias) - bash 쉘
# vi /etc/httpd/conf/httpd.conf
ScriptAlias /cgi-bin/ /www1/cgi-bin/
# vi /www1/cgi-bin/test.cgi
[실습] CGI 설정 - perl 언어(conf.d/per.conf)
[실습] CGI 설정 - PHP 언어(conf.d0/php.conf)
[실습] WebShell 실습
PHP - One line webshell(/www1/cmd.php)
 <- Get method 방식

# firefox http://www.linux2XX.example.com/cmd.php?cmd=ls
GET Method방식의 cmd 변수안에 들어가는 값이 ls 가 되는 것

[실습] .htaccess 파일을 이용한 웹페이지 보안
# vi /etc/httpd/conf/httpd.conf

AllowOverride AuthConfig

# vi /www1/.htaccess
# htpasswd -mc /etc/httpd/conf/mypasswd testuser

하나의 서버안에서 여러개의 서비스를 하겠다 -> virtual host
하나의 물리적인 머신에 여러개의 서버를 올리겠다. -> virtual host

[실습] 가상호스트(Virtual Hosting) - Name-based Virtual Hosting

(작업시나리오)
http://www1.linux200.example.com ---> /www1/index.html
http://www2.linux200.example.com ---> /www2/index.html
http://www3.linux200.example.com ---> /www3/index.html

[실습] 가상호스트(Virtual Hosting) - IP-based Virtual Hosting

(작업시나리오)
http://172.16.6.100 ---> /www1/index.html
http://172.16.6.150 ---> /www2/index.html
http://172.16.6.50  ---> /www3/index.html

[실습] 서버 정보/상태/통계량
서버 정보(http://www.linux2XX.example.com/server-info)
서버 상태(http://www.linux2XX.example.com/server-status)
통계량(http://localhost/usage) - /etc/httpd/conf.d/webalizer.com
[실습] 아파치 버전/운영체제 버전 정보 숨기기
# vi /etc/httpd/conf/httpd.conf
ServerTokens OS -> ServerTokens Prod

보안 설정
[참고] WAF(Web Application Firewall) <- 얘가 없으면 그냥 공격당함
[참고] 웹서버 취약점 점검
https://www.krcert.or.kr/webprotect/webVulnerability.do
[참고] APM(Apache + PHP + MySQL)
(a) 패키지 형태로 설치
(b) 소스형태로 설치
[참고] HTTPS 사이트 설정
# yum -y install httpd mod_ssl

404 -> not found -> 페이지 없음
501 -> internel server

=========================
Chapter 05. FTP 서버 관리
=========================

vsftpd -> very secure 

FTP Server(vsftpd)
* Program : vsftpd, ftp
* Daemon & Port & Protocol : vsftpd(21/tcp, 20/tcp)
* Config File : /etc/vsftpd/vsftpd.conf
* Sub Config File : /etc/vsftpd/{user_list,ftpusers}
* Startup Script : /etc/init.d/vsftpd

pgrep -lf -> 데몬이 정상적으로 떠있는지 확인

FTP 서버 구축
[실습] FTP 서버(vsftpd) 기동 및 root 사용자 접속
# service vsftpd restart
# chkconfig vsftpd on
# vi /etc/vsftpd/{ftpuser,user_list}
[실습] FTP 서버에 접속할 수 없는 사용자 등록
/etc/vsftpd/{ftpusers,user_list}
[실습] FTP  클라이언트 툴/명령어
* gftp 툴
* ftp CMD

'정보보안과정 > 리눅스 네트워크 관리자' 카테고리의 다른 글

WEB 관리  (0) 2019.09.24
DNS 서버관리 / WEB 관리  (0) 2019.09.24
DNS 서버 관리  (0) 2019.09.20
네트워크 설정 관리  (0) 2019.09.19
서비스 관리  (0) 2019.09.18