1 |
Hola. Tengo un problemilla con samba e iptables. Se trata de un servidor que |
2 |
hace de servidor de ficheros utilizando samba y también hace de servidor |
3 |
WINS, además de ser el local master browser, preferred master browser de un |
4 |
grupo de trabajo windoze, no de dominio, al menos todavía no: |
5 |
|
6 |
# set local master to no if you don't want Samba to become a master |
7 |
# browser on your network. Otherwise the normal election rules apply |
8 |
local master = yes |
9 |
|
10 |
# OS Level determines the precedence of this server in master browser |
11 |
# elections. The default value should be reasonable |
12 |
os level = 34 |
13 |
|
14 |
# Domain Master specifies Samba to be the Domain Master Browser. This |
15 |
# allows Samba to collate browse lists between subnets. Don't use this |
16 |
# if you already have a Windows NT domain controller doing this job |
17 |
domain master = yes |
18 |
|
19 |
# Preferred Master causes Samba to force a local browser election on startup |
20 |
# and gives it a slightly higher chance of winning the election |
21 |
preferred master = yes |
22 |
|
23 |
He creado un script utilizando reglas de iptables que deniega todos los |
24 |
paquetes entrantres y salientes y que luego va abriendo lo que yo necesito. |
25 |
Con protocolos como http, smtp, pop3, ssh, dhcp, etc, no he tenido problemas, |
26 |
los problemas los tengo con netbios y el acceso a los puertos udp 137, udp |
27 |
138 y tcp 139. Cuando activo mi script-iptables deja de funcionar el browsing |
28 |
the hosts de mi lan en los windozes, es decir, cuando trato de visualizar |
29 |
todos los host de mi red en un windoze solamente aparece el servidor de |
30 |
ficheros, el computador que ejecuta el samba y el script con las reglas |
31 |
iptables. Si limpio las reglas iptables y acepto todo esto no sucede, todo |
32 |
funcionaría entonces correctamente. Aunque el browsing no funcione el acceso |
33 |
a los directorios compartidos del servidor de ficheros es correcto. Lo único |
34 |
que falla cuando activo el sctript-iptables es el "entorno de red" o "ver |
35 |
equipos del grupo de trabajo" de los clientes windoze, algo que parece ser es |
36 |
importante para mis "queridos" compañeros de la ofi. |
37 |
|
38 |
Mis reglas para los puertos 137, 138 y 139 son estas: |
39 |
|
40 |
# habilitamos conexiones tcp netbios-ssn de red interna a 192.168.88.200 |
41 |
iptables -A INPUT -i eth0 -s 192.168.1.0/24 -d 192.168.88.200 -p tcp |
42 |
--dport 139 -m state --state NEW,ESTABLISHED -j ACCEPT |
43 |
iptables -A OUTPUT -o eth0 -s 192.168.88.200 -d 192.168.88.0/24 -p tcp |
44 |
--sport 139 -m state --state ESTABLISHED -j ACCEPT |
45 |
|
46 |
# habilitamos conexiones tcp netbios-ssn |
47 |
iptables -A INPUT -i eth0 -s 192.168.1.0/24 -d 192.168.88.200 -p tcp |
48 |
--sport 139 -m state --state ESTABLISHED -j ACCEPT |
49 |
iptables -A OUTPUT -o eth0 -s 192.168.88.200 -d 192.168.88.0/24 -p tcp |
50 |
--dport 139 -m state --state NEW,ESTABLISHED -j ACCEPT |
51 |
|
52 |
# habilitamos conexiones udp netbios-ns de red interna a 192.168.88.200 |
53 |
iptables -A INPUT -i eth0 -s 192.168.88.0/24 -d 192.168.88.200 -p udp |
54 |
--dport 137 -m state --state NEW,ESTABLISHED -j ACCEPT |
55 |
iptables -A OUTPUT -o eth0 -s 192.168.88.200 -d 192.168.88.0/24 -p udp |
56 |
--sport 137 -m state --state ESTABLISHED -j ACCEPT |
57 |
|
58 |
# habilitamos conexiones udp netbios-ns |
59 |
iptables -A INPUT -i eth0 -s 192.168.88.0/24 -d 192.168.88.200 -p udp |
60 |
--sport 137 -m state --state ESTABLISHED -j ACCEPT |
61 |
iptables -A OUTPUT -o eth0 -s 192.168.88.200 -d 192.168.88.0/24 -p udp |
62 |
--dport 137 -m state --state NEW,ESTABLISHED -j ACCEPT |
63 |
|
64 |
# habilitamos conexiones udp netbios-dgm de red interna a 192.168.88.200 |
65 |
iptables -A INPUT -i eth0 -s 192.168.88.0/24 -d 192.168.88.200 -p udp |
66 |
--dport 138 -m state --state NEW,ESTABLISHED -j ACCEPT |
67 |
iptables -A OUTPUT -o eth0 -s 192.168.88.200 -d 192.168.88.0/24 -p udp |
68 |
--sport 138 -m state --state ESTABLISHED -j ACCEPT |
69 |
|
70 |
# habilitamos conexiones udp netbios-dgm |
71 |
iptables -A INPUT -i eth0 -s 192.168.88.0/24 -d 192.168.88.200 -p udp |
72 |
--sport 138 -m state --state ESTABLISHED -j ACCEPT |
73 |
iptables -A OUTPUT -o eth0 -s 192.168.88.200 -d 192.168.88.0/24 -p udp |
74 |
--dport 138 -m state --state NEW,ESTABLISHED -j ACCEPT |
75 |
|
76 |
Por defecto la política es |
77 |
|
78 |
# definimos la politica |
79 |
iptables -P INPUT DROP |
80 |
iptables -P OUTPUT DROP |
81 |
iptables -P FORWARD DROP |
82 |
|
83 |
y también acepto otras cosas que no ponfgo aquí como la interfaz lo, ICMP, |
84 |
HTTPS, HTTP, SMTP, etc, etc. |
85 |
|
86 |
Con versiones más recientes de samba he hecho la prueba y funciona, teniendo |
87 |
en cuenta (hablo de samba 3.x) que hay que habilitar también el puerto 445, |
88 |
la versión de samba que yo tengo es de una debian woody, concretamente la |
89 |
2.2.3a-14.1, ¿puede ser debido a esto?, ¿a alguien más le ha sucedido?, en |
90 |
ese caso, ¿cómo lo solucionasteis?, etc, etc. |
91 |
|
92 |
-- |
93 |
|
94 |
Einar Matveinen |
95 |
|
96 |
Vitoð ér enn eða hvat |
97 |
var der mere I ville vide |
98 |
Vitoð ér enn eða hvat |
99 |
vil I mere før jeg forsvinder |
100 |
under solen |
101 |
|
102 |
Rekisteröitynyt Linux käyttäjä nro 221083 |
103 |
|
104 |
Katso http://barrapunto.com/index.pl?section=mbp-einarmatveinen |
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
-- |
111 |
gentoo-user-es@g.o mailing list |