전체 글 173

nginx에 SSL 적용

인증서 적용. 어렵지 않다. 1. certbot install sudo apt install python3-certbot-nginx 2. certbot으로 서버에 SSL 인증서 설치 sudo certbot --nginx -d abc.com -d sub.abc.com 설치 도중 옵션에서 2를 누르면 http -> https 리다이렉트 설치가 완료되면 자동으로 /etc/nginx/sites-available에 있는 nginx 설정값들이 업데이트 되고 인증서가 매칭된다. 3. certbot 업데이트 certbot 인증서는 90일마다 업데이트 해야하는데, 사실 /etc/cron.d에 업데이트가 등록되어 있다. 테스트 명령어는 다음과 같다. sudo certbot renew --dry-run 4. 테스트 ssll..

2022.01.03

iptables ICMP 허용

ping을 허용하려면 INPUT, OUTPUT 모두 허용해줘야 한다. iptables -I INPUT -s [SOURCE_IP] -p icmp --icmp-type echo-request -j ACCEPT iptables -I OUTPUT -d [SOURCE_IP] -p icmp --icmp-type echo-reply -j ACCEPT 나갈 때는 출발지와 목적지가 바뀌는 것에 유의한다. 정책 삭제 방법 정책 번호를 확인한다. iptables -L --line-numbers INPUT, OUPUT 확인 후 정책 번호로 삭제하면 된다. iptables -D INPUT 1 정책 백업 방법 iptables restart하면 초기화된다 (...) iptables-save ~/iptables.local

Linux 2021.05.12

Kernel mitigations

- user level exploit의 목적 : system("/bin/sh"); - kernel exploit의 목적 : commit_creds(prepare_kernel_cred(0)); KASLR - 커널 주소 랜덤화 → prepare_kernel_cred 주소 랜덤화 - 유저레벨 익스플로잇과 마찬가지로 오프셋 계산 - /proc/kallsyms에서 함수 주소 확인 할 수 있다. - kernel.kptr_restrict 켜져있으면, 안 된다. (KADR, Kernel Address Display Restriction) - kernel.kptr_restrict 끄고 확인 SMEP (Supervisor Mode Execution Prevent) - 커널이 유저 레벨 코드 실행 불가하게 함 - 커널이 커..