Pages : 1
#1 Le 17/05/2017, à 12:15
- drsky
iptables et disque dur freebox
Bonjour, j'ai une freebox V6 et j'utilise le disque dur pour partager des fichiers entre mon pc et mon pc portable. depuis peu j'ai découvert iptables et j'essaye de mettre en place un petit firewall et le problème c'est que quand le firewall est réglé impossible pour moi de monter ma freebox, j'obtiens le message "mount error: could not resolve address for freebox-server.local: Unknown error" j'ai essayé d'ouvrir les ports samba trouver sur le site mais rien.
mon script :
# Réinitialise les règles
sudo iptables -t filter -F
sudo iptables -t filter -X
# Autorise les connexions déjà établies et localhost
sudo iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -t filter -A INPUT -i lo -j ACCEPT
sudo iptables -t filter -A OUTPUT -o lo -j ACCEPT
# ICMP (Ping)
sudo iptables -t filter -A INPUT -p icmp -j ACCEPT
sudo iptables -t filter -A OUTPUT -p icmp -j ACCEPT
# smb et cifs
iptables -t filter -A INPUT -p tcp --dport 135
iptables -t filter -A OUTPUT -p tcp --dport 135
iptables -t filter -A OUTPUT -p udp --dport 135
iptables -t filter -A INPUT -p udp --dport 135
iptables -t filter -A INPUT -p tcp --dport 137
iptables -t filter -A OUTPUT -p tcp --dport 137
iptables -t filter -A OUTPUT -p udp --dport 137
iptables -t filter -A INPUT -p udp --dport 137
iptables -t filter -A OUTPUT -p udp --dport 138
iptables -t filter -A INPUT -p udp --dport 138
iptables -t filter -A INPUT -p tcp --dport 139
iptables -t filter -A OUTPUT -p tcp --dport 139
iptables -t filter -A INPUT -p tcp --dport 445
iptables -t filter -A OUTPUT -p tcp --dport 445
iptables -t filter -A OUTPUT -p udp --dport 445
iptables -t filter -A INPUT -p udp --dport 445
# SSH - exclu
sudo iptables -t filter -A INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -t filter -A OUTPUT -p tcp --dport 22 -j ACCEPT
# DNS
sudo iptables -t filter -A OUTPUT -p tcp --dport 53 -j ACCEPT
sudo iptables -t filter -A OUTPUT -p udp --dport 53 -j ACCEPT
sudo iptables -t filter -A INPUT -p tcp --dport 53 -j ACCEPT
sudo iptables -t filter -A INPUT -p udp --dport 53 -j ACCEPT
# HTTP
sudo iptables -t filter -A OUTPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -t filter -A INPUT -p tcp --dport 80 -j ACCEPT
#HTTPS
sudo iptables -t filter -A OUTPUT -p tcp --dport 443 -j ACCEPT
sudo iptables -t filter -A INPUT -p tcp --dport 443 -j ACCEPT
# FTP
sudo iptables -t filter -A OUTPUT -p tcp --dport 20:21 -j ACCEPT
sudo iptables -t filter -A INPUT -p tcp --dport 20:21 -j ACCEPT
sudo iptables -t filter -A OUTPUT -p tcp --dport 30442 -j ACCEPT
sudo iptables -t filter -A OUTPUT -p udp --dport 30442 -j ACCEPT
sudo iptables -t filter -A OUTPUT -p tcp --dport 27197 -j ACCEPT
# Mail SMTP
iptables -t filter -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 25 -j ACCEPT
# Mail POP3
iptables -t filter -A INPUT -p tcp --dport 110 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 110 -j ACCEPT
# Mail IMAP
iptables -t filter -A INPUT -p tcp --dport 143 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 143 -j ACCEPT
#openvpn
iptables -t filter -A INPUT -p udp --sport 1194 -j ACCEPT
iptables -t filter -A OUTPUT -p udp --dport 1194 -j ACCEPT
# NTP (horloge du serveur)
sudo iptables -t filter -A OUTPUT -p udp --dport 123 -j ACCEPT
# Accept TUN
iptables -t filter -A INPUT -i tun+ -j ACCEPT
iptables -t filter -A OUTPUT -o tun+ -j ACCEPT
iptables -t filter -A FORWARD -i tun+ -j ACCEPT
# Bloque tout le trafic
sudo iptables -t filter -P INPUT DROP
sudo iptables -t filter -P FORWARD DROP
sudo iptables -t filter -P OUTPUT DROP
Merci d'avance si quelqu'un a une idée
Modération : merci à l'avenir d'utiliser les balises code (explications ici).
Dernière modification par cqfd93 (Le 17/05/2017, à 12:23)
Hors ligne
#2 Le 22/05/2017, à 13:05
- drsky
Re : iptables et disque dur freebox
personne pour une petite piste ?
Hors ligne
#3 Le 23/05/2017, à 16:52
- ikoula
Re : iptables et disque dur freebox
Tu peux nous donner le résultat de la commande ci dessous s'il te plait ça sera plus simple :
#iptables -L
Thomas | Community manager | ikoula Serveurs dédiés, VPS et Cloud Public
Contactez-nous | Suivez-nous sur Twitter | Likez nous sur Facebook
Hors ligne
#4 Le 26/05/2017, à 18:59
- drsky
Re : iptables et disque dur freebox
et voilà le résultat de la commande
-->sudo iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp spts:tcpmux:65000 dpts:8118:9050
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere
tcp -- anywhere anywhere tcp dpt:loc-srv
udp -- anywhere anywhere udp dpt:loc-srv
tcp -- anywhere anywhere tcp dpt:netbios-ns
udp -- anywhere anywhere udp dpt:netbios-ns
udp -- anywhere anywhere udp dpt:netbios-dgm
tcp -- anywhere anywhere tcp dpt:netbios-ssn
tcp -- anywhere anywhere tcp dpt:microsoft-ds
udp -- anywhere anywhere udp dpt:microsoft-ds
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpts:ftp-data:ftp
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
ACCEPT tcp -- anywhere anywhere tcp dpt:imap2
ACCEPT udp -- anywhere anywhere udp spt:openvpn
ACCEPT all -- anywhere anywhere
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere
tcp -- anywhere anywhere tcp dpt:loc-srv
udp -- anywhere anywhere udp dpt:loc-srv
tcp -- anywhere anywhere tcp dpt:netbios-ns
udp -- anywhere anywhere udp dpt:netbios-ns
udp -- anywhere anywhere udp dpt:netbios-dgm
tcp -- anywhere anywhere tcp dpt:netbios-ssn
tcp -- anywhere anywhere tcp dpt:microsoft-ds
udp -- anywhere anywhere udp dpt:microsoft-ds
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpts:ftp-data:ftp
ACCEPT tcp -- anywhere anywhere tcp dpt:30442
ACCEPT udp -- anywhere anywhere udp dpt:30442
ACCEPT tcp -- anywhere anywhere tcp dpt:27197
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
ACCEPT tcp -- anywhere anywhere tcp dpt:imap2
ACCEPT udp -- anywhere anywhere udp dpt:openvpn
ACCEPT udp -- anywhere anywhere udp dpt:ntp
ACCEPT all -- anywhere anywhere
Hors ligne
#5 Le 29/05/2017, à 17:04
- ikoula
Re : iptables et disque dur freebox
Bonjour,
Donc on voit que les ports sont bien ouverts.
Maintenant il faudrait que tu utilises la commande "netstat" quand tu essayes de "monter ta freebox" afin de relever les ports nécessaires et de voir si ils sont dans la liste que donne ta commande "iptables -L".
Si certains n'apparaissent pas il suffira alors de les rajouter à ton script.
Dernière modification par ikoula (Le 29/05/2017, à 17:18)
Thomas | Community manager | ikoula Serveurs dédiés, VPS et Cloud Public
Contactez-nous | Suivez-nous sur Twitter | Likez nous sur Facebook
Hors ligne
#6 Le 01/06/2017, à 20:39
- drsky
Re : iptables et disque dur freebox
j'ai fait plusieurs test avec netstats, j'arrive pas à chopper le port quand je monte mon disque dur. en envoyant sur mon disque dur freebox un fichier, j'ai trouvé l'adresse local et le port 192.168.0.254:445 mais ce port est déjà accepter.
Hors ligne
Pages : 1