1. 키(pub)사용하여 SSH접속
[+] windows
- windows의 경우 putty사용하여 키생성
- puttygen 실행
-no key라고 되어있으나, Generate로 키 생성
- 공개키를 복사해서 따로 저장해 준다.
- 복사한 키를 Linux(fedora)에 등록해준다.
- putty를 실행하여 [SSH]에 공개키 등록
- centos에 공개키 등록
- 인증파일 생성
- ssh 수정
- passwordAuthentication no --> yes
- windows에서 접속
- ubuntu에서 키생성하고 fedora에 등록해서 접속
> ssh-key gen -t rsa 로 생성 후 ubuntu에서도 접속되는 것을 확인할 수 있다.
[+] 해쉬 알고리즘
- 사용자 패스워드에서 Linux 디폴트 해시 알고리즘인 SHA512와 MD5의 해시 길이는 다르다.
> 패스워드의 길이 를 확인해보면
위의 내용은 tester1(user_name):$6$(hash_algorithm), $eKBZx/NPgmr/8xv$(salt), $wOHqCx08VWjbLCHCusEtSSDCcPNfDPRhOc11BPlynb2i5OL6tTDCbp4/Nt.PLmvCMk/EFhv5YfYizGiGgY/9J.(hashed_password)
[+]John the ripper 설치 및 실습
yum -y install gcc-c++
wget http://distro.ibiblio.org/openwall/projects/john/1.8.0/john-1.8.0.tar.gz --no-check-certificate
[+] Linux PW 강화
- 사이트 소개
http://www.passwordmeter.com에서 패스워드의 세기를 알 수 있다.
https://www.virustotal.com에서 악성코드의 세기를 알 수 있다.
https://www.tinyurl.com OR https://bitly.com 사이트에서 퓌싱 사이트 등의 악성
사이트 주소를 변경해서 사용할 수 있다.
http://www.puu.kr OR https://www.mailinator.com 사이트는 사전 계정 등록 없이
사용할 수 있는 Disposable Mail Box이다.
- nano /etc/httpd/conf.d/auth_basic.conf 파일생성
<Directory /var/www/html/auth-basic>
AuthType Basic
AuthName "Basic Authentication"
AuthUserFile /etc/httpd/conf/.htpasswd
require valid-user
</Directory>
- 웹에 접속할 유저 생성 (권한)
> htpasswd -c /etc/httpd/conf/.htpasswd cenetos
> htpasswd /etc/httpd/conf/.htpasswd ubuntu
- 보안 설정
> setenforce 0
> firewall-config
>80추가
-방화벽 firewall-cmd --reload
- service httpd restart
- netstat -nltp | grep LISTEN
mkdir /var/www/html/auth-basic
nano /var/www/html/auth-basic/index.html 내용
<html>
<body>
<div style="width:100%; font-size:40px; font-weight:bold; text-align:center;">
This is Secured Page</div>
</body>
</html>
웹에서 localhots/auth-basic 접속하면 로그인페이지와 로그인되는 것을 확인
- netx.html 파일 내용
<html>
<h1>This is Main Web Page</h1>
<a href="protected/protect.html"> protected </a>
</html>
- mkdir protected 생성
nano protect/protect.html
getenforce
- httpd.conf
<Directory "/var/www/html/protected">
Allowoverride AuthConfig
</Directory>
AuthUserFile "/var/www/.htpasswd"
AuthGroupFile /dev/null
AuthName "protected site"
AuthType Basic required valid-user