Thursday, January 3, 2019

MariaDB server - allow remote

1.buka ip di my.cnf
/etc/mysql/my.cnf

bind-address = 0.0.0.0

2.buka ip di database mysql:
mysql -u root -p

terus:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

3.block semua kecuali app-server-nya (contoh):
## Block all connections to 3306 except for three ips##
/sbin/iptables -A INPUT -p tcp --dport 3306 ! -s 202.54.1.2 -j DROP
/sbin/iptables -A INPUT -p tcp --dport 3306 ! -s 202.54.1.10 -j DROP
/sbin/iptables -A INPUT -p tcp --dport 3306 ! -s 202.54.1.15 -j DROP
 
 
4.save ip tables nya
install dulu
 
apt-get install iptables-persistent 
 
Debian/Ubuntu: 
iptables-save > /etc/iptables/rules.v4
 
 
5.reboot
6.cek konek dari Indo dan app-server
7.selesai 

No comments:

Post a Comment