Przejdź do treści

Wprowadzenie do firewalli w systemie Linux

W tej publikacji przedstawiam praktyczneinformacje na temat trzech najczęściej stosowanych narzędzi do zarządzania zaporami sieciowymi w systemach Linux: firewalld, ufw oraz iptables.

Dalej znajdziesz spis Well known ports, a na samym końcu kilka sposobów przydatnych w analizie portów lokalnych jak i zdalnych.

W sekcji Tools znajdziesz gotowe narzędzia do generowania poleceń na własne potrzeby.

Enjoy!

firewall-cmd (firewalld)

firewalld jest używany domyślnie w dystrybucjach bazujących na Red Hat (RHEL, CentOS, Fedora, AlmaLinux, Rocky).

Zarządzanie portami

Zezwalanie na port

firewall-cmd --add-port=22/tcp
firewall-cmd --add-port=80/tcp --permanent

Blokowanie portu

firewall-cmd --remove-port=22/tcp
firewall-cmd --remove-port=80/tcp --permanent

Otwieranie zakresu portów

firewall-cmd --add-port=4000-4100/tcp --permanent

Aktywacja zmian

firewall-cmd --reload

Zarządzanie usługami

Lista dostępnych usług

firewall-cmd --get-services

Zezwalanie na usługi

firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
firewall-cmd --add-service=ssh --permanent

Blokowanie usługi

firewall-cmd --remove-service=http --permanent

Zarządzanie strefami

Lista dostępnych stref

firewall-cmd --get-zones

Sprawdzanie aktywnej strefy

firewall-cmd --get-active-zones

Ustawianie domyślnej strefy

firewall-cmd --set-default-zone=dmz

Dodawanie interfejsu do strefy

firewall-cmd --zone=internal --add-interface=eth0 --permanent

Wyświetlanie wszystkich reguł w strefie

firewall-cmd --zone=public --list-all

Przekierowanie portów

Przekierowanie portu (np. z 80 na 8080)

firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080 --permanent

Przekierowanie portu na inny host

firewall-cmd --add-forward-port=port=80:proto=tcp:toaddr=192.168.1.10 --permanent
firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080:toaddr=192.168.1.10 --permanent

Reguły adresów źródłowych

Zezwalanie na dostęp z konkretnego adresu/sieci

firewall-cmd --add-source=192.168.1.0/24 --zone=trusted --permanent

Blokowanie dostępu z konkretnego adresu/sieci

firewall-cmd --remove-source=192.168.1.0/24 --zone=trusted --permanent

Reguły rich rules

Note

Rich rules są idealne, gdy potrzebujesz większej szczegółowości niż oferują proste reguły firewalld. Są nieco bardziej złożone w składni, ale dzięki nim możesz dostosować zaporę do specyficznych wymagań bezpieczeństwa Twojego systemu.

Chcesz monitorować, kto próbuje połączyć się z serwerem SSH z konkretnego IP - bez jeszcze blokowania lub akceptowania? Logi będą w journald lub /var/log/messages

firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.42" port port=22 protocol=tcp log prefix="SSH Attempt: " level="info"'

Blokowanie dostępu do portu 80 z konkretnej sieci

firewall-cmd --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port=80 protocol=tcp reject' --permanent

Limit połączeń (max 3 połączenia na minutę)

firewall-cmd --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port=80 protocol=tcp accept limit value="3/m"' --permanent

ufw (Uncomplicated Firewall)

UFW jest prostszym frontendem dla iptables, popularnym w Ubuntu i innych dystrybucjach bazujących na Debianie.

Podstawowe polecenia

Sprawdzanie statusu

ufw status
ufw status verbose
ufw status numbered

Włączanie/wyłączanie

ufw enable
ufw disable

Reset do ustawień domyślnych

ufw reset

Zarządzanie portami

Zezwalanie na port

ufw allow 22/tcp
ufw allow 80

Blokowanie portu

ufw deny 22/tcp
ufw deny 80

Zezwalanie na zakres portów

ufw allow 6000:6100/tcp

Usuwanie reguł (po numerze)

ufw delete 1
ufw delete allow 80

Zarządzanie usługami

Zezwalanie na usługi

ufw allow ssh
ufw allow http
ufw allow https

Blokowanie usługi

ufw deny http

Reguły dla konkretnych adresów

Zezwalanie na dostęp do portu tylko z konkretnego adresu/sieci

ufw allow from 192.168.1.10 to any port 22
ufw allow from 192.168.1.0/24 to any port 80

Blokowanie dostępu z konkretnego adresu/sieci

ufw deny from 192.168.1.10
ufw deny from 192.168.1.0/24 to any port 80

Reguły dla interfejsów

Zezwalanie na dostęp do portu tylko przez konkretny interfejs

ufw allow in on eth0 to any port 80

Blokowanie dostępu przez konkretny interfejs

ufw deny in on eth0 to any port 80

Kierunek ruchu

Zezwalanie na ruch wychodzący

ufw allow out 80/tcp

Blokowanie ruchu wychodzącego

ufw deny out 80/tcp

Logowanie

Domyślnie w /var/log/ufw.log, jeśli nie ma tego pliku upewnij się że rsyslog działa i dodaj regułę w /etc/rsyslog.d/:

:msg, contains, "UFW" -/var/log/ufw.log
& stop

Włączanie logowania

ufw logging on
ufw logging medium  # poziomy: low, medium, high, full

Wyłączanie logowania

ufw logging off

iptables

iptables to niskopoziomowe narzędzie do konfiguracji firewalla w Linuksie.

Podstawowe polecenia

Wyświetlanie reguł

iptables -L
iptables -L -v
iptables -L --line-numbers

Wyświetlanie reguł dla konkretnego łańcucha

iptables -L INPUT -v
iptables -L OUTPUT -v
iptables -L FORWARD -v

Zapisywanie/przywracanie reguł

iptables-save > /etc/iptables.rules
iptables-restore < /etc/iptables.rules

Polityki domyślne

Ustawianie polityki domyślnej (DROP, ACCEPT, REJECT)

iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

Zarządzanie portami

Zezwalanie na port

iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT

Blokowanie portu

iptables -A INPUT -p tcp --dport 22 -j DROP
iptables -A INPUT -p tcp --dport 80 -j REJECT

Zezwalanie na zakres portów

iptables -A INPUT -p tcp --dport 6000:6100 -j ACCEPT

Reguły dla konkretnych adresów/sieci

Zezwalanie na dostęp z konkretnego adresu/sieci

iptables -A INPUT -s 192.168.1.10 -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -j ACCEPT

Blokowanie dostępu z konkretnego adresu/sieci

iptables -A INPUT -s 192.168.1.10 -j DROP
iptables -A INPUT -s 192.168.1.0/24 -j DROP

Allow dla adresu i portu

iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 22 -j ACCEPT

Reguły dla interfejsów

Zezwalanie na dostęp przez konkretny interfejs

iptables -A INPUT -i eth0 -j ACCEPT

Blokowanie dostępu przez konkretny interfejs

iptables -A INPUT -i eth0 -j DROP

Zezwalanie na konkretny port przez konkretny interfejs

iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT

Stan połączenia

Zezwalanie na wszystkie nawiązane połączenia

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Odrzucanie nowych połączeń

iptables -A INPUT -m state --state NEW -j DROP

Limitowanie połączeń

Limit połączeń (max 10 połączeń na sekundę)

iptables -A INPUT -p tcp --dport 80 -m limit --limit 10/second -j ACCEPT

Ochrona przed skanowaniem portów (blokowanie połączeń z flagami SYN,FIN)

iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
Dlaczego ta reguła jest stosowana?
Kombinacja flag SYN i FIN w jednym pakiecie TCP jest nienaturalna w normalnej komunikacji:
- SYN (Synchronize) inicjuje połączenie (3-way handshake)
- FIN (Finish) kończy połączenie

W standardowym działaniu TCP te flagi nie występują razem. Takie pakiety mogą świadczyć o:

- złośliwym skanowaniu sieci (np. próby identyfikacji systemu)
- błędach w implementacji stosu TCP
- atakach typu "stealth scanning"

NAT i przekierowania

Przekierowanie portu (DNAT)

iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.10:8080

Maskarada (NAT dla całej sieci)

iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE

Zarządzanie regułami

Dodawanie reguły na początku łańcucha

iptables -I INPUT 1 -p tcp --dport 22 -j ACCEPT

Usuwanie reguły (po numerze)

iptables -D INPUT 1

Usuwanie reguły (dokładne dopasowanie)

iptables -D INPUT -p tcp --dport 80 -j ACCEPT

Czyszczenie wszystkich reguł

iptables -F

Czyszczenie konkretnego łańcucha

iptables -F INPUT

IPv6

Te same polecenia działają dla ip6tables

ip6tables -L
ip6tables -A INPUT -p tcp --dport 22 -j ACCEPT

Well-Known ports

Poniżej lista well-known portów (porty o numerach 0-1023) oraz popularnych zarejestrowanych portów (1024-49151), które są często wykorzystywane w sieciach komputerowych.

Porty dobrze znane (0-1023)

Port Protokół Usługa Opis
0 TCP/UDP Reserved Port zarezerwowany, nie powinien być używany
1 TCP/UDP TCPMUX TCP Port Service Multiplexer
5 TCP/UDP RJE Remote Job Entry
7 TCP/UDP ECHO Echo Protocol (usługa echo)
9 TCP/UDP DISCARD Discard Protocol (usługa null)
11 TCP/UDP SYSTAT System Status Protocol
13 TCP/UDP DAYTIME Daytime Protocol (data i czas)
17 TCP/UDP QOTD Quote of the Day
18 TCP/UDP MSP Message Send Protocol
19 TCP/UDP CHARGEN Character Generator Protocol
20 TCP FTP-DATA File Transfer Protocol (dane)
21 TCP FTP File Transfer Protocol (kontrola)
22 TCP/UDP SSH Secure Shell Protocol
23 TCP TELNET Telnet Protocol
25 TCP SMTP Simple Mail Transfer Protocol
26 TCP/UDP RSFTP RSFTP - podobny do SMTP
37 TCP/UDP TIME Time Protocol
39 TCP/UDP RLP Resource Location Protocol
42 TCP/UDP NAMESERVER Host Name Server Protocol
43 TCP NICNAME WHOIS Protocol
49 TCP/UDP TACACS Terminal Access Controller Access-Control System
50 TCP/UDP RE-MAIL-CK Remote Mail Checking Protocol
53 TCP/UDP DNS Domain Name System
67 UDP BOOTPS Bootstrap Protocol Server (DHCP)
68 UDP BOOTPC Bootstrap Protocol Client (DHCP)
69 UDP TFTP Trivial File Transfer Protocol
70 TCP GOPHER Gopher Protocol
79 TCP FINGER Finger Protocol
80 TCP HTTP Hypertext Transfer Protocol
81 TCP HOSTS2-NS HOSTS2 Name Server
82 TCP/UDP XFER XFER Utility
83 TCP MIT-ML-DEV MIT ML Device
88 TCP/UDP KERBEROS Kerberos Authentication
95 TCP SUPDUP SUPDUP Protocol
101 TCP HOSTNAME NIC Host Name Server
102 TCP ISO-TSAP ISO-TSAP Protocol
104 TCP/UDP ACRNEMA ACR-NEMA Digital Imaging and Communications in Medicine
107 TCP RTelnet Remote Telnet
109 TCP POP2 Post Office Protocol v2
110 TCP POP3 Post Office Protocol v3
111 TCP/UDP SUNRPC Sun Remote Procedure Call
113 TCP IDENT Authentication Service/Identification Protocol
115 TCP SFTP Simple File Transfer Protocol
117 TCP UUCP-PATH UUCP Path Service
118 TCP/UDP SQL-NET SQL Services
119 TCP NNTP Network News Transfer Protocol
123 UDP NTP Network Time Protocol
135 TCP/UDP EPMAP DCE endpoint resolution
137 TCP/UDP NETBIOS-NS NetBIOS Name Service
138 UDP NETBIOS-DGM NetBIOS Datagram Service
139 TCP NETBIOS-SSN NetBIOS Session Service
143 TCP IMAP Internet Message Access Protocol
152 TCP/UDP BFTP Background File Transfer Program
153 TCP/UDP SGMP Simple Gateway Monitoring Protocol
156 TCP/UDP SQL-SERVER SQL Service
158 TCP/UDP DMSP Distributed Mail Service Protocol
161 UDP SNMP Simple Network Management Protocol
162 TCP/UDP SNMPTRAP Simple Network Management Protocol Trap
170 TCP PRINT-SRV Network PostScript
177 TCP/UDP XDMCP X Display Manager Control Protocol
179 TCP BGP Border Gateway Protocol
194 TCP/UDP IRC Internet Relay Chat
199 TCP/UDP SMUX SNMP Unix Multiplexer
201 TCP/UDP APPLIX Applix ac
209 TCP/UDP QMTP Quick Mail Transfer Protocol
210 TCP/UDP Z39.50 ANSI Z39.50
213 TCP/UDP IPX Internetwork Packet Exchange
220 TCP/UDP IMAP3 Interactive Mail Access Protocol v3
245 TCP/UDP LINK LINK Protocol
311 TCP ASIP-WEBADMIN AppleShare IP WebAdmin
318 TCP/UDP TSP Time Stamp Protocol
319 UDP PTP-EVENT Precision Time Protocol (PTP) - Event
320 UDP PTP-GENERAL Precision Time Protocol (PTP) - General
350 TCP/UDP MATIP-TYPE-A Mapping of Airline Traffic over IP, Type A
351 TCP/UDP MATIP-TYPE-B Mapping of Airline Traffic over IP, Type B
366 TCP/UDP ODMR On-Demand Mail Relay
369 TCP/UDP RPC2PORTMAP Coda portmapper
370 TCP/UDP CODAAUTH2 Coda authentication server
371 TCP/UDP CLEARCASE Clearcase
383 TCP/UDP HP-ALARM-MGR HP performance data alarm manager
384 TCP/UDP ARNS A Remote Network Server System
387 TCP/UDP AURP AppleTalk Update-based Routing Protocol
389 TCP/UDP LDAP Lightweight Directory Access Protocol
399 TCP/UDP ISO-TSAP-C2 ISO Transport Class 2 Non-Control over TCP
401 TCP/UDP UPS Uninterruptible Power Supply
427 TCP/UDP SLP Service Location Protocol
443 TCP/UDP HTTPS HTTP Secure (HTTP over TLS/SSL)
444 TCP/UDP SNPP Simple Network Paging Protocol
445 TCP MICROSOFT-DS Microsoft-DS (Direct Hosting of SMB)
464 TCP/UDP KPASSWD Kerberos Change/Set password
465 TCP SMTPS SMTP over TLS/SSL
475 TCP TCF TCF
500 UDP ISAKMP Internet Security Association and Key Management Protocol
502 TCP/UDP MODBUS Modbus Protocol
512 TCP EXEC Remote Process Execution
512 UDP COMSAT COMSAT
513 TCP LOGIN Remote Login (rlogin)
513 UDP WHO Who service
514 TCP SHELL Remote Shell (rsh)
514 UDP SYSLOG Syslog service
515 TCP PRINTER Line Printer Daemon (LPD)
517 UDP TALK Talk
518 UDP NTALK Network Talk
520 UDP RIP Routing Information Protocol
520 TCP EFS Extended File Name Server
521 UDP RIPng RIP for IPv6
524 TCP/UDP NCP NetWare Core Protocol
525 UDP TIMED Time Daemon
530 TCP/UDP COURIER Courier Remote Procedure Call
531 TCP/UDP CONFERENCE Chat
532 TCP NETNEWS Netnews
533 UDP NETWALL For emergency broadcasts
540 TCP UUCP UUCP Daemon
542 TCP/UDP COMMERCE Commerce Applications
543 TCP KLOGIN Kerberos Login
544 TCP KSHELL Kerberos Remote Shell
546 TCP/UDP DHCPv6-CLIENT DHCPv6 Client
547 TCP/UDP DHCPv6-SERVER DHCPv6 Server
548 TCP AFP Apple Filing Protocol
550 TCP/UDP NEW-RWHO new-who
554 TCP/UDP RTSP Real Time Streaming Protocol
556 TCP REMOTEFS Brunhoff's Remote File System
560 UDP RMONITOR Remote Monitor
561 UDP MONITOR Monitor
563 TCP/UDP NNTPS NNTP over TLS/SSL
565 TCP/UDP WHOAMI whoami
569 TCP MSN Microsoft Network
587 TCP SUBMISSION Message Submission Agent (MSA)
593 TCP/UDP HTTP-RPC-EPMAP HTTP RPC Ep Map
631 TCP/UDP IPP Internet Printing Protocol
635 TCP/UDP RLZ-DBase RLZ DBase
636 TCP/UDP LDAPS LDAP over TLS/SSL
639 TCP/UDP MSDP Multicast Source Discovery Protocol
641 TCP/UDP SUPFILESRV Support File Service
643 TCP/UDP SUPSRVR Support Service
646 TCP LDP Label Distribution Protocol
647 TCP DHCP-FAILOVER DHCP Failover
648 TCP RRP Registry Registrar Protocol
651 TCP IEEE-MMS IEEE MMS
653 TCP SPOOLER Spooler
654 TCP SNPP Simple Network Paging Protocol
655 TCP TINC TINC
657 TCP RMC RMC
660 TCP MAC-SRVR-ADMIN MacOS Server Admin
666 TCP DOOM Doom (gry)
674 TCP ACAP Application Configuration Access Protocol
688 TCP REALM-RUSD ApplianceWare Server Appliance Management Protocol
690 TCP/UDP NMAP NMAP - Network Mapper
691 TCP MS-EXCHANGE MS Exchange Routing
694 UDP LINUX-HA Linux-HA (Heartbeat)
695 TCP/UDP IEEE-MMS-SSL IEEE-MMS-SSL
700 TCP EPP Extensible Provisioning Protocol
701 TCP LMP Link Management Protocol
702 TCP IRIS-BEEP IRIS over BEEP
706 TCP SILC Secure Internet Live Conferencing
711 TCP CISCO-TDP Cisco Tag Distribution Protocol
712 TCP TBRPF Topology Broadcast based on Reverse-Path Forwarding Protocol
749 TCP/UDP KERBEROS-ADM Kerberos administration
750 UDP KERBEROS-IV Kerberos version IV
751 TCP/UDP KERBEROS-MASTER Kerberos authentication
752 UDP PASSWD-SERVER Kerberos Password (kpasswd) Server
753 UDP USERREG-SERVER Kerberos userreg server
754 TCP/UDP TELL send
760 TCP NS Kerberos replica propagation
782 TCP CONSERVER Conserver serial-console management server
783 TCP SPARTA-RPC SPARTA, unregistered
829 TCP CMP Certificate Management Protocol
853 TCP/UDP DNS-OVER-TLS DNS over TLS/SSL
873 TCP RSYNC rsync File Synchronization Protocol
901 TCP SWAT Samba Web Administration Tool
902 TCP VMWARE VMware Server Console
903 TCP ISCSI-TARGET iSCSI Target
989 TCP/UDP FTPS-DATA FTP data over TLS/SSL
990 TCP/UDP FTPS FTP control over TLS/SSL
991 TCP/UDP NAS Netnews Administration System
992 TCP/UDP TELNETS Telnet over TLS/SSL
993 TCP IMAPS IMAP over TLS/SSL
994 TCP IRCS IRC over TLS/SSL
995 TCP POP3S POP3 over TLS/SSL
1023 TCP/UDP Reserved Reserved

Wybrane popularne porty zarejestrowane (1024-49151)

Port Protokół Usługa Opis
1080 TCP SOCKS SOCKS Proxy
1099 TCP RMI Java Remote Method Invocation (RMI)
1194 TCP/UDP OpenVPN OpenVPN
1270 TCP/UDP MSCLIENTADMIN Microsoft Client Administrator
1311 TCP RXP RXP - Dell Remote Access
1352 TCP LOTUSNOTES Lotus Notes/Domino
1433 TCP MS-SQL-S Microsoft SQL Server
1434 UDP MS-SQL-M Microsoft SQL Monitor
1512 TCP/UDP WINS Microsoft Windows Internet Name Service
1521 TCP ORACLE Oracle database default listener
1525 TCP PROSPERO Prospero Directory Service
1526 TCP PROSPERO-NP Prospero Non-Privileged
1527 TCP TLISRV Oracle TLI Service
1533 TCP SAMSG Microsoft SQL Server Administrator
1645 UDP SIGHTLINE Sightline
1646 UDP SIGHTLINE Sightline
1649 TCP KERMIT Kermit
1677 TCP/UDP GROUPWISE Novell GroupWise
1701 UDP L2TP Layer 2 Tunneling Protocol
1716 TCP MITU Microsoft Interactive Training
1719 UDP H323GATESTAT H.323 Gatekeeper Status
1720 TCP H323HOSTCALL H.323 Call Signaling
1723 TCP/UDP PPTP Point-to-Point Tunneling Protocol
1755 TCP/UDP MMS Microsoft Media Services
1761 TCP LANDESK-RC LANDesk Remote Control
1812 TCP/UDP RADIUS RADIUS authentication protocol
1813 TCP/UDP RADIUS-ACCT RADIUS accounting protocol
1863 TCP MSNP Microsoft Notification Protocol (MSN Messenger)
1883 TCP/UDP MQTT Message Queuing Telemetry Transport
1900 UDP SSDP Simple Service Discovery Protocol
1935 TCP RTMP Real Time Messaging Protocol
2000 TCP/UDP CISCO-SCCP Cisco SCCP/Skinny
2049 TCP/UDP NFS Network File System
2082 TCP CPANEL cPanel default
2083 TCP CPANEL-SSL cPanel default SSL
2086 TCP WEBHOST Web Host Manager default
2087 TCP WEBHOST-SSL Web Host Manager default SSL
2095 TCP WEBMAIL cPanel Webmail
2096 TCP WEBMAIL-SSL cPanel Webmail SSL
2181 TCP ZOOKEEPER Apache ZooKeeper client
2220 TCP NETIQ NetIQ
2222 TCP DIRECTADMIN DirectAdmin default
2375 TCP DOCKER Docker REST API (unencrypted)
2376 TCP DOCKER-S Docker REST API (SSL)
2377 TCP DOCKER-SWARM Docker Swarm cluster management
2483 TCP ORACLE-DB Oracle DB default listener (TCP/IP v2)
2484 TCP ORACLE-DB-SSL Oracle DB default listener SSL
2638 TCP SYBASE Sybase database server
3000 TCP NTOP ntop web interface
3001 TCP NESSUS Nessus Security Scanner
3128 TCP SQUID Squid Web Proxy
3260 TCP ISCSI iSCSI target
3268 TCP MSFT-GC Microsoft Global Catalog
3269 TCP MSFT-GC-SSL Microsoft Global Catalog over SSL
3306 TCP MYSQL MySQL database system
3333 TCP DEC-NOTES DEC Notes
3389 TCP/UDP MS-RDP Microsoft Remote Desktop Protocol
3690 TCP SVN Subversion Version Control System
3724 TCP/UDP BLIZZARD Blizzard Games
3872 TCP ORACLE-NET Oracle Net Services
4000 TCP/UDP DICOM Medical Digital Imaging
4040 TCP H225 H.225
4200 TCP VNC Virtual Network Computing
4369 TCP/UDP EPMD Erlang Port Mapper Daemon
4443 TCP PHAROS Pharos
4444 TCP KRSD Kerberos Remote Setup and Administration Daemon
4445 TCP UPNOTIFYP UPNOTIFYP
4505 TCP SALTSTACK SaltStack Master
4506 TCP SALTSTACK SaltStack Minion
4569 UDP IAX Inter-Asterisk eXchange
4664 TCP DSMS Google Desktop Search
4730 TCP/UDP GEARMAN Gearman Job Server
5000 TCP UPnP Universal Plug and Play
5001 TCP IPP IPP (Internet Presence Provider)
5004 UDP RTP Real-time Transport Protocol (media data)
5005 UDP RTCP Real-time Transport Control Protocol (control info)
5060 TCP/UDP SIP Session Initiation Protocol
5061 TCP/UDP SIP-TLS Session Initiation Protocol over TLS
5190 TCP AOL AOL Instant Messenger
5222 TCP XMPP XMPP/Jabber client connection
5269 TCP XMPP-SERVER XMPP/Jabber server-to-server connection
5353 UDP MDNS Multicast DNS (Zeroconf/Bonjour)
5432 TCP POSTGRESQL PostgreSQL database system
5433 TCP PYRRHO Pyrrho DBMS
5500 TCP VNC Virtual Network Computing
5554 TCP SGI-ESPHTTP SGI ESP HTTP
5631 TCP PCANYWHEREDATA pcAnywhere data
5632 UDP PCANYWHERESTAT pcAnywhere status
5672 TCP AMQP Advanced Message Queuing Protocol
5900 TCP VNC Virtual Network Computing (VNC) display 0
5901-5903 TCP VNC Virtual Network Computing (VNC) displays 1-3
5938 TCP TEAMVIEWER TeamViewer remote control
6000-6063 TCP X11 X Window System (X11) displays 0-63
6346 TCP/UDP GNUTELLA Gnutella file sharing
6347 TCP/UDP GNUTELLA2 Gnutella2 file sharing
6379 TCP REDIS Redis key-value datastore
6444 TCP SUN-SR-HTTPS Sun Storage and Backup
6543 TCP MYTHTV MythTV Backend Server
6566 TCP SANE SANE Network Scanner Control
6660-6669 TCP IRC Internet Relay Chat
6881-6887 TCP/UDP BITTORRENT BitTorrent
6888 TCP MUSE MUSE
6969 TCP ACMSODA acmSODA
7000 TCP ATRCTRL Atrctrl
7001 TCP WEBLOGIC WebLogic Server
7002 TCP WEBLOGIC-SSL WebLogic Server SSL
7003 TCP/UDP VOLUME-CAPACITY VERITAS Volume Manager
7070 TCP REALSERVER RealServer/QuickTime
7100 TCP FONT-SERVICE X Font Service
7937 TCP NSREXECD Legato NetWorker
7938 TCP LGTOMAPPER Legato NetWorker
8000 TCP HTTP-ALT Alternate HTTP port
8008 TCP HTTP Alternate HTTP port
8009 TCP AJPV13 Apache JServ Protocol
8010 TCP XMPP XMPP/Jabber File Transfer
8080 TCP HTTP-PROXY HTTP Proxy/Second Web Server
8081 TCP HTTP-PROXY HTTP Proxy/Second Web Server
8086 TCP INFLUXDB InfluxDB database system
8088 TCP RADAN-HTTP Radan HTTP
8089 TCP SPLUNKD Splunk search service
8090 TCP OPSMESSAGING SAP Solution Manager
8140 TCP PUPPET Puppet Master
8191 TCP LIMNERPRESSURE Limner Pressure
8443 TCP HTTPS-ALT Alternate HTTPS port
8530 TCP WSUS Windows Server Update Services
8883 TCP SECURE-MQTT Secure MQTT (MQTT over TLS)
8888 TCP NewsEDGE NewsEDGE server
9000 TCP CSLISTENER CSlistener
9001 TCP TOR-ORPORT Tor ORPort
9009 TCP PICHAT Pichat Server
9090 TCP WEBSM WebSM
9091 TCP XMLTEC-XMLMAIL xmltec-xmlmail
9100 TCP JETDIRECT HP JetDirect card
9200 TCP ELASTICSEARCH Elasticsearch REST API
9300 TCP ELASTICSEARCH Elasticsearch transport protocol
9418 TCP GIT Git Version Control System
9443 TCP TUNGSTEN-HTTPS WSO2 Tungsten HTTPS
9999 TCP DISTINCT Distinct
10000 TCP WEBMIN Webmin Administrative Interface
10050 TCP/UDP ZABBIX-AGENT Zabbix Agent
10051 TCP/UDP ZABBIX-TRAPPER Zabbix Trapper
11211 TCP/UDP MEMCACHED Memcached
11371 TCP HKPV0 OpenPGP HTTP Keyserver Protocol (HKP)
12345 TCP NETBUS NetBus backdoor trojan
16000 TCP ORACLE-XE Oracle Express Database
27017-27019 TCP MONGODB MongoDB database system
28017 TCP MONGODB-WEB MongoDB web status page
32400 TCP PLEX Plex Media Server
33060 TCP MYSQLX MySQL X Protocol
33848 TCP JENKINS Jenkins web interface

Uwagi

  1. Well-known porty (0-1023) wymagają uprawnień roota/administratora do nasłuchiwania.
  2. Porty zarejestrowane (1024-49151) są przydzielane przez IANA na żądanie.
  3. Porty dynamiczne/prywatne (49152-65535) mogą być używane przez dowolne aplikacje.

Przydatne polecenia do analizy portów

Sprawdzanie otwartych portów i nasłuchujących usług

netstat -tunlp
ss -tunlp

Sprawdzanie, który proces korzysta z konkretnego portu

lsof -i:80
fuser 80/tcp

Skanowanie portów na lokalnym hoście

nmap -sT -O localhost

Nasłuchiwanie na określonym porcie (netcat)

nc -l -p 1234

Testowanie połączenia TCP na danym porcie

nc -zv example.com 80