snipt

Ctrl+h for KB shortcuts

Bash

Block MySQL port for everyone except localhost and a single IP

1
2
3
iptables -A INPUT -i lo -p tcp --dport mysql -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport mysql -s 123.123.123.123 -j ACCEPT
iptables -A INPUT -p tcp --dport mysql -j DROP
https://snipt.net/embed/ece3362f17246adf5af553c7ccaca042/
/raw/ece3362f17246adf5af553c7ccaca042/
ece3362f17246adf5af553c7ccaca042
bash
Bash
3
2019-05-25T07:01:46
True
False
False
/api/public/snipt/33768/
block-mysql-port-for-everyone-except-localhost-and-a-single-ip
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>iptables -A INPUT -i lo -p tcp --dport mysql -j ACCEPT </span><span id="L-2"><a name="L-2"></a>iptables -A INPUT -i eth0 -p tcp --dport mysql -s 123.123.123.123 -j ACCEPT </span><span id="L-3"><a name="L-3"></a>iptables -A INPUT -p tcp --dport mysql -j DROP </span></pre></div> </td></tr></table>
3306, bash, iptables, mysql, server