Здавствуйте люди! Я - новичок в linux. Очень туго всё доходит, но на допах задали на лето научиться работать в linux. Что-нибудь надо сделать и потом показать, рассказать, что могу работать с linux. Решил научиться сразу, чтоб в конце августа не париться. Мне выдали доступ на сервер где много всяких сереверов. Лотерея была. Мне попался Red Hat Enterprise Linux Server 7.5 (Maipo). Установил Apache 2.4.6. и у меня появились гости. Их много, выглядят примерно одинаково. Примерно так:
192.169.226.71 - - [25/May/2018:21:27:40 +0300] "GET / HTTP/1.1" 200 64172 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:27:54 +0300] "GET /script HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:28:01 +0300] "GET /jenkins/script HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:28:12 +0300] "GET /login HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:28:20 +0300] "GET /jmx-console HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:28:38 +0300] "GET /manager/html HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:28:41 +0300] "GET /msd HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:28:57 +0300] "GET /mySqlDumper HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:29:05 +0300] "GET /msd1.24stable HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:29:24 +0300] "GET /msd1.24.4 HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:29:28 +0300] "GET /mysqldumper HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:29:46 +0300] "GET /MySQLDumper HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:29:59 +0300] "GET /mysql HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:30:10 +0300] "GET /sql HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:30:23 +0300] "GET /phpmyadmin HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:30:33 +0300] "GET /phpMyAdmin HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:30:43 +0300] "GET /mysql HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:31:01 +0300] "GET /sql HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:31:16 +0300] "GET /myadmin HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:31:22 +0300] "GET /phpMyAdmin-4.2.1-all-languages HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:31:30 +0300] "GET /phpMyAdmin-4.2.1-english HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:31:36 +0300] "GET / HTTP/1.1" 200 64172 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:31:44 +0300] "GET /sqlite/main.php HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:31:52 +0300] "GET /SQLite/SQLiteManager-1.2.4/main.php HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:32:04 +0300] "GET /SQLiteManager-1.2.4/main.php HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:32:12 +0300] "GET /sqlitemanager/main.php HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:32:27 +0300] "GET /SQlite/main.php HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
192.169.226.71 - - [25/May/2018:21:32:31 +0300] "GET /SQLiteManager/main.php HTTP/1.1" 404 25405 "-" "Python-urllib/2.7"
46.246.42.133 - - [26/May/2018:04:12:10 +0300] "GET /muieblackcat HTTP/1.1" 404 9694 "-" "-"
46.246.42.133 - - [26/May/2018:04:12:11 +0300] "GET //phpMyAdmin/scripts/setup.php HTTP/1.1" 404 9694 "-" "-"
46.246.42.133 - - [26/May/2018:04:12:11 +0300] "GET //phpmyadmin/scripts/setup.php HTTP/1.1" 404 9694 "-" "-"
46.246.42.133 - - [26/May/2018:04:12:12 +0300] "GET //pma/scripts/setup.php HTTP/1.1" 404 9694 "-" "-"
46.246.42.133 - - [26/May/2018:04:12:12 +0300] "GET //myadmin/scripts/setup.php HTTP/1.1" 404 9694 "-" "-"
46.246.42.133 - - [26/May/2018:04:12:13 +0300] "GET //MyAdmin/scripts/setup.php HTTP/1.1" 404 9694 "-" "-"
46.243.189.60 - - [26/May/2018:04:22:10 +0300] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 9694 "-" "ZmEu"
46.243.189.60 - - [26/May/2018:04:22:10 +0300] "GET /phpMyAdmin/scripts/setup.php HTTP/1.1" 404 9694 "-" "ZmEu"
46.243.189.60 - - [26/May/2018:04:22:10 +0300] "GET /phpmyadmin/scripts/setup.php HTTP/1.1" 404 9694 "-" "ZmEu"
46.243.189.60 - - [26/May/2018:04:22:10 +0300] "GET /pma/scripts/setup.php HTTP/1.1" 404 9694 "-" "ZmEu"
46.243.189.60 - - [26/May/2018:04:22:10 +0300] "GET /myadmin/scripts/setup.php HTTP/1.1" 404 9694 "-" "ZmEu"
46.243.189.60 - - [26/May/2018:04:22:10 +0300] "GET /MyAdmin/scripts/setup.php HTTP/1.1" 404 9694 "-" "ZmEu"
# uname -a
Linux myserver 3.10.0-862.3.2.el7.x86_64 #1 SMP Tue May 15 18:22:15 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
# ./xt_geoip_dl
# ./xt_geoip_build GeoIPCountryWhois.csv
# mkdir -p /usr/share/xt_geoip/
# cp -r {BE,LE} /usr/share/xt_geoip/
# firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -m geoip ! --src-cc RU -j DROP
success
# firewall-cmd --reload
# firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -m geoip ! --src-cc RU -j DROP
Warning: ALREADY_ENABLED: rule '['-m', 'geoip', '!', '--src-cc', 'RU', '-j', 'DROP']' already is in 'ipv4:filter:INPUT'
success
# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp6s0f0
sources:
services: http ssh https
ports: 22/tcp 80/tcp 443/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
rule source NOT ipset="mysshconnect" port port="22" protocol="tcp" reject
rule source ipset="webdownloader" port port="80" protocol="tcp" reject
rule source ipset="webdownloader" port port="443" protocol="tcp" reject
Я, наверное, ошибся, когда подумал, что firewall-cmd --list выводит почти тоже самое, но короче. Вот, iptables-save выводит длиннее:
# Generated by iptables-save v1.4.21 on Sat May 26 18:37:01 2018
*nat
:PREROUTING ACCEPT [3309:517496]
:INPUT ACCEPT [11:548]
:OUTPUT ACCEPT [188:27172]
:POSTROUTING ACCEPT [188:27172]
:OUTPUT_direct - [0:0]
:POSTROUTING_ZONES - [0:0]
:POSTROUTING_ZONES_SOURCE - [0:0]
:POSTROUTING_direct - [0:0]
:POST_public - [0:0]
:POST_public_allow - [0:0]
:POST_public_deny - [0:0]
:POST_public_log - [0:0]
:PREROUTING_ZONES - [0:0]
:PREROUTING_ZONES_SOURCE - [0:0]
:PREROUTING_direct - [0:0]
:PRE_public - [0:0]
:PRE_public_allow - [0:0]
:PRE_public_deny - [0:0]
:PRE_public_log - [0:0]
-A PREROUTING -j PREROUTING_direct
-A PREROUTING -j PREROUTING_ZONES_SOURCE
-A PREROUTING -j PREROUTING_ZONES
-A OUTPUT -j OUTPUT_direct
-A POSTROUTING -s 192.168.168.0/24 -d 224.0.0.0/24 -j RETURN
-A POSTROUTING -s 192.168.168.0/24 -d 255.255.255.255/32 -j RETURN
-A POSTROUTING -s 192.168.168.0/24 ! -d 192.168.168.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535
-A POSTROUTING -s 192.168.168.0/24 ! -d 192.168.168.0/24 -p udp -j MASQUERADE --to-ports 1024-65535
-A POSTROUTING -s 192.168.168.0/24 ! -d 192.168.168.0/24 -j MASQUERADE
-A POSTROUTING -j POSTROUTING_direct
-A POSTROUTING -j POSTROUTING_ZONES_SOURCE
-A POSTROUTING -j POSTROUTING_ZONES
-A POSTROUTING_ZONES -o enp6s0f0 -g POST_public
-A POSTROUTING_ZONES -g POST_public
-A POST_public -j POST_public_log
-A POST_public -j POST_public_deny
-A POST_public -j POST_public_allow
-A PREROUTING_ZONES -i enp6s0f0 -g PRE_public
-A PREROUTING_ZONES -g PRE_public
-A PRE_public -j PRE_public_log
-A PRE_public -j PRE_public_deny
-A PRE_public -j PRE_public_allow
COMMIT
# Completed on Sat May 26 18:37:01 2018
# Generated by iptables-save v1.4.21 on Sat May 26 18:37:01 2018
*mangle
:PREROUTING ACCEPT [9287:1068448]
:INPUT ACCEPT [6384:591507]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [4849:1728414]
:POSTROUTING ACCEPT [5001:1764894]
:FORWARD_direct - [0:0]
:INPUT_direct - [0:0]
:OUTPUT_direct - [0:0]
:POSTROUTING_direct - [0:0]
:PREROUTING_ZONES - [0:0]
:PREROUTING_ZONES_SOURCE - [0:0]
:PREROUTING_direct - [0:0]
:PRE_public - [0:0]
:PRE_public_allow - [0:0]
:PRE_public_deny - [0:0]
:PRE_public_log - [0:0]
-A PREROUTING -j PREROUTING_direct
-A PREROUTING -j PREROUTING_ZONES_SOURCE
-A PREROUTING -j PREROUTING_ZONES
-A INPUT -j INPUT_direct
-A FORWARD -j FORWARD_direct
-A OUTPUT -j OUTPUT_direct
-A POSTROUTING -j POSTROUTING_direct
-A PREROUTING_ZONES -i enp6s0f0 -g PRE_public
-A PREROUTING_ZONES -g PRE_public
-A PRE_public -j PRE_public_log
-A PRE_public -j PRE_public_deny
-A PRE_public -j PRE_public_allow
COMMIT
# Completed on Sat May 26 18:37:01 2018
# Generated by iptables-save v1.4.21 on Sat May 26 18:37:01 2018
*security
:INPUT ACCEPT [5992:551656]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [4851:1728622]
:FORWARD_direct - [0:0]
:INPUT_direct - [0:0]
:OUTPUT_direct - [0:0]
-A INPUT -j INPUT_direct
-A FORWARD -j FORWARD_direct
-A OUTPUT -j OUTPUT_direct
COMMIT
# Completed on Sat May 26 18:37:01 2018
# Generated by iptables-save v1.4.21 on Sat May 26 18:37:01 2018
*raw
:PREROUTING ACCEPT [9290:1068604]
:OUTPUT ACCEPT [4851:1728622]
:OUTPUT_direct - [0:0]
:PREROUTING_ZONES - [0:0]
:PREROUTING_ZONES_SOURCE - [0:0]
:PREROUTING_direct - [0:0]
:PRE_public - [0:0]
:PRE_public_allow - [0:0]
:PRE_public_deny - [0:0]
:PRE_public_log - [0:0]
-A PREROUTING -j PREROUTING_direct
-A PREROUTING -j PREROUTING_ZONES_SOURCE
-A PREROUTING -j PREROUTING_ZONES
-A OUTPUT -j OUTPUT_direct
-A PREROUTING_ZONES -i enp6s0f0 -g PRE_public
-A PREROUTING_ZONES -g PRE_public
-A PRE_public -j PRE_public_log
-A PRE_public -j PRE_public_deny
-A PRE_public -j PRE_public_allow
COMMIT
# Completed on Sat May 26 18:37:01 2018
# Generated by iptables-save v1.4.21 on Sat May 26 18:37:01 2018
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [4849:1728414]
:FORWARD_IN_ZONES - [0:0]
:FORWARD_IN_ZONES_SOURCE - [0:0]
:FORWARD_OUT_ZONES - [0:0]
:FORWARD_OUT_ZONES_SOURCE - [0:0]
:FORWARD_direct - [0:0]
:FWDI_public - [0:0]
:FWDI_public_allow - [0:0]
:FWDI_public_deny - [0:0]
:FWDI_public_log - [0:0]
:FWDO_public - [0:0]
:FWDO_public_allow - [0:0]
:FWDO_public_deny - [0:0]
:FWDO_public_log - [0:0]
:INPUT_ZONES - [0:0]
:INPUT_ZONES_SOURCE - [0:0]
:INPUT_direct - [0:0]
:IN_public - [0:0]
:IN_public_allow - [0:0]
:IN_public_deny - [0:0]
:IN_public_log - [0:0]
:OUTPUT_direct - [0:0]
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -j INPUT_direct
-A INPUT -j INPUT_ZONES_SOURCE
-A INPUT -j INPUT_ZONES
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i lo -j ACCEPT
-A FORWARD -j FORWARD_direct
-A FORWARD -j FORWARD_IN_ZONES_SOURCE
-A FORWARD -j FORWARD_IN_ZONES
-A FORWARD -j FORWARD_OUT_ZONES_SOURCE
-A FORWARD -j FORWARD_OUT_ZONES
-A FORWARD -m conntrack --ctstate INVALID -j DROP
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A OUTPUT -j OUTPUT_direct
-A FORWARD_IN_ZONES -i enp6s0f0 -g FWDI_public
-A FORWARD_IN_ZONES -g FWDI_public
-A FORWARD_OUT_ZONES -o enp6s0f0 -g FWDO_public
-A FORWARD_OUT_ZONES -g FWDO_public
-A FWDI_public -j FWDI_public_log
-A FWDI_public -j FWDI_public_deny
-A FWDI_public -j FWDI_public_allow
-A FWDI_public -p icmp -j ACCEPT
-A FWDO_public -j FWDO_public_log
-A FWDO_public -j FWDO_public_deny
-A FWDO_public -j FWDO_public_allow
-A INPUT_ZONES -i enp6s0f0 -g IN_public
-A INPUT_ZONES -g IN_public
-A IN_public -j IN_public_log
-A IN_public -j IN_public_deny
-A IN_public -j IN_public_allow
-A IN_public -p icmp -j ACCEPT
-A IN_public_allow -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT
-A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
-A IN_public_allow -p tcp -m tcp --dport 443 -m conntrack --ctstate NEW -j ACCEPT
-A IN_public_deny -p tcp -m set ! --match-set mysshconnect src -m tcp --dport 22 -m conntrack --ctstate NEW -j REJECT --reject-with icmp-port-unreachable
-A IN_public_deny -p tcp -m set --match-set webdownloader src -m tcp --dport 80 -m conntrack --ctstate NEW -j REJECT --reject-with icmp-port-unreachable
-A IN_public_deny -p tcp -m set --match-set webdownloader src -m tcp --dport 443 -m conntrack --ctstate NEW -j REJECT --reject-with icmp-port-unreachable
COMMIT
# Completed on Sat May 26 18:37:01 2018