I've installed CSF-LFD as described here. in
/etc/csf/csf.conf You have these two code blocks:
# Allow incoming TCP ports TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,2077,2078,2079,2080,2082,2083,2086,2087,2095,2096" # Allow outgoing TCP ports TCP_OUT = "20,21,22,25,37,43,53,80,110,113,443,587,873,993,995,2086,2087,2089,2703"
I need both port groups to be changed just to
"22, 80, 443, 9000" to make sure my Nginx server environment allows incoming data only from these ports.
What's the best, safest way to do that with
I think that this is a good way:
sed -i 's/^TCP_IN = .*/TCP_IN = "22, 80, 443, 9000"/' /etc/csf/csf.conf sed -i 's/^TCP_OUT = .*/TCP_OUT = "22, 80, 443, 9000"/' /etc/csf/csf.conf
csf.conf is a huge file and might have huge potential for changes, there might be a tiny better way.