Anomalie #2675
le firewall n'accepte pas de port au dessus de 49151
Description
Sur horus 2.3,
je créé un fichier de règles de firewall dans /usr/share/eole/firewall avec une règle permettant d'ouvrir les ports >1024 depuis une machine particulière (problème d'un démon qui se lance sur un port aléatoire).
allow_dest(interface='eth0', ip='172.30.96.33/255.255.255.255', port='1024:49000')
Le service me renvoi systématiquement une erreur si j'indique un port > à 49000
SyntaxError: invalid syntax
root@burdpn:/usr/share/eole/firewall# vi 00_root_tsm.fw
root@burdpn:/usr/share/eole/firewall# /etc/init.d/bastion restart
* Stopping firewall: bastion [ OK ]
* Starting firewall: bastionTraceback (most recent call last):
File "/usr/share/eole/bastion/bin/bastion", line 5, in <module>
write_rules()
File "/usr/share/eole/bastion/processor.py", line 6, in write_rules
rules, tcpwrappers = file_loader()
File "/usr/share/eole/bastion/loader.py", line 194, in file_loader
exec(file(fname).read())
File "<string>", line 5
allow_des$(interface='eth0', ip='172.30.96.33/255.255.255.255', protocol='udp', port='1024:55000')
^
SyntaxError: invalid syntax
root@burdpn:/usr/share/eole/firewall# vi 00_root_tsm.fw
root@burdpn:/usr/share/eole/firewall# /etc/init.d/bastion restart
* Stopping firewall: bastion [ OK ]
* Starting firewall: bastionError port not a valid port: 1024:55000 in /usr/share/eole/firewall/00_root_tsm.fw [ OK ]
root@burdpn:/usr/share/eole/firewall# vi 00_root_tsm.fw
root@burdpn:/usr/share/eole/firewall# /etc/init.d/bastion restart
* Stopping firewall: bastion [ OK ]
* Starting firewall: bastionError port not a valid port: 1024:50000 in /usr/share/eole/firewall/00_root_tsm.fw [ OK ]
root@burdpn:/usr/share/eole/firewall# vi 00_root_tsm.fw
root@burdpn:/usr/share/eole/firewall# /etc/init.d/bastion restart
* Stopping firewall: bastion [ OK ]
* Starting firewall: bastionError port not a valid port: 1:50000 in /usr/share/eole/firewall/00_root_tsm.fw [ OK ]
root@burdpn:/usr/share/eole/firewall# vi 00_root_tsm.fw
root@burdpn:/usr/share/eole/firewall# /etc/init.d/bastion restart
* Stopping firewall: bastion [ OK ]
* Starting firewall: bastion [ OK ]
root@burdpn:/usr/share/eole/firewall# vi 00_root_tsm.fw
root@burdpn:/usr/share/eole/firewall# /etc/init.d/bastion restart
* Stopping firewall: bastion [ OK ]
* Starting firewall: bastion [ OK ]
root@burdpn:/usr/share/eole/firewall# vi 00_root_tsm.fw
root@burdpn:/usr/share/eole/firewall# /etc/init.d/bastion restart
* Stopping firewall: bastion [ OK ]
* Starting firewall: bastionError port not a valid port: 1024:49999 in /usr/share/eole/firewall/00_root_tsm.fw
Il y a une limitation au niveau du code :
loader.py: if port not in range(0, 49151):
Je comprends pas trop pourquoi...
Pour info/rappel, la plage d'ip se termine à 65535... (et les ports dynamiques se situent dans la plage 49152 à 65535)...
Le problème doit se retrouver sur tous les modules.
Associated revisions
- bastion/eole-firewall/loader.py : test des ports dans "range(0, 65536)"
- bastion/eole-firewall/loader.py : utilisation des comparateurs à la place de range
History
#1 Updated by Joël Cuissinat over 11 years ago
- Status changed from Nouveau to Pas un bug
C'est peut-être juste parce que tu as tapé allow_des$ au lieu de allow_dest :o
Ah non, j'avais pas vu que tu avais laissé tes erreurs précédentes dans la demande !!!
#2 Updated by Joël Cuissinat over 11 years ago
- Status changed from Pas un bug to En attente d'informations
#3 Updated by Joël Cuissinat over 11 years ago
- Project changed from Horus to eole-common
#4 Updated by Joël Cuissinat over 11 years ago
- Assigned To set to Fabrice Barconnière
- Target version set to Mises à jour 2.3 - 03 Stable
- Estimated time set to 1.00 h
/usr/share/eole/bastion/loader.py, ligne 52 :
if port not in range(0, 49151): sys.stderr.write('Error port not a valid port: %s in %s' % (ports, fname))
Ca vient confirmer que la personne qui a codé ça a pensé qu'il n'était pas intéressant d'ouvrir la plage des ports dynamiques ou privés :)
#5 Updated by samuel morin over 11 years ago
Joël Cuissinat a écrit :
C'est peut-être juste parce que tu as tapé allow_des$ au lieu de allow_dest :o
Ah non, j'avais pas vu que tu avais laissé tes erreurs précédentes dans la demande !!!
heu, je suis quand même pas complètement neuneu !
#6 Updated by Joël Cuissinat over 11 years ago
- Status changed from En attente d'informations to Résolu
- % Done changed from 0 to 100
Appliqué par commit 5e1422e88d8b1c51f515a794657abedf2406eacd.
#7 Updated by Joël Cuissinat over 11 years ago
C'est mon dernier mot !
(de toute façon après : iptables v1.4.4: invalid port/service `65536' specified
)
#8 Updated by Daniel Dehennin over 11 years ago
Joël Cuissinat a écrit :
C'est mon dernier mot !
(de toute façon après :
iptables v1.4.4: invalid port/service `65536' specified
)
C’est pas plus léger de faire la comparaison numérique ternaire: 0 < port < 65536
?
#9 Updated by Fabrice Barconnière over 11 years ago
- Status changed from Résolu to Fermé