해킹 시도.. 막을 방법은?

   조회 5202   추천 0    

 리눅스를 백업서버로 쓸려고 세팅했더니 온갖 세계 각국에서 root 패스워드를 시도 하네요.

이거 근본적으로 막을 방법은 없나요?

우선 iptable 로 icmp drop 시켰고 

주요 의심국가인 "중국", "러시아" IP 는 모두 iptable 로 차단했습니다.


-------- 참고 ------ 해킹 시도 예 -------- /var/log/secure 파일

Aug 12 03:42:30 localhost sshd[15742]: Failed password for root from 202.55.175.236 port 33828 ssh2                ID

Aug 12 03:42:30 localhost sshd[15742]: Received disconnect from 202.55.175.236 port 33828:11: Bye Bye [preauth]

Aug 12 03:42:30 localhost sshd[15742]: Disconnected from 202.55.175.236 port 33828 [preauth]

Aug 12 03:42:37 localhost sshd[15763]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=111.229.33.175  user=root

Aug 12 03:42:37 localhost sshd[15763]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"

Aug 12 03:42:39 localhost sshd[15763]: Failed password for root from 111.229.33.175 port 50304 ssh2

Aug 12 03:42:39 localhost sshd[15763]: Received disconnect from 111.229.33.175 port 50304:11: Bye Bye [preauth]         CN

Aug 12 03:42:39 localhost sshd[15763]: Disconnected from 111.229.33.175 port 50304 [preauth]

Aug 12 03:42:57 localhost sshd[15765]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=106.54.52.35  user=root

Aug 12 03:42:57 localhost sshd[15765]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"

Aug 12 03:43:00 localhost sshd[15765]: Failed password for root from 106.54.52.35 port 40674 ssh2                CN

Aug 12 03:43:00 localhost sshd[15765]: Received disconnect from 106.54.52.35 port 40674:11: Bye Bye [preauth]

Aug 12 03:43:00 localhost sshd[15765]: Disconnected from 106.54.52.35 port 40674 [preauth]

Aug 12 03:43:00 localhost sshd[15767]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=151.80.173.36  user=root

Aug 12 03:43:00 localhost sshd[15767]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"

Aug 14 09:16:50 localhost sshd[4369]: Disconnected from 222.99.52.216 port 19521 [preauth]                성남 KT

Aug 14 09:16:53 localhost sshd[4371]: reverse mapping checking getaddrinfo for h206-174-214-90.bigpipeinc.com [206.174.214.90] failed - POSSIBLE BREAK-IN ATTEMPT!

Aug 14 09:16:53 localhost sshd[4371]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=206.174.214.90  user=root

Aug 14 09:16:53 localhost sshd[4371]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"

Aug 14 09:16:55 localhost sshd[4371]: Failed password for root from 206.174.214.90 port 42860 ssh2                CA

Aug 14 09:16:55 localhost sshd[4371]: Received disconnect from 206.174.214.90 port 42860:11: Bye Bye [preauth]

Aug 14 09:16:55 localhost sshd[4371]: Disconnected from 206.174.214.90 port 42860 [preauth]

Aug 14 09:16:56 localhost sshd[4373]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=222.239.28.177  user=root

Aug 14 09:16:56 localhost sshd[4373]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"

Aug 14 09:16:58 localhost sshd[4373]: Failed password for root from 222.239.28.177 port 33462 ssh2                중구 SK브로드밴드

Aug 14 09:16:58 localhost sshd[4373]: Received disconnect from 222.239.28.177 port 33462:11: Bye Bye [preauth]

Aug 14 09:16:58 localhost sshd[4373]: Disconnected from 222.239.28.177 port 33462 [preauth]

Aug 14 09:17:05 localhost sshd[4377]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=51.ip-51-255-160.eu  user=root

Aug 14 09:17:05 localhost sshd[4377]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"

Aug 14 09:17:07 localhost sshd[4375]: Accepted password for root from 192.168.0.13 port 59086 ssh2

Aug 14 09:17:07 localhost sshd[4375]: pam_unix(sshd:session): session opened for user root by (uid=0)

Aug 14 09:17:07 localhost sshd[4377]: Failed password for root from 51.255.160.51 port 42922 ssh2                FR

Aug 14 09:17:08 localhost sshd[4377]: Received disconnect from 51.255.160.51 port 42922:11: Bye Bye [preauth]

Aug 14 09:17:08 localhost sshd[4377]: Disconnected from 51.255.160.51 port 42922 [preauth]

Aug 14 09:17:17 localhost sshd[4437]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=n058153174086.netvigator.com  user=root

Aug 14 09:17:17 localhost sshd[4437]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"

Aug 14 09:17:19 localhost sshd[4437]: Failed password for root from 58.153.174.86 port 49844 ssh2                HK

Aug 14 09:17:19 localhost sshd[4437]: Received disconnect from 58.153.174.86 port 49844:11: Bye Bye [preauth]

Aug 14 09:17:19 localhost sshd[4437]: Disconnected from 58.153.174.86 port 49844 [preauth]




----------------- ip table setting ------

root@localhost:/etc/rc.d# iptables -L

Chain INPUT (policy ACCEPT)

target     prot opt source               destination

ACCEPT     all  --  anywhere             anywhere

DROP       all  --  anywhere             anywhere             state INVALID

ACCEPT     tcp  --  anywhere             anywhere             state RELATED,ESTABLISHED

DROP       tcp  --  58.75.202.88         anywhere             tcp dpt:http state NEW,ESTABLISHED

DROP       tcp  --  116.38.215.160       anywhere             tcp dpt:http state NEW,ESTABLISHED

DROP       tcp  --  203.227.217.158      anywhere             tcp dpt:http state NEW,ESTABLISHED

DROP       all  --  175.127.42.0/24      anywhere

DROP       all  --  175.127.41.0/24      anywhere

DROP       all  --  175.127.40.0/24      anywhere

DROP       all  --  175.127.39.0/24      anywhere

DROP       all  --  203.142.81.0/24      anywhere

ACCEPT     tcp  --  gateway              anywhere             tcp dpt:ftp state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ftp state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ftp state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:netbios-ssn state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:microsoft-ds state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3306 state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:svn state NEW,ESTABLISHED

DROP       tcp  --  anywhere             anywhere             tcp dpt:smtp state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:afs3-fileserver state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:afs3-callback state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:irdmi state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:vcom-tunnel state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:cslistener state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:etlservicemgr state NEW,ESTABLISHED

ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ndmp state NEW,ESTABLISHED

DROP       tcp  --  anywhere             anywhere

DROP       icmp --  anywhere             anywhere

DROP       all  --  anywhere             anywhere             source IP range 1.0.1.0-1.0.3.255

DROP       all  --  anywhere             anywhere             source IP range 1.0.8.0-1.0.15.255

DROP       all  --  anywhere             anywhere             source IP range 1.0.32.0-1.0.63.255

DROP       all  --  anywhere             anywhere             source IP range 1.1.0.0-1.1.0.255

DROP       all  --  anywhere             anywhere             source IP range 1.1.2.0-1.1.63.255

DROP       all  --  anywhere             anywhere             source IP range 1.2.0.0-1.2.2.255

DROP       all  --  anywhere             anywhere             source IP range 1.2.4.0-1.2.127.255

DROP       all  --  anywhere             anywhere             source IP range 1.3.0.0-1.3.255.255

DROP       all  --  anywhere             anywhere             source IP range 1.4.1.0-1.4.127.255

DROP       all  --  anywhere             anywhere             source IP range 1.8.0.0-1.8.255.255

DROP       all  --  anywhere             anywhere             source IP range 1.10.0.0-1.10.9.255

DROP       all  --  anywhere             anywhere             source IP range 1.10.11.0-1.10.127.255

DROP       all  --  anywhere             anywhere             source IP range 1.12.0.0-1.15.255.255

DROP       all  --  anywhere             anywhere             source IP range 1.24.0.0-1.31.255.255

DROP       all  --  anywhere             anywhere             source IP range 1.45.0.0-1.45.255.255


이지포토
짧은글 일수록 신중하게.
박문형 2020-08
IP 막고 방화벽 구축하는게 다 이긴합니다..

방화벽을 구축해도 뚫릴때는 뚫리기에 계속 돈들여서 방화벽 프로그램을 업데이트 해줘야 합니다..

그 외 보조수단으로 서버의 IP를 가끔씩 바꿔 보는 방법도 있습니다..
     
이지포토 2020-08
서버IP 바꾸면 딸린 식구들이 많아서 좀 바빠요. dns 레코드 부터 .. ^^
분당김동수 2020-08
문이 있으면, 초인종 누르는 사람이 있으니 ...
root 계정명 바꿔 버리세요
     
허인구마틴 2020-08
굿입니다
     
이지포토 2020-08
루트는 접속 못하게 하고 유저를 대신 접속해서 스위칭하란 말씀이죠?
토리 2020-08
뭐 기본적으로.. 외부 접속을 열어두셧으니 말그대로 문 두드리는 길을 막을길은.. 저수단이 다이긴합니다..
경비실(?)서버를 만들어서 인증후 통하시거니..
그런게 개인으로써 최선이죠머.. 방화벽도 업데이트와 유료비용생각하면요..
     
이지포토 2020-08
경비실(?)서버를 만들어서 인증후 통하시거니.. --> 요거 방법좀..알켜 주세요.
          
토리 2020-08
그냥 쉽게..이해하시면 서버를 하나더 만드시는겁니다..
그 서버를 통해서면 해당 본서버를 접속가능하고... 방화벽같은거죠
개인이 방화벽이나 그런거 해놓고 관리하기뭐하니;
서버를 접속할 문지기서버를 두고.. 해당 서버랑은 직접연결시켜놓고 해당 문지기서버만 과부화 받는거죠머;
그냥서버 하나더 만드는개념입니다.. 연결은 서버끼리 연결하시면됩니다..
허인구마틴 2020-08
그냥
간단합니다
첫째  Ssh  접속 포트를 바꾸세요
예를들면 8291    이런식으로

둘째
내부 ip와  접속하는  특정 ip 에서만 ssh 접속가능하게 합니다
     
이지포토 2020-08
위로그 보시면 포트 바꿔가셔 시도 하네요. 근데 아무데나 가서 접속할때가 가끔 있습니다. 이럴땐 제가 불편해서..^^
          
배상0원 2020-08
제 경우 외부 기준 22는 내부의 테스트 서버로, 22XX는 주 서버로 연결해주었습니다.
보통 22를 먼저 긁으니, 22로 접속해서 이상한 시도를 하면 방화벽에 block ip 1주일 짜리로 등록해줍니다.
가끔 제가 실수해서, 폰의 lte를 켜긴 합니다만 포트만 바꾸어도 로그가 쾌청하니까요.
김현린 2020-08
ssh포트 변경만 하셔도 거의 없어 질껍니다.
     
이지포토 2020-08
위로그 보시면 포트 바꿔가셔 시도 하네요
          
김현린 2020-08
그러네요;;;
저도 공인ip받아쓰는데 ssh포트만 변경했더니 확쭐어서 그러려니 했는데..
포트도 랜덤으로 치고 들어오나보군요
대단합니다 ㄷㄷ
블루스맨 2020-08
인터넷상에서 이런건 그냥 백그라운드 노이즈라고 합니다.
전세계 모든 ipv4 공용IP에 대해서 포트스캐닝 하는겁니다.
대상이 특정된 것도 아니고 그냥 뭐든 하나 얻어걸리라고 돌리는 겁니다.

ssh 개방을 lan 대상으로만 하고 VPN 연결해서 접속하세요.
박건 2020-08
화이트리스트로 특정 IP로만 접근하시던가, fail2ban으로 일정한 기준 이상의 접속 실패는 접속 차단을 하던가 할 수 있겠네요.
술이 2020-08
어떤포트를 바꾸더라도 결국은 찾아내구요 앞단에 방화벽이나 필터 및 NAT 포워딩하는 역할할게 있어야 되구요 root를 쓰든 안쓰는 저게 동시다발적으로 계속 시도하기 때문에 트래픽 영향도 있고 저 세션때문에 멈칫멈칫하는 경우도 생깁니다.
VPN 쓰는게 제일 효율적입니다.


QnA
제목Page 2665/5708
2015-12   1675078   백메가
2014-05   5140458   정은준1
2017-12   5027   SuperAngel
2007-02   5027   권디아나
2016-06   5027   나파이강승훈
2021-08   5028   GPGPU
2006-10   5028   윤호용
2016-10   5028   엔진엑스
2013-10   5028   미놀사랑
2016-09   5028   인생여전
2007-06   5028   오성기
2014-10   5028   파렌
2016-09   5028   구쿠르그
2008-10   5028   윤호용
2006-08   5028   윤종완
2020-08   5028   스님9
2017-06   5028   곽순현
2017-02   5028   무아
2014-09   5028   죽부인
2017-02   5028   하셀호프
2006-11   5028   왕정수
2016-04   5028   깜박깜박가