ВидеоКонф(ВКС)  ::   FAQ  ::   Поиск  ::   Регистрация  ::   Вход

После обновления сервера стали недоступными AMI и MySQL

Проблемы и их решения Asterisk как такового

Модераторы: april22, Zavr2008

После обновления сервера стали недоступными AMI и MySQL

Сообщение fckurethn » 13 окт 2020, 12:17

День добрый, господа!

Linux freepbx.sangoma.local 3.10.0-1127.19.1.el7.x86_64
FreePBX15.0.16.75
Asterisk 16.13

После замены сервера на новый CRM не может достучаться к АТС. Текст из окна с ошибкой после проверки интеграции:

AMI: Ошибка чтения.
CDR: SQLSTATE[HY000] [2002] Connection timed out
FTP: Параметры подключения верны


При этом на новом сервере установлен тот же статический адрес, что и на старом сервере. Данные для интеграции в настройках CRM указаны верно. Среди них: логин/пароль пользователя admin в AMI и пользователь с паролем для связи с MySQL. Проброс портов на маршрутизаторе осуществлён, но сканирование его nmap показывает, что проброшенные порты не слушает. Впрочем, даже попытка достучаться из CLI к АMI, используя внутресетевой адрес, тоже не увенчалась успехом (порт 5038 asterisk слушает).

По AMI. Пытался вводить команды как через один перенос строки, так и через два:
Код: выделить все
[randomname@rndmcmp ~]$ telnet 192.168.0.90 5038
Trying 192.168.0.90...
Connected to 192.168.0.90.
Escape character is '^]'.
Asterisk Call Manager/5.0.2
Action: Login
Username: admin
Secret: secret
Connection closed by foreign host.
[randomname@rndmcmp ~]$ telnet 192.168.0.90 5038
Trying 192.168.0.90...
Connected to 192.168.0.90.
Escape character is '^]'.
Asterisk Call Manager/5.0.2
Action: Login

Response: Error
Message: Authentication failed

Connection closed by foreign host.


Если же стучаться через "балый" адрес, то AMI вовсе молчит, равно как и MySQL. Добавление правил по портам в iptables не помогло. На маршрутизаторе пробовался как проброс портов, так и DMZ, и Port Triggering - всё не помогло. Так же на муршрутизаторе как до, так и после замены сервера не включен Firewall. При всём этом, как уже было указано выше, FTP подключается без проблем. В целом, копипастил настройки старого на новый сервер.

Конфиги.
manager.conf
Код: выделить все
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0
displayconnects=yes ;only effects 1.6+

[admin]
secret = secret
;deny=0.0.0.0/0.0.0.0
;permit=127.0.0.1/255.255.255.0 ;вот тут разницы нет - хоть закоменчен, хоть раскоменчен, - CRM не может достучаться
read = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message
write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message
writetimeout = 5000


sip.conf
Код: выделить все
accept_outofcall_message=yes
auth_message_requests=no
outofcall_message_context=dpma_message_context
faxdetect=no
vmexten=*97
useragent=FPBX-15.0.16.75(16.13.0)
language=ru
disallow=all
allow=ulaw
allow=alaw
allow=gsm
context=from-sip-external
callerid=Unknown
notifyringing=yes
notifyhold=yes
tos_sip=cs3
tos_audio=ef
tos_video=af41
alwaysauthreject=yes
limitonpeers=yes
accept_outofcall_message=yes
outofcall_message_context=astsms
rtpend=20000
context=from-sip-external
callerid=Unknown
rtpstart=10000
tcpenable=no
callevents=yes
jbenable=no
checkmwi=10
maxexpiry=3600
minexpiry=60
srvlookup=no
tlsenable=no
allowguest=no
notifyhold=yes
rtptimeout=30
canreinvite=no
tlsbindaddr=[::]:5061
rtpkeepalive=0
videosupport=no
defaultexpiry=120
notifyringing=yes
maxcallbitrate=384
rtpholdtimeout=300
g726nonstandard=no
registertimeout=20
tlsclientmethod=tlsv1
registerattempts=0
nat=force_rport,comedia
ALLOW_SIP_ANON=no
udpbindaddr=0.0.0.0:5060
tlscafile=/etc/pki/tls/certs/ca-bundle.crt
externip=тут "белый" адрес
localnet=192.168.0.0/24
accept_outofcall_message=yes
auth_message_requests=no
outofcall_message_context=dpma_message_context


my.cnf
Код: выделить все
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
user=mysql
max_connections=250
port=3306

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d


В чем может быть причина такого поведения? Дело всё же в маршрутизаторе, в упущенных мною конфигах сервера или вовсе на стороне провайдера?
fckurethn
 
Сообщений: 4
Зарегистрирован: 10 окт 2020, 19:42

Re: После обновления сервера стали недоступными AMI и MySQL

Сообщение sergio » 13 окт 2020, 22:41

Покажи вывод:
# ip route
Покажи вывод:
# cat /var/lib/iptables/rules-save
Покажи вывод сканирования nmap`ом снаружи
Покажи вывод mysql:
# use mysql;
# select host,user from user;
sergio
 
Сообщений: 58
Зарегистрирован: 09 сен 2014, 12:13

Re: После обновления сервера стали недоступными AMI и MySQL

Сообщение ded » 14 окт 2020, 00:09

sergio писал(а):Покажи вывод сканирования nmap`ом снаружи
fckurethn писал(а):Проброс портов на маршрутизаторе осуществлён, но сканирование его nmap показывает, что проброшенные порты не слушает.
ded
 
Сообщений: 15828
Зарегистрирован: 26 авг 2010, 19:00

Re: После обновления сервера стали недоступными AMI и MySQL

Сообщение sergio » 14 окт 2020, 01:38

ded
Не убедительно как-то читается.
Если внутри LAN конектится, а снаружи нет, значит тому есть причины:
1 отсутствует маршрутизация
2 не настроен проброс
3 блокирует фаервол маршрутизатора
4 блокирует фаервол узла
5 что-то еще

fckurethn
tcpdump тебе в помощь.
sergio
 
Сообщений: 58
Зарегистрирован: 09 сен 2014, 12:13

Re: После обновления сервера стали недоступными AMI и MySQL

Сообщение fckurethn » 14 окт 2020, 18:06

sergio писал(а):Покажи вывод:
# ip route
Покажи вывод:
# cat /var/lib/iptables/rules-save
Покажи вывод сканирования nmap`ом снаружи
Покажи вывод mysql:
# use mysql;
# select host,user from user;


ip route
[spioler=][root@freepbx ~]# ip route
default via 192.168.0.1 dev eth0
169.254.0.0/16 dev eth0 scope link metric 1002
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.90 [/spoiler]

nmap
[spioler=]Host is up (0.012s latency).
Not shown: 992 closed ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
23/tcp open telnet
80/tcp open http
1900/tcp open upnp
3333/tcp open dec-notes
8080/tcp open http-proxy
20005/tcp open btx

Nmap done: 1 IP address (1 host up) scanned in 2.34 seconds[/spoiler]

iptables
[Показать] Спойлер:
Chain INPUT (policy ACCEPT)
target prot opt source destination
fail2ban-recidive all -- anywhere anywhere
fail2ban-BadBots tcp -- anywhere anywhere multiport dports http,https
fail2ban-FTP tcp -- anywhere anywhere multiport dports ftp
fail2ban-apache-auth all -- anywhere anywhere
fail2ban-SSH tcp -- anywhere anywhere multiport dports ssh
fail2ban-SIP all -- anywhere anywhere
fail2ban-SIP all -- anywhere anywhere
fpbxfirewall all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT) address (1 host up) scanned in 2.34 seconds
[randomname@rndmcmp ~]$ history | grep scp
82 sudo scp root@37.46.245.125:/root/pasv.pcap /home/randomname
354 scp root@192.168.0.90:/root/fraud.pcap /home/randomname
364 scp root@192.168.0.90:/root/crmblyat.pcap /home/randomname
423 history | grep scp
[randomname@rndmcmp ~]$ cp root@192.168.0.90:/root/crmblyat.pcap /home/randomname
cp: не удалось выполнить stat для 'root@192.168.0.90:/root/crmblyat.pcap': Нет такого файла или каталога
[randomname@rndmcmp ~]$ scp root@192.168.0.90:/root/iptables /home/randomname
root@192.168.0.90's password:

target prot opt source destination

Chain fail2ban-BadBots (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Chain fail2ban-FTP (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Chain fail2ban-SIP (2 references)
target prot opt source destination
REJECT all -- 45.143.221.124 anywhere reject-with icmp-port-unreachable
REJECT all -- host-200-74-240-92.ccipanama.com anywhere reject-with icmp-port-unreachable
REJECT all -- 51-158-23-171.rev.poneytelecom.eu anywhere reject-with icmp-port-unreachable
REJECT all -- str-arn102.strongconnectivity.com anywhere reject-with icmp-port-unreachable
REJECT all -- 45.143.220.87 anywhere reject-with icmp-port-unreachable
REJECT all -- 103.145.13.55 anywhere reject-with icmp-port-unreachable
REJECT all -- 103.145.13.133 anywhere reject-with icmp-port-unreachable
REJECT all -- ns3181732.ip-46-105-107.eu anywhere reject-with icmp-port-unreachable
REJECT all -- 179.43.171.186 anywhere reject-with icmp-port-unreachable
REJECT all -- 130.234-151-104.rdns.scalabledns.com anywhere reject-with icmp-port-unreachable
REJECT all -- 20.51.190.76 anywhere reject-with icmp-port-unreachable
REJECT all -- 179.43.171.190 anywhere reject-with icmp-port-unreachable
REJECT all -- 37.49.230.126 anywhere reject-with icmp-port-unreachable
REJECT all -- 46.101.16.118 anywhere reject-with icmp-port-unreachable
REJECT all -- 103.145.13.203 anywhere reject-with icmp-port-unreachable
REJECT all -- 156.96.156.37 anywhere reject-with icmp-port-unreachable
REJECT all -- ec2-35-154-14-95.ap-south-1.compute.amazonaws.com anywhere reject-with icmp-port-unreachable
REJECT all -- 103.145.13.124 anywhere reject-with icmp-port-unreachable
REJECT all -- 103.145.12.228 anywhere reject-with icmp-port-unreachable
REJECT all -- 45.148.121.89 anywhere reject-with icmp-port-unreachable
REJECT all -- shdgi-switzerlandnorth17.switzerlandnorth.cloudapp.azure.com anywhere reject-with icmp-port-unreachable
RETURN all -- anywhere anywhere
RETURN all -- anywhere anywhere

Chain fail2ban-SSH (1 references)
target prot opt source destination
REJECT all -- dynamic-ip-adsl.viettel.vn anywhere reject-with icmp-port-unreachable
REJECT all -- 45.148.10.28 anywhere reject-with icmp-port-unreachable
REJECT all -- 159.203.189.250 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.158 anywhere reject-with icmp-port-unreachable
REJECT all -- mika.bhost.kz anywhere reject-with icmp-port-unreachable
REJECT all -- 118.24.100.198 anywhere reject-with icmp-port-unreachable
REJECT all -- no-data anywhere reject-with icmp-port-unreachable
REJECT all -- 118.24.114.205 anywhere reject-with icmp-port-unreachable
REJECT all -- 99-96-122-99.lightspeed.gnvlsc.sbcglobal.net anywhere reject-with icmp-port-unreachable
REJECT all -- 106.12.60.40 anywhere reject-with icmp-port-unreachable
REJECT all -- 103.130.209.251 anywhere reject-with icmp-port-unreachable
REJECT all -- mrtg-dcpl.dvois.com anywhere reject-with icmp-port-unreachable
REJECT all -- 024-216-030-138.res.spectrum.com anywhere reject-with icmp-port-unreachable
REJECT all -- 075-141-236-211.res.spectrum.com anywhere reject-with icmp-port-unreachable
REJECT all -- NK210-202-110-175.adsl.static.apol.com.tw anywhere reject-with icmp-port-unreachable
REJECT all -- 134.175.236.187 anywhere reject-with icmp-port-unreachable
REJECT all -- 187-162-61-184.static.axtel.net anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.96 anywhere reject-with icmp-port-unreachable
REJECT all -- 45.141.156.14 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.13 anywhere reject-with icmp-port-unreachable
REJECT all -- 183.100.236.215 anywhere reject-with icmp-port-unreachable
REJECT all -- 119.45.33.80 anywhere reject-with icmp-port-unreachable
REJECT all -- 106.75.11.53 anywhere reject-with icmp-port-unreachable
REJECT all -- 69.167.152.53 anywhere reject-with icmp-port-unreachable
REJECT all -- 43.229.55.61 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.93.17.110 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.138 anywhere reject-with icmp-port-unreachable
REJECT all -- 106.52.55.146 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.145 anywhere reject-with icmp-port-unreachable
REJECT all -- 61.177.172.107 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.184 anywhere reject-with icmp-port-unreachable
REJECT all -- 50-80-239-41.client.mchsi.com anywhere reject-with icmp-port-unreachable
REJECT all -- 186-226-37-125.interline.net.br anywhere reject-with icmp-port-unreachable
REJECT all -- 123.126.40.29 anywhere reject-with icmp-port-unreachable
REJECT all -- 114.67.202.170 anywhere reject-with icmp-port-unreachable
REJECT all -- 178.128.148.98 anywhere reject-with icmp-port-unreachable
REJECT all -- 49.235.28.96 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.120 anywhere reject-with icmp-port-unreachable
REJECT all -- 122.194.229.122 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.175 anywhere reject-with icmp-port-unreachable
REJECT all -- 128.187.26.211.sta.commander.net.au anywhere reject-with icmp-port-unreachable
REJECT all -- 120.92.151.17 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.172 anywhere reject-with icmp-port-unreachable
REJECT all -- 207.154.194.3 anywhere reject-with icmp-port-unreachable
REJECT all -- airywork.com anywhere reject-with icmp-port-unreachable
REJECT all -- . anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.185 anywhere reject-with icmp-port-unreachable
REJECT all -- dynamic-ip-adsl.viettel.vn anywhere reject-with icmp-port-unreachable
REJECT all -- kernel.panic.or.jp anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.53 anywhere reject-with icmp-port-unreachable
REJECT all -- 128.199.141.33 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.196 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.246 anywhere reject-with icmp-port-unreachable
REJECT all -- 119.96.120.113 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.247 anywhere reject-with icmp-port-unreachable
REJECT all -- 103.253.145.89 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.30.35 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.122 anywhere reject-with icmp-port-unreachable
REJECT all -- 61.177.172.142 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.31.83 anywhere reject-with icmp-port-unreachable
REJECT all -- 104.131.131.140 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.249 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.200 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.223 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.133 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.190 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.230 anywhere reject-with icmp-port-unreachable
REJECT all -- 61.177.172.61 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.174 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.15.62 anywhere reject-with icmp-port-unreachable
REJECT all -- static-250-171-128-190.telecel.com.py anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.168 anywhere reject-with icmp-port-unreachable
REJECT all -- 61.177.172.104 anywhere reject-with icmp-port-unreachable
REJECT all -- 113.62.180.146 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.173 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.30.57 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.42.57 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.248 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.30.112 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.184 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.42.7 anywhere reject-with icmp-port-unreachable
REJECT all -- 61.177.172.168 anywhere reject-with icmp-port-unreachable
REJECT all -- 129.146.81.43 anywhere reject-with icmp-port-unreachable
REJECT all -- 61.177.172.54 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.81 anywhere reject-with icmp-port-unreachable
REJECT all -- 61.177.172.177 anywhere reject-with icmp-port-unreachable
REJECT all -- 122.194.229.37 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.165 anywhere reject-with icmp-port-unreachable
REJECT all -- 61.177.172.128 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.31.166 anywhere reject-with icmp-port-unreachable
REJECT all -- 122.194.229.59 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.42.137 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.119 anywhere reject-with icmp-port-unreachable
REJECT all -- 122.194.229.54 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.176 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.183 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.181 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.151 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.176 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.180.130 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.231 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.85 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.173 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.251 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.180 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.15.115 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.110 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.250 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.30.76 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.112 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.47 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.42.155 anywhere reject-with icmp-port-unreachable
REJECT all -- 222.186.42.213 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.194 anywhere reject-with icmp-port-unreachable
REJECT all -- 112.85.42.98 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.172 anywhere reject-with icmp-port-unreachable
REJECT all -- 218.92.0.171 anywhere reject-with icmp-port-unreachable
RETURN all -- anywhere anywhere

Chain fail2ban-apache-auth (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Chain fail2ban-recidive (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Chain fpbx-rtp (1 references)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpts:ndmp:dnp
ACCEPT udp -- anywhere anywhere udp dpts:terabase:hfcs-manager

Chain fpbxattacker (6 references)
target prot opt source destination
all -- anywhere anywhere recent: SET name: ATTACKER side: source mask: 255.255.255.255
DROP all -- anywhere anywhere

Chain fpbxblacklist (1 references)
target prot opt source destination

Chain fpbxfirewall (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere connmark match ! 0x20 state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere 255.255.255.255
ACCEPT all -- anywhere anywhere PKTTYPE = multicast
ACCEPT udp -- anywhere anywhere udp spts:bootps:bootpc dpts:bootps:bootpc
fpbx-rtp all -- anywhere anywhere
fpbxblacklist all -- anywhere anywhere
fpbxsignalling all -- anywhere anywhere
fpbxsmarthosts all -- anywhere anywhere
fpbxregistrations all -- anywhere anywhere
fpbxnets all -- anywhere anywhere
fpbxhosts all -- anywhere anywhere
fpbxinterfaces all -- anywhere anywhere
fpbxreject all -- anywhere anywhere
fpbxrfw all -- anywhere anywhere mark match 0x2/0x2
ACCEPT udp -- anywhere anywhere state RELATED,ESTABLISHED
lefilter tcp -- anywhere anywhere match-set lefilter dst
fpbxlogdrop all -- anywhere anywhere

Chain fpbxhosts (1 references)
target prot opt source destination
zone-trusted all -- localhost anywhere

Chain fpbxinterfaces (1 references)
target prot opt source destination
zone-internal all -- anywhere anywhere

Chain fpbxknownreg (5 references)
target prot opt source destination
all -- anywhere anywhere recent: REMOVE name: REPEAT side: source mask: 255.255.255.255
all -- anywhere anywhere recent: REMOVE name: ATTACKER side: source mask: 255.255.255.255
MARK all -- anywhere anywhere MARK or 0x4
ACCEPT all -- anywhere anywhere mark match 0x1/0x1
fpbxsvc-ucp all -- anywhere anywhere
fpbxsvc-zulu all -- anywhere anywhere
fpbxsvc-restapps all -- anywhere anywhere
fpbxsvc-restapps_ssl all -- anywhere anywhere
fpbxsvc-provis all -- anywhere anywhere
fpbxsvc-provis_ssl all -- anywhere anywhere

Chain fpbxlogdrop (1 references)
target prot opt source destination
DROP all -- anywhere anywhere

Chain fpbxnets (1 references)
target prot opt source destination
zone-trusted all -- 192.168.0.104 anywhere
zone-trusted all -- 192.168.0.0/24 anywhere

Chain fpbxratelimit (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere mark match 0x4/0x4
ACCEPT all -- anywhere anywhere recent: CHECK seconds: 90 hit_count: 1 name: WHITELIST side: source mask: 255.255.255.255
all -- anywhere anywhere state NEW recent: SET name: REPEAT side: source mask: 255.255.255.255
all -- anywhere anywhere state NEW recent: SET name: DISCOVERED side: source mask: 255.255.255.255
LOG all -- anywhere anywhere LOG level warning
fpbxattacker all -- anywhere anywhere recent: CHECK seconds: 86400 hit_count: 1 name: ATTACKER side: source mask: 255.255.255.255
fpbxattacker all -- anywhere anywhere recent: CHECK seconds: 86400 hit_count: 200 name: REPEAT side: source mask: 255.255.255.255
fpbxattacker all -- anywhere anywhere recent: CHECK seconds: 300 hit_count: 100 name: REPEAT side: source mask: 255.255.255.255
fpbxshortblock all -- anywhere anywhere recent: CHECK seconds: 60 hit_count: 50 name: REPEAT side: source mask: 255.255.255.255
ACCEPT all -- anywhere anywhere

Chain fpbxregistrations (1 references)
target prot opt source destination
fpbxknownreg all -- 195.128.182.62 anywhere
fpbxknownreg all -- 31.135.152.35 anywhere
fpbxknownreg all -- 18024.pavlabor.net anywhere
fpbxknownreg all -- 192.168.0.103 anywhere
fpbxknownreg all -- 192.168.0.102 anywhere

Chain fpbxreject (1 references)
target prot opt source destination
rejsvc-nfs all -- anywhere anywhere
rejsvc-smb all -- anywhere anywhere

Chain fpbxrfw (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere recent: CHECK seconds: 90 hit_count: 1 name: WHITELIST side: source mask: 255.255.255.255
all -- anywhere anywhere recent: SET name: REPEAT side: source mask: 255.255.255.255
all -- anywhere anywhere recent: SET name: DISCOVERED side: source mask: 255.255.255.255
fpbxattacker all -- anywhere anywhere recent: CHECK seconds: 10 hit_count: 50 name: REPEAT side: source mask: 255.255.255.255
fpbxattacker all -- anywhere anywhere recent: CHECK seconds: 86400 hit_count: 1 name: ATTACKER side: source mask: 255.255.255.255
fpbxshortblock all -- anywhere anywhere recent: CHECK seconds: 60 hit_count: 10 name: SIGNALLING side: source mask: 255.255.255.255
all -- anywhere anywhere recent: SET name: SIGNALLING side: source mask: 255.255.255.255
fpbxattacker all -- anywhere anywhere recent: CHECK seconds: 86400 hit_count: 100 name: REPEAT side: source mask: 255.255.255.255
ACCEPT all -- anywhere anywhere

Chain fpbxshortblock (2 references)
target prot opt source destination
all -- anywhere anywhere recent: SET name: CLAMPED side: source mask: 255.255.255.255
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

Chain fpbxsignalling (1 references)
target prot opt source destination
MARK udp -- anywhere anywhere udp dpt:sip MARK set 0x1

Chain fpbxsmarthosts (1 references)
target prot opt source destination
ACCEPT all -- 195.128.182.62 anywhere mark match 0x1/0x1
ACCEPT all -- 192.168.0.0/24 anywhere mark match 0x1/0x1

Chain fpbxsvc-chansip (1 references)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:sip

Chain fpbxsvc-ftp (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp

Chain fpbxsvc-http (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:http

Chain fpbxsvc-https (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:https

Chain fpbxsvc-iax (1 references)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:iax

Chain fpbxsvc-isymphony (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:58080
ACCEPT tcp -- anywhere anywhere tcp dpt:55050

Chain fpbxsvc-letsencrypt (0 references)
target prot opt source destination

Chain fpbxsvc-nfs (0 references)
target prot opt source destination

Chain fpbxsvc-pjsip (1 references)
target prot opt source destination

Chain fpbxsvc-provis (3 references)
target prot opt source destination
fpbxratelimit tcp -- anywhere anywhere tcp dpt:ctf

Chain fpbxsvc-provis_ssl (3 references)
target prot opt source destination

Chain fpbxsvc-restapps (2 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:kerberos

Chain fpbxsvc-restapps_ssl (2 references)
target prot opt source destination

Chain fpbxsvc-smb (0 references)
target prot opt source destination

Chain fpbxsvc-ssh (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh

Chain fpbxsvc-tftp (1 references)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:tftp

Chain fpbxsvc-ucp (4 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:81
ACCEPT tcp -- anywhere anywhere tcp dpt:vcom-tunnel
ACCEPT tcp -- anywhere anywhere tcp dpt:mcreport

Chain fpbxsvc-vpn (3 references)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:openvpn

Chain fpbxsvc-webrtc (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:radan-http
ACCEPT tcp -- anywhere anywhere tcp dpt:8089

Chain fpbxsvc-xmpp (3 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:xmpp-client

Chain fpbxsvc-zulu (4 references)
target prot opt source destination

Chain lefilter (1 references)
target prot opt source destination
CONNMARK all -- anywhere anywhere state NEW CONNMARK set 0x20
ACCEPT all -- anywhere anywhere state NEW
ACCEPT all -- anywhere anywhere STRING match "GET /.well-known/acme-challenge/" ALGO name kmp FROM 52 TO 53
ACCEPT all -- anywhere anywhere STRING match "GET /.freepbx-known/" ALGO name kmp FROM 52 TO 53
RETURN all -- anywhere anywhere

Chain rejsvc-nfs (1 references)
target prot opt source destination

Chain rejsvc-smb (1 references)
target prot opt source destination

Chain zone-external (0 references)
target prot opt source destination
MARK all -- anywhere anywhere MARK or 0x10
fpbxsvc-ucp all -- anywhere anywhere
fpbxsvc-zulu all -- anywhere anywhere
fpbxsvc-vpn all -- anywhere anywhere
fpbxsvc-xmpp all -- anywhere anywhere

Chain zone-internal (1 references)
target prot opt source destination
MARK all -- anywhere anywhere MARK or 0x4
fpbxsvc-ssh all -- anywhere anywhere
fpbxsvc-http all -- anywhere anywhere
fpbxsvc-https all -- anywhere anywhere
fpbxsvc-ucp all -- anywhere anywhere
fpbxsvc-pjsip all -- anywhere anywhere
fpbxsvc-chansip all -- anywhere anywhere
fpbxsvc-iax all -- anywhere anywhere
fpbxsvc-webrtc all -- anywhere anywhere
fpbxsvc-zulu all -- anywhere anywhere
fpbxsvc-isymphony all -- anywhere anywhere
fpbxsvc-provis all -- anywhere anywhere
fpbxsvc-provis_ssl all -- anywhere anywhere
fpbxsvc-vpn all -- anywhere anywhere
fpbxsvc-restapps all -- anywhere anywhere
fpbxsvc-restapps_ssl all -- anywhere anywhere
fpbxsvc-xmpp all -- anywhere anywhere
fpbxsvc-ftp all -- anywhere anywhere
fpbxsvc-tftp all -- anywhere anywhere

Chain zone-other (0 references)
target prot opt source destination
MARK all -- anywhere anywhere MARK or 0x8
fpbxsvc-ucp all -- anywhere anywhere
fpbxsvc-zulu all -- anywhere anywhere
fpbxsvc-provis all -- anywhere anywhere
fpbxsvc-provis_ssl all -- anywhere anywhere
fpbxsvc-vpn all -- anywhere anywhere
fpbxsvc-xmpp all -- anywhere anywhere

Chain zone-trusted (3 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere


mysql
[Показать] Спойлер:
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | extuser |
| % | freepbxuser |
| % | freepbxuser@% |
| % | root |
| % | vetmgr | ;;;;; вот непосредственно этот пользователь и пытается стучаться на сервер снаружи
| 127.0.0.1 | root |
| ::1 | root |
| localhost | |
| localhost | freepbxuser |
| localhost | root |
| localhost | userkalkun |
| localhost | vetmgr |
+-----------+---------------+
fckurethn
 
Сообщений: 4
Зарегистрирован: 10 окт 2020, 19:42

Re: После обновления сервера стали недоступными AMI и MySQL

Сообщение fckurethn » 14 окт 2020, 18:42

К слову, о tcpdump. Помедитировал над дампом и заметил ретрансмиссию по mysql. А 5038 даже не пытался дёргаться (пинок в сторону AMI, подключение к которому даже из внутренней сети невозможно). Далее там пошел диалог по FTP.
Изображение

Любопытно, что при добавлении нижеприведенных правил, болячка осталась
[Показать] Спойлер:
[root@freepbx ~]# iptables -t filter -A INPUT -p tcp --dport 5038 -j ACCEPT
[root@freepbx ~]# iptables -t filter -A INPUT -p tcp --dport 3306 -j ACCEPT
[root@freepbx ~]# iptables -t filter -A OUTPUT -p tcp --sport 3306 -j ACCEPT
[root@freepbx ~]# iptables -t filter -A OUTPUT -p tcp --sport 5038 -j ACCEPT


Ну и в догонку, ss:
Код: выделить все
[root@freepbx ~]# ss -tlpn | grep 3306
LISTEN     0      50           *:3306                     *:*                   users:(("mysqld",pid=1697,fd=14))
[root@freepbx ~]# ss -tlpn | grep 5038
LISTEN     0      10           *:5038                     *:*                   users:(("asterisk",pid=2246,fd=12))
fckurethn
 
Сообщений: 4
Зарегистрирован: 10 окт 2020, 19:42

Re: После обновления сервера стали недоступными AMI и MySQL

Сообщение sergio » 15 окт 2020, 01:58

Маршрутизация - норм. Хотя 169.254.0.0/16 я бы убрал, но эт придирки.
СУБД - норм, должно пускать, из локальной сети пробовал туда подключаться?
nmap по конкретным проблемным портам(5038 и 3306) бы следовало сделать, их же не видно в выводе.

fckurethn про iptables и fail2ban я так понимаю это некие штатные правила которые идут с дистрибутивом. Адреса твоего CRM нет в бане?
Кстати не хватает цепочки prerouting, там тоже может оказаться что-либо интересное
Код: выделить все
# iptables -L PREROUTING -t nat -n


Любопытно, что при добавлении нижеприведенных правил, болячка осталась
[root@freepbx ~]# iptables -t filter -A INPUT -p tcp --dport 5038 -j ACCEPT
[root@freepbx ~]# iptables -t filter -A INPUT -p tcp --dport 3306 -j ACCEPT
...

При таком варианте вновь добавленные правила будут добавляться в самый низ, что бессмысленно, так как политика в цепочке INPUT - ACCEPT, а это означает что если пакет пройдет все правила fail2ban то его и так пропустят.
Сделай insert и оно добавится первым:
Код: выделить все
# iptables -t filter -I INPUT -p tcp --dport 5038 -j ACCEPT
# iptables -t filter -I INPUT -p tcp --dport 3306 -j ACCEPT

Цепочку OUTPUT можешь не трогать, её настройка редко требуется и политика почти всегда ACCEPT.
Можно еще логгирование добавить чтоб убедится наверняка поступает пакет сквозь маршрутизатор или нет(логгирующее правило соответственно должно быть выше ACCEPTа, логи вероятнее всего в /var/log/messages смотри настройки логгера):
Код: выделить все
# iptables -t filter -I INPUT -p tcp --dport 5038 -j LOG
# iptables -t filter -I INPUT -p tcp --dport 3306 -j LOG

Вообще для своей CRM можно было бы и исключение добавить по ip, оно ведь наверняка статический адрес имеет, остальным закрыть.

fckurethn писал(а):пинок в сторону AMI, подключение к которому даже из внутренней сети невозможно

Как же нет? в первом посте был код где телнетом подключался, но тебя не пустили по неправильному логин/паролю, но tcp соединение то было.
[randomname@rndmcmp ~]$ telnet 192.168.0.90 5038
Trying 192.168.0.90...
Connected to 192.168.0.90.
Escape character is '^]'.
Asterisk Call Manager/5.0.2
Action: Login

Response: Error
Message: Authentication failed

Connection closed by foreign host.
sergio
 
Сообщений: 58
Зарегистрирован: 09 сен 2014, 12:13

Re: После обновления сервера стали недоступными AMI и MySQL

Сообщение ded » 15 окт 2020, 08:17

Любопытно, что при добавлении нижеприведенных правил, болячка осталась
[root@freepbx ~]# iptables -t filter -A INPUT -p tcp --dport 5038 -j ACCEPT
[root@freepbx ~]# iptables -t filter -A INPUT -p tcp --dport 3306 -j ACCEPT
Эти доступы не тут регулируется. Можете легко проверить - для теста остановить iptables и послушать
tcpdump port 5038 or 3306.
Доступ к AMI регулируется в /etc/asterisk/manager.conf
а доступ к MySQL в самом MySQL (Google >> How To Allow Remote Access to MySQL)
fckurethn писал(а):пинок в сторону AMI, подключение к которому даже из внутренней сети невозможно

sergio писал(а):Как же нет? в первом посте был код где телнетом подключался, но тебя не пустили по неправильному логин/паролю, но tcp соединение то было.
Он подключался локально, на том же сервере, 127.0.0.1 разрешён как раз для управления Астериском, из FreePBX например.
В CLI> успешное подключение отображается при этом строчками User login successful.
ded
 
Сообщений: 15828
Зарегистрирован: 26 авг 2010, 19:00

Re: После обновления сервера стали недоступными AMI и MySQL

Сообщение sergio » 15 окт 2020, 10:24

ded, дык в manager.conf директива deny закомментирована знач доступ не запрещен.
Но в целом да имеет смысл попробовать явно разрешить /etc/asterisk/manager.conf добавить:
Код: выделить все
deny=0.0.0.0/0.0.0.0
permit=[CRM ip]
permit=192.168.0.0/255.255.255.0 ; ну и для локальной сети


ded, по mysql да, тот конфиг что он показал недостаточно, не видно опции bind-address
fckurethn, покажи:
Код: выделить все
# grep -R bind-address /etc/my.cnf.d
sergio
 
Сообщений: 58
Зарегистрирован: 09 сен 2014, 12:13

Re: После обновления сервера стали недоступными AMI и MySQL

Сообщение fckurethn » 16 окт 2020, 17:16

Да, действительно, нужно было всего-то корректно добавить правило.

sergio писал(а):
Код: выделить все
# iptables -t filter -I INPUT -p tcp --dport 5038 -j ACCEPT
# iptables -t filter -I INPUT -p tcp --dport 3306 -j ACCEPT



Огромнейшее спасибо за помощь!
fckurethn
 
Сообщений: 4
Зарегистрирован: 10 окт 2020, 19:42


Вернуться в Конфигурация и настройка Asterisk

Кто сейчас на форуме

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 24

cron
© 2008 — 2024 Asterisk.ru
Digium, Asterisk and AsteriskNOW are registered trademarks of Digium, Inc.
Design and development by PostMet-Netzwerk GmbH