[용어 rlogin : telnet값/ segment: 데이터 단위]
OSI7 Layer :
7층(응용): 일관되게 전송데이터를 이해할 수 있게 해줌
6층(표현): 코드 간의 번역을 담당
5층(세션): 통신 장치 간의 상호작용을 설정
(모든 패킷은 포트를 기반으로 연결)
4계층(전송*):
1) tcp 프로토콜로 세그먼트 단위로 전송 (L4스위치, 게이트웨이)
2) 3-way handshacking
tcp가 가진 주소를 "포트"라함
welkown port: 0~1023
rpm -qa | grep tcp_wrapper
* TCP Wrapper :
특정 서비스에 대해 접근자의 호스트를체크해서 접근 허락할지 여부를 결정(host.allow/ host.deny)
ㄴwhite list / black list
ㄴinternet - 1)firewall - 2) TCP wrapper - network service
mac주소가 네트워크 카드의 고유식별자.
ip가 시스템의 논리적 주소.
포트는 시스템에 도착한 후 패킷이 찾아갈 응용.
#
# hosts.deny This file contains access rules which are used to
# deny connections to network services that either use
# the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# The rules in this file can also be set up in
# /etc/hosts.allow with a 'deny' option instead.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
#
ALL:ALL
# hosts.allow This file contains access rules which are used to
# allow or deny connections to network services that
# either use the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
#
sshd: 192.168.56.0/255.255.255.0
#sshd: 192.168.56.0/24 -위와 동일
in.telnetd: 192.168.56.102
외부에서 접근하는 SSH 서비스에 대해서 192.168.56.0의 접근만을 허용한다. 나머지 접근은 허용하지 않겠다.
화이트 리스트 ? 모두 접근 거부후 접근 허용 대상만 기록
:/etc/hosts.deny에서 모두 거부 -> /etc/hosts.allow에서 접근 허용 대상 기록
블랙 리스트? 모두 허용 후 접근거부 대상만 기록
: /etc/hosts.deny에 거부 목록 기록
Q) 특정 도메인 거부? /etc/hosts.deny -> ALL : dshub.cloud
Q) POP3
이 설정이 /etc/hosts.allow 파일의 설정내용이라면 POP서비스에 대하여 192.168.56.1.100 호스트를 제외한 192.168.1.0 네트워크의 모든 사용자들의 pop접속을 허용한다는 설정.
in.pop3d : 192. 168.1.0/255.255.255.0 EXCEPT 192.168.1.100
Q) allow 정책과 deny정책이 중복이면 allow 정책이 우선
# 예제 1 #
===============================================================================
ㄴ server1(FTP) -> 2번서버는 허용, 3번서버는 차단 (in.ftpd = vsftpd)
-----------------------
/etc/hosts.deny
ALL : ALL
-----------------------
/etc/hosts.allow
vsftpd : 192.168.56.102 EXCEPT 192.168.56.103
# 예제 2 #
===============================================================================
/etc/hosts.deny
ALL : ALL
-> 화이트리스트 기반으로 모든 서비스, 모든 호스트를 차단한다.
===============================================================================
/etc/hosts.allow
ALL : 192.168.10.1 -> 192.168.10.1 IP 주소에 대해 모든 서비스가 가능
in.telnetd : 192.168.20.1 -> 192.168.20.1 IP 주소에 대해 텔넷 서비스 허용
in.ftpd : 192.168.1. -> 192.168.1. 로 시작하는 IP주소에 대해 ftp 서비스 허용
ALL EXCEPT in.telnetd : ALL -> 모든 호스트에 대해 Telnet 서비스를 제외한 모든 서비스 허용
in.telnetd : .com EXCEPT www.cowboy.com
-> www.cowboy.com을 제외한 모든 .com 도메인의 호스트에 대해 텔넷 서비스 허용!
# 예제 3 #
===============================================================================
-> 로컬 및 특정 IP만 대해서 Mail server 및 vsftpd를 모두 허용!
-----------------------
/etc/hosts.deny
ALL : ALL
-----------------------
/etc/hosts.allow
ALL : LOCAL
ALL : 127.0.0.1
ALL : 192.168.56.1
ALL : 192.168.137.100
sendmail : ALL
ipop3d : ALL
dovecot : ALL
vsftpd : ALL
# 예제 4 # Shell 기능 활용
===============================================================================
-> 로컬 및 특정 IP만 대해서 Mail server 및 vsftpd를 모두 허용!
-----------------------
/etc/hosts.deny
ALL : ALL
-----------------------
/etc/hosts.allow
vsftpd : 192.168.56.102 : twist /bin/echo '데이터스토리 허브의 FTP 입니다.'
# 예제 5 # Shell 기능 활용2
===============================================================================
-> 로컬 및 특정 IP만 대해서 Mail server 및 vsftpd를 모두 허용!
-----------------------
/etc/hosts.deny
ALL : ALL
-----------------------
/etc/hosts.allow
vsftpd: 192.168.56.103 Expet 192.168.56.102
vsftpd: 192.168.56.103: spawn / bin/mail -s "using FTP client IP %a" root
tail -f /var/spool/mail/root
Q) 어떤 IP가 몇번 FTP를 이용했었는지 조회? sed(stream editor)
/etc/hosts.deny
ALL : ALL
/etc/hosts/allow
ALL: LOCAL
ALL: 192.168.56.1
ALL: 192.168.137.100
sendmail: ALL
ipop3d: ALL
dovecot: ALL
vsftpd: 192.168.56.102 : twist /bin/echo ' 데이터허브의 FTP입니다.' # 쉘기능
3계층(네트워크*):
전송단위: 패킷
프로토콜: IP, ICMP
라우팅 테이블? 네트워크상에서 주소를 이용하여 목적지까지 메세지를 전달하는 방법을 체계적으로 결정하는 경로배정 과정
root@server1:~:> traceroute www.google.com
traceroute to www.google.com (172.217.31.164), 30 hops max, 60 byte packets
1 gateway (10.0.2.2) 1.211 ms 0.926 ms 0.841 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
[https://gsuite.tools/traceroute]