Mostafa Hussein <mostafa.hussein91@gmail.com>
new
Linux
Add an rule to csf allowed hosts
See _access_rule()
.
1- Add an IP:
CLI Example:
salt '*' csf.allow 127.0.0.1
salt '*' csf.allow 127.0.0.1 comment="Allow localhost"
Like allow_ports, but it will append to the existing entry instead of replacing it. Takes a single port instead of a list of ports.
CLI Example:
salt '*' csf.allow_port 22 proto='tcp' direction='in'
Fully replace the incoming or outgoing ports line in the csf.conf file - e.g. TCP_IN, TCP_OUT, UDP_IN, UDP_OUT, etc.
CLI Example:
salt '*' csf.allow_ports ports="[22,80,443,4505,4506]" proto='tcp' direction='in'
Add an rule to csf denied hosts
See _access_rule()
.
1- Deny an IP:
CLI Example:
salt '*' csf.deny 127.0.0.1
salt '*' csf.deny 127.0.0.1 comment="Too localhosty"
Disable csf permanently
CLI Example:
salt '*' csf.disable
Activate csf if not running
CLI Example:
salt '*' csf.enable
Returns true a rule for the ip already exists based on the method supplied. Returns false if not found.
CLI Example:
salt '*' csf.exists allow 1.2.3.4
salt '*' csf.exists tempdeny 1.2.3.4
Lists ports from csf.conf based on direction and protocol. e.g. - TCP_IN, TCP_OUT, UDP_IN, UDP_OUT, etc..
CLI Example:
salt '*' csf.allow_port 22 proto='tcp' direction='in'
Restart csf
CLI Example:
salt '*' csf.reload
Check csf status
CLI Example:
salt '*' csf.running
Add an rule to the temporary ip allow list.
See _access_rule()
.
1- Add an IP:
CLI Example:
salt '*' csf.tempallow 127.0.0.1 3600 port=22 direction='in' comment='# Temp dev ssh access'
Add a rule to the temporary ip deny list.
See _access_rule()
.
1- Add an IP:
CLI Example:
salt '*' csf.tempdeny 127.0.0.1 300 port=22 direction='in' comment='# Brute force attempt'
Remove a rule from the csf denied hosts
See _access_rule()
.
1- Deny an IP:
CLI Example:
salt '*' csf.unallow 127.0.0.1
Remove a rule from the csf denied hosts
See _access_rule()
.
1- Deny an IP:
CLI Example:
salt '*' csf.undeny 127.0.0.1