*ping을 서버에서 막는 방법
sudo tcpdump
sudo tcpdump -i enp0s3 icmp
sudo sysctl -a | grep icmp
sudo sysctl -w net.ipv4.icmp_echo_ignore_all=1
또는
iptables -A INPUT -p icmp -j DROP
iptables -L로 확인
sudo iptables -A INPUT -p icmp -j DROP
sudo iptables -F
=> ping은 막았지만(icmp) tcp를 사용하는 nmap은 막을 수 없었음 ㅠㅠ
Bootstrap Example
미션2: 미션2 www를 외부 접속이 가능하도록 설정하라(웹서버 구축하기)
www 네트워크 설정을 NAT로 한 뒤 포트포워딩 설정(사진;portpwding)
xshell
ssh 192.168.0.214
*user st 생성
sudo adduser st (123456/enter)
      info: Adding user `st' ...
      info: Selecting UID/GID from range 1000 to 59999 ...
      info: Adding new group `st' (1001) ...
      info: Adding new user `st' (1001) with group `st (1001)' ...
      info: Creating home directory `/home/st' ...
      info: Copying files from `/etc/skel' ...
cd /home
*user jyb 생성
sudo adduser jyb (123456/enter)
*권한 설정 이해
st.kr > /home/st/public_html ;st
jyb.kr > /home/jyb/public_html ;jyb
navre.com > /home/naver/public_html ;naver
/var/www/html (웹 기본 페이지) ; root
su
sudo passwd root (123456)
su
cd st
mkdir public_html (디렉토리 생성)
ls
***info: Copying files from `/etc/skel' ...
(만들어야할 권한이 많은 경우 `/etc/skel' 경로 내 public_html 만들면 복사가 가능하다.)
cd public_html/
mkdir includes
mkdir logs
mkdir auth
mkdir board
touch index.php
ls
(rmdir ; 삭제)
cd includes/
touch header.php
touch tail.php
touch db.php
에디트플러스
ftp서버 ; 192.168.0.214 (passive ftp check 해제) 연결
(html; 현출 페이지, php; 작동 페이지이므로 php가 더 취약해질 수 있다.
웹이 취약한 이유는 잘 못 만들어진 프로그램의 경우 접속을 할 수 있기 때문이다.
따라서 apt -y install lamp-server^만 설치하면 일반 사용자에서는 php가 정상적으로 작동하지 않는다.)
index.php 저장 오류
해결 => (권한) chown st:st index.php
sudo apt -y install lrzsz (파일업로드 프로그램 설치)
su st
apt -y install php8.3-fpm (php-fpm(fpm: fastCGI process manager) 설치)