--dport が複数ある場合、-m multiport --dports aa,bb,cc と書けばよろし。
例:
geoipで日本以外からのTCP 22番、80番、443番へのTCPはDROPする。
/sbin/iptables -A INPUT -p tcp -m tcp -m multiport --dports 22,80,443 --tcp-flags FIN,SYN,RST,ACK SYN -m geoip ! --source-country JP -j DROPxtables-geoipでGeoLite2を使うために。
参考:https://github.com/mschmitt/GeoLite2xtables
# apt install libnetaddr-ip-perl libnet-cidr-lite-perl$ git clone https://github.com/mschmitt/GeoLite2xtables.git$ cd GeoLite2xtables$ ./10_download_countryinfo$ cat ../GeoLite2-Country-CSV_20191231/GeoLite2-Country-Blocks-IPv{4,6}.csv > GeoIP-legacy.csv# /usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip GeoIP-legacy.csv