DAY10
DAY10

서버 구축

server
nano /etc/hostname (mail > master)

utm
dhcp
10.0.2.15

win
제어판 > 네트워크 및 인터넷> 네트워크연결 > ipv4 속성 > 자동ip받기
cmd > ipconfig > 192.168.0.3 확인

kali
ssh master@10.0.2.15

server
sudo apt -y install xinetd telnetd
sudo apt -y install elinks
sudo apt -y install postfix (smtp) (설치불요)
sudo apt -y install sendmail (smtp)
sudo apt -y install vsftpd
wget https://ko.wordpress.org/wordpress-6.6.1-ko_KR.tar.gz
sudo apt -y install nfs-common nfs-kernel-server rpcbind
(미설치)sudo apt -y install samba-common smbclient cifs-utils
sudo apt -y install isc-dhcp-server
sudo apt -y install squid
sudo apt -y install isc-dhcp-server tftpd-hpa inetutils-inetd vsftpd pxelinux
sudo apt -y install xrdp (GUI 환경일 경우에만, 서버용은 설치 불필요)

Bootstrap Example

nslookup 연결 오류 해결방법

intra.st.kr or mail2.st.kr 연결 오류시 확인하자
cd /etc
    resolv.conf
       ip 변경
cd /etc/bind
    st.kr.zone
       intra 추가

경로설정
외부에서 확인 가능 : st.kr > /var/www/html > root (외부용)
내부에서만 확인 가능 : intra.st.kr > /home/st/public_html
    현재는 st.kr/~st 라고 경로 설정 해줘야 /home/st/public_html로 연결된다.
Bootstrap Example

forbidden 해제

su st
chmod 711 $HOME
chmod 755 ~/public_html

Bootstrap Example

호스팅 설정

dns > 웹 설정 문제 > 설정 필요
su
cd /etc/apache2/sites-available
nano hosting.conf
a2ensite hosting
systemctl reload apache2

/var/www/html
nano index.html
    index.html 페이지에 out 현출 확인!

Bootstrap Example

계정 생성


cd /etc/skel
mkdir public_html
cd public_html
mkdir includes
mkdir auth
mkdir logs
touch index.html
touch index.php
(유추 가능한 디렉토리명, 파일명은 nikto로 탐지될 위험 있으므로 주의)

adduser st

a2enmod userdir
systemctl restart apache2


win7
thunderbird
메일계정설정
    이름 관리자
    주소 master@mail2.st.kr
    imap 143 암호없음 평문
    smtp 25 암호없음 없음
    주소에서 . 제거

    이름 산대특
    주소 st@mail2.st.kr
    imap 143 암호없음 평문
    smtp 25 암호없음 없음
    주소에서 . 제거

Bootstrap Example

thunderbird mail2.st.kr 연결 문제

계정 설정
보내는 서버 (smtp)
기본 서버를 mail2.st.kr로 변경
기본 서버, 기본 계정 확실히 삭제하기


Bootstrap Example

포트미러링

win7에서 intra.st.kr 접속 시
wireshark로 start capture 하면
    ubuntu e0 --- f1/1 esw1은 확인 가능
    esw1 f115 --- e0 ids은 확인 불가능

[ESW1]
config t
monitor session 1 source interface fastethernet 1/0 - 14
monitor session 1 destination interface fastethernet 1/15
end
show monitor session 1

설정 후 ping 10.0.2.15 해보면
    ubuntu e0 --- f1/1 esw1, esw1 f1/15 --- e0 ids 사이의 패킷이 동시에 뜨는 것을 확인 가능하다.



Bootstrap Example

컨텐츠 필터링 정책

형식
content:"패턴규칙" -> 패턴규칙 차단됨

예제
일반 ASCII문자와 hexa값 혼합 사용 가능
content:"abc|0d0a|def";
content:"|616263|";
content:""a|0d0a|b|0d0a|;

특수문자는 hexa값을 사용해야 한다
"    |22|
;    |3b|
:    |3a|
|    |7c|

패턴규칙에 http://를 넣고싶다면?
content:"http|3A|//";

느낌표 기호 사용하기
content:!"패턴규칙";

멀티 패턴
content."http:"1.0"; content:!"200 OK";