Hello,
I'm trying to secure my laptop. First I have configured pf :
/etc/rc.conf
/etc/pf.conf
Now to avoid scan port, I have installed and configured portsentry :
I have added the table antiscan and one rule in the /etc/pf.conf as you can see above.
I have edited the file /usr/local/etc/portsentry.conf
And now the content of /usr/local/etc/portsentry.ignore
I have launched portsentry :
Now if I try to scan the ports of my laptop with an other computer, first the output of nmap show opened port (!) and secondly his ip was not insert in the antiscan table :
Could you explain me what's wrong ? The problem is the same with fail2ban (I will add fail2ban config file if necessary).
I'm trying to secure my laptop. First I have configured pf :
/etc/rc.conf
Code:
pf_enable="YES"
pf_rules="/etc/pf.conf"
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
/etc/pf.conf
Code:
ext_if="{wlan0,alc0}"
ext_services="{22}"
int_services="{25,80,139,445,631,3306}"
# Déclaration du tableau référençant toutes les adresses IP affectées au
# pare-feu.
table <firewall> const { self }
# Mesure contre certain type d'attaques
scrub in all
# Ne pas filtrer sur l'interface de bouclage
set skip on lo0
# Mise en place d'une politique d'interdiction par défaut.
block in all
block return
# Concerve l'état des connexions sortantes
pass out keep state
# Activation de la protection contre l'usurpation sur toutes les
# interfaces.
block in quick from urpf-failed
antispoof log for $ext_if
#On autorise l'accès extérieur pour les services suivants :
pass in on $ext_if proto {tcp,udp} from any to any port $ext_services
#Blocage des ip contenu dans la table antiscan (mis à jour par portsentry)
table <antiscan> persist
block in quick from <antiscan>
#Blocage des ip contenu dans la table fail2ban (mis à jour par fail2ban)
table <fail2ban> persist
block in on $ext_if from <fail2ban>
# pfctl -f /etc/pf.conf
Code:
No ALTQ support in kernel
ALTQ related functions disabled
Now to avoid scan port, I have installed and configured portsentry :
I have added the table antiscan and one rule in the /etc/pf.conf as you can see above.
I have edited the file /usr/local/etc/portsentry.conf
Code:
TCP_PORTS="1,11,15,79,111,119,143,540,635,1080,1524,2000,5742,6667,12345,12346,20034,27665,31337,32771,32772,32773,32774,40421
UDP_PORTS="1,7,9,69,161,162,513,635,640,641,700,37444,34555,31335,32770,32771,32772,32773,32774,31337,54321"
ADVANCED_PORTS_TCP="1024"
ADVANCED_PORTS_UDP="1024"
ADVANCED_EXCLUDE_TCP="113,139"
ADVANCED_EXCLUDE_UDP="520,138,137,67"
# Hosts to ignore
IGNORE_FILE="/usr/local/etc/portsentry.ignore"
# Hosts that have been denied (running history)
HISTORY_FILE="/usr/local/etc/portsentry.history"
# Hosts that have been denied this session only (temporary until next restart)
BLOCKED_FILE="/usr/local/etc/portsentry.blocked"
RESOLVE_HOST = "1"
BLOCK_UDP="1"
BLOCK_TCP="1"
KILL_ROUTE="/sbin/pfctl -t antiscan -T add $TARGET$"
SCAN_TRIGGER="0"
And now the content of /usr/local/etc/portsentry.ignore
Code:
127.0.0.1/32
0.0.0.0
I have launched portsentry :
# porsentry -tcp && portsentry -udp
Now if I try to scan the ports of my laptop with an other computer, first the output of nmap show opened port (!) and secondly his ip was not insert in the antiscan table :
# pfctl -t antiscan -T show
Code:
No ALTQ support in kernel
ALTQ related functions disabled
Could you explain me what's wrong ? The problem is the same with fail2ban (I will add fail2ban config file if necessary).