직면 한 서비스 또는 프로세스를 찾는 방법 [UFW BLOCK]
나는 하루 종일 내 문제에 대한 답을 찾으려고 노력했지만 운이 없어서 여기에 쓰기로 결정했습니다. 나는 Linux 전문가가 아니므로 내 질문이 바보라면 용서하십시오. 내에서 다음 메시지를 보았습니다 /var/log/syslog
.
applications kernel: [24592.875919] [UFW BLOCK] IN= OUT=ens18 SRC=192.168.1.100 DST=91.189.89.199 LEN=76 TOS=0x10 PREC=0x00 TTL=64 ID=36213 DF PROTO=UDP SPT=33338 DPT=123 LEN=56
여기서 192.168.1.100은 내 서버의 IP 주소입니다. 꼭 필요한 경우가 아니면 나가거나 들어오는 포트가 열리지 않도록 UFW 규칙을 정의 했으므로 이러한 요청이 차단되는 것이 올바른 작업입니다. 이제 내 생각에는 내 서버 어딘가에 30 분 정도마다이를 트리거하는 악성 파일이 있지만 (로그에 얼마나 자주 표시되는지) 대상 IP와 SPT는 시도 할 때마다 다릅니다. 이제 실행 파일 / 프로세스 / 또는이 메시지를 유발하는 모든 것을 찾고 싶지만 지금까지는 운이 없습니다!
도움을 주시면 감사하겠습니다.
답변
차단 된 패킷의 예에서 핵심 표시기는 대상 포트 123입니다. 이것이 네트워크 시간 프로토콜 포트입니다. 힌트는 서비스가 Ubuntu가 실행하는 NTP라는 것입니다. 두 번째 표시기는으로 보이는 대상 주소이며 golem.canonical.com
Ubuntu NTP 호스트라고 가정합니다. 실제로 역방향 조회를 수행 ntp.ubuntu.com
하면 동일한 IP가 제공되므로 별칭이 있습니다.
$ nslookup ntp.ubuntu.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: ntp.ubuntu.com
Address: 91.189.89.198
Name: ntp.ubuntu.com
Address: 91.189.89.199
Name: ntp.ubuntu.com
Address: 91.189.94.4
Name: ntp.ubuntu.com
Address: 91.189.91.157
따라서 서비스는 NTP입니다.
다음을 통해 확인하십시오 (이 예제는 서버에 있으며 데스크톱이 동일 할 수 있음).
$ systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-08-19 15:22:05 PDT; 16h ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 640 (systemd-timesyn)
Status: "Initial synchronization to time server 91.189.89.199:123 (ntp.ubuntu.com)."
Tasks: 2 (limit: 18892)
Memory: 1.2M
CGroup: /system.slice/systemd-timesyncd.service
└─640 /lib/systemd/systemd-timesyncd
Aug 19 15:22:05 s18 systemd[1]: Starting Network Time Synchronization...
Aug 19 15:22:05 s18 systemd[1]: Started Network Time Synchronization.
Aug 19 15:22:11 s18 systemd-timesyncd[640]: Network configuration changed, trying to establish connection.
Aug 19 15:22:11 s18 systemd-timesyncd[640]: Initial synchronization to time server 91.189.89.199:123 (ntp.ubuntu.com).
내 것이 작동하는 동안 패킷을 차단했기 때문에 동기화에 실패했습니다.