Restricting MySQL 3306 port to localhost with IPTABLES

后端 未结 3 1216
后悔当初
后悔当初 2021-02-01 10:22

I am trying to restrict MySQL 3306 port on a linux machine from making any connections to anything other than localhost to prevent outside attacks. i have the following code, i

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-01 10:55

    iptables -A INPUT -p tcp --dport 3306 -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
    

    The above rule is for converting two lines into single one.

    Answer to your second question:

    If you do not want to provide mysql access from other than localhost, then it is perfect to configure this way. Simple. :-)

提交回复
热议问题