Léa-Linux & amis :   LinuxFR   GCU-Squad   GNU
vnc et iptables
Envoyé par: matrix38

slt,

j' ai installer vnc qui fonctionne bien , vnc demmarre au demarrage de mdk , le probleme est que je peut pas activer mon script iptables sinon vnc ne demarre pas au boot du pc , j' ai essayer d' ouvrir les port que j' utilise 5801 et 5901 mais rien a faire marche pas voici ce que j' ai mis :

iptables -A INPUT -p tcp --dport 5801 -j ACCEPT
iptables -A INPUT -p tcp --dport 5901 -j ACCEPT

merci si une solution

Poste le Monday 29 December 2003 00:44:35
Répondre     Citer    
Re: vnc et iptables
Envoyé par: smurfy

et si en plus tu rajoputes les memes lignes avec output ? (il faut pas qu'il communique dnas les 2 sens ?)

Poste le Monday 29 December 2003 11:16:58
Répondre     Citer    
Re: vnc et iptables
Envoyé par: car

bonjpur,
j' ai deja essayer de mettre output ca fait pareil vnc ne demarre pas au boot de pc

Poste le Monday 29 December 2003 12:33:28
Répondre     Citer    
Re: vnc et iptables
Envoyé par: maston28

si tu supprimes le firewall
iptables -X
iptables -F
et que tu relances vnc
service vnc restart (ou start)
ca marche ?
c'est p-e un probleme de configuration de vnc, et pas d'iptables...


Poste le Monday 29 December 2003 12:57:08
Répondre     Citer    
Re: vnc et iptables
Envoyé par: car

je vais essaye, je pense pas que ca vient de vnc car si je demarre pas mon script firewall (iptables au demmarrage du pc) vnc demarre correctement au boot et fonction si ca peut aider regarde :

quand iptables acitiver au demarrage voici les port :

root@ns1 admin]# netstat -lapute
Connexions Internet actives (serveurs et établies)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat Utilisatr Inode PID/Program name
tcp 0 0 *:32768 *:* LISTEN rpcuser 2937 829/
tcp 0 0 *:nfs *:* LISTEN root 3484 -
tcp 0 0 localhost:32769 *:* LISTEN root 3285 1182/xinetd
tcp 0 0 *:32770 *:* LISTEN root 3494 -
tcp 0 0 *:32771 *:* LISTEN root 3518 1388/rpc.mountd
tcp 0 0 *:smux *:* LISTEN root 3212 1082/snmpd
tcp 0 0 *:mysql *:* LISTEN root 4047 1734/
tcp 0 0 *:netbios-ssn *:* LISTEN root 4299 1765/smbd
tcp 0 0 *:pop3 *:* LISTEN root 3320 1182/xinetd
tcp 0 0 localhost:783 *:* LISTEN root 6427 1938/perl
tcp 0 0 *:sunrpc *:* LISTEN root 2844 764/
tcp 0 0 *:http *:* LISTEN root 4996 1839/httpd
tcp 0 0 *:x11 *:* LISTEN root 3311 1201/
tcp 0 0 *:689 *:* LISTEN root 3465 1357/rpc.rquotad
tcp 0 0 *:10002 *:* LISTEN root 4086 1744/perl
tcp 0 0 *:ftp *:* LISTEN nobody 3961 1670/
tcp 0 0 ns1:domain *:* LISTEN named 3244 1109/
tcp 0 0 localhost:domain *:* LISTEN named 3242 1109/
tcp 0 0 *:ssh *:* LISTEN root 3267 1149/sshd
tcp 0 0 *:ipp *:* LISTEN root 3421 1230/cupsd
tcp 0 0 *:smtp *:* LISTEN root 3799 1625/
tcp 0 0 localhost:rndc *:* LISTEN named 3258 1109/
tcp 0 0 localhos:x11-ssh-offset *:* LISTEN admin 41516 31548/
tcp 0 0 *:603 *:* LISTEN root 2959 846/ypserv
tcp 0 0 *:732 *:* LISTEN root 3103 977/rpc.ypxfrd
tcp 0 0 *:7741 *:* LISTEN root 4961 1799/lisa
tcp 0 0 ns1:ssh satellite:32779 ESTABLISHED root 41493 31546/sshd: admin [
tcp 0 1 ns1:http 200191182168-dial-:1061 FIN_WAIT1 root 0 -
udp 0 0 *:32768 *:* rpcuser 2934 829/
udp 0 0 *:who *:* root 3555 1403/rwhod
udp 0 0 *:nfs *:* root 3481 -
udp 0 0 *:32769 *:* named 3257 1109/
udp 0 0 *:32770 *:* root 3490 -
udp 0 0 *:32771 *:* root 3515 1388/rpc.mountd
udp 0 0 ns1:netbios-ns *:* root 4311 1775/nmbd
udp 0 0 *:netbios-ns *:* root 4302 1775/nmbd
udp 0 0 ns1:netbios-dgm *:* root 4312 1775/nmbd
udp 0 0 *:netbios-dgm *:* root 4303 1775/nmbd
udp 0 0 *:10000 *:* root 4087 1744/perl
udp 0 0 *:snmp *:* root 3295 1082/snmpd
udp 0 0 *:686 *:* root 3459 1357/rpc.rquotad
udp 0 0 ns1:domain *:* named 3243 1109/
udp 0 0 localhost:domain *:* named 3241 1109/
udp 0 0 *:7741 *:* root 4994 1799/lisa
udp 0 0 *:600 *:* root 2954 846/ypserv
udp 0 0 *:730 *:* root 3100 977/rpc.ypxfrd
udp 0 0 *:749 *:* root 3579 1420/rpc.yppasswdd
udp 0 0 *:sunrpc *:* root 2833 764/
udp 0 0 *:ipp *:* root 3422 1230/cupsd

et

[root@ns1 admin]# netstat -plantu
Connexions Internet actives (serveurs et établies)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN 829/
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:32769 0.0.0.0:* LISTEN 1182/xinetd
tcp 0 0 0.0.0.0:32770 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:32771 0.0.0.0:* LISTEN 1388/rpc.mountd
tcp 0 0 0.0.0.0:199 0.0.0.0:* LISTEN 1082/snmpd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1734/
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1765/smbd
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 1182/xinetd
tcp 0 0 127.0.0.1:783 0.0.0.0:* LISTEN 1938/perl
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 764/
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1839/httpd
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 1201/
tcp 0 0 0.0.0.0:689 0.0.0.0:* LISTEN 1357/rpc.rquotad
tcp 0 0 0.0.0.0:10002 0.0.0.0:* LISTEN 1744/perl
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1670/
tcp 0 0 192.168.0.102:53 0.0.0.0:* LISTEN 1109/
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1109/
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1149/sshd
tcp 0 0 0.0.0.0:631 0.0.0.0:* LISTEN 1230/cupsd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1625/
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1109/
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 31548/
tcp 0 0 0.0.0.0:603 0.0.0.0:* LISTEN 846/ypserv
tcp 0 0 0.0.0.0:732 0.0.0.0:* LISTEN 977/rpc.ypxfrd
tcp 0 0 0.0.0.0:7741 0.0.0.0:* LISTEN 1799/lisa
tcp 0 50 192.168.0.102:80 200.191.182.168:1080 LAST_ACK -
tcp 0 144 192.168.0.102:22 192.168.0.103:32779 ESTABLISHED 31546/sshd: admin [
udp 0 0 0.0.0.0:32768 0.0.0.0:* 829/
udp 0 0 0.0.0.0:513 0.0.0.0:* 1403/rwhod
udp 0 0 0.0.0.0:2049 0.0.0.0:* -
udp 0 0 0.0.0.0:32769 0.0.0.0:* 1109/
udp 0 0 0.0.0.0:32770 0.0.0.0:* -
udp 0 0 0.0.0.0:32771 0.0.0.0:* 1388/rpc.mountd
udp 0 0 192.168.0.102:137 0.0.0.0:* 1775/nmbd
udp 0 0 0.0.0.0:137 0.0.0.0:* 1775/nmbd
udp 0 0 192.168.0.102:138 0.0.0.0:* 1775/nmbd
udp 0 0 0.0.0.0:138 0.0.0.0:* 1775/nmbd
udp 0 0 0.0.0.0:10000 0.0.0.0:* 1744/perl
udp 0 0 0.0.0.0:161 0.0.0.0:* 1082/snmpd
udp 0 0 0.0.0.0:686 0.0.0.0:* 1357/rpc.rquotad
udp 0 0 192.168.0.102:53 0.0.0.0:* 1109/
udp 0 0 127.0.0.1:53 0.0.0.0:* 1109/
udp 0 0 0.0.0.0:7741 0.0.0.0:* 1799/lisa
udp 0 0 0.0.0.0:600 0.0.0.0:* 846/ypserv
udp 0 0 0.0.0.0:730 0.0.0.0:* 977/rpc.ypxfrd
udp 0 0 0.0.0.0:749 0.0.0.0:* 1420/rpc.yppasswdd
udp 0 0 0.0.0.0:111 0.0.0.0:* 764/
udp 0 0 0.0.0.0:631 0.0.0.0:* 1230/cupsd

comme tu voit les port vnc n' on pas demarrer

*la site j' arrete le firewall est je reboute le pc :

[root@ns1 ridelystar]# netstat -lapute
Connexions Internet actives (serveurs et établies)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat Utilisatr Inode PID/Program name
tcp 0 0 *:32768 *:* LISTEN rpcuser 2942 829/
tcp 0 0 *:nfs *:* LISTEN root 3489 -
tcp 0 0 localhost:32769 *:* LISTEN root 3311 1196/xinetd
tcp 0 0 *:32770 *:* LISTEN root 3499 -
tcp 0 0 *:32771 *:* LISTEN root 3523 1388/rpc.mountd
tcp 0 0 *:smux *:* LISTEN root 3218 1099/snmpd
tcp 0 0 *:5801 *:* LISTEN ridelystar 6421 1918/Xvnc
tcp 0 0 *:mysql *:* LISTEN root 4052 1734/
tcp 0 0 *:61611 *:* LISTEN ridelystar 8262 2162/wish
tcp 0 0 *:netbios-ssn *:* LISTEN root 4308 1765/smbd
tcp 0 0 *:5901 *:* LISTEN ridelystar 6420 1918/Xvnc
tcp 0 0 *:pop3 *:* LISTEN root 3325 1196/xinetd
tcp 0 0 localhost:783 *:* LISTEN root 6509 1987/perl
tcp 0 0 *:sunrpc *:* LISTEN root 2847 764/
tcp 0 0 *:http *:* LISTEN root 5007 1839/httpd
tcp 0 0 *:x11 *:* LISTEN root 3316 1201/
tcp 0 0 *:6001 *:* LISTEN ridelystar 6417 1918/Xvnc
tcp 0 0 *:689 *:* LISTEN root 3470 1357/rpc.rquotad
tcp 0 0 *:10002 *:* LISTEN root 4099 1745/perl
tcp 0 0 *:63251 *:* LISTEN ridelystar 8269 2162/wish
tcp 0 0 *:ftp *:* LISTEN nobody 3971 1670/
tcp 0 0 ns1:domain *:* LISTEN named 3249 1123/
tcp 0 0 localhost:domain *:* LISTEN named 3247 1123/
tcp 0 0 *:ssh *:* LISTEN root 3278 1163/sshd
tcp 0 0 *:ipp *:* LISTEN root 3426 1230/cupsd
tcp 0 0 *:smtp *:* LISTEN root 3804 1625/
tcp 0 0 localhost:rndc *:* LISTEN named 3251 1123/
tcp 0 0 localhos:x11-ssh-offset *:* LISTEN admin 10464 2340/
tcp 0 0 *:603 *:* LISTEN root 2962 846/ypserv
tcp 0 0 *:732 *:* LISTEN root 3105 977/rpc.ypxfrd
tcp 0 0 *:7741 *:* LISTEN root 4970 1799/lisa
tcp 0 0 ns1:http ARennes-303-1-21-1:4589 ESTABLISHED nobody 10414 2319/
tcp 0 0 ns1:http ARennes-303-1-21-1:4590 TIME_WAIT root 0 -
tcp 0 0 ns1:http ARennes-303-1-21-1:4591 ESTABLISHED nobody 10416 2307/
tcp 0 0 ns1:http ARennes-303-1-21-1:4586 TIME_WAIT root 0 -
tcp 0 0 ns1:http ARennes-303-1-21-1:4612 ESTABLISHED nobody 10554 2318/
tcp 0 0 ns1:http ARennes-303-1-21-1:4613 ESTABLISHED nobody 10555 2415/
tcp 0 0 ns1:http ARennes-303-1-21-1:4609 ESTABLISHED nobody 10551 2412/
tcp 0 0 ns1:http ARennes-303-1-21-1:4611 ESTABLISHED nobody 10552 2413/
tcp 0 0 ns1:ssh satellite:32787 ESTABLISHED root 10436 2337/sshd: admin [p
tcp 0 0 ns1:http ARennes-303-1-21-1:4596 ESTABLISHED nobody 10543 2284/
tcp 0 0 ns1:http ARennes-303-1-21-1:4597 ESTABLISHED nobody 10544 2285/
tcp 0 0 ns1:http ARennes-303-1-21-1:4592 ESTABLISHED nobody 10417 2306/
tcp 0 0 ns1:http ARennes-303-1-21-1:4593 TIME_WAIT root 0 -
tcp 0 0 ns1:32784 baym-cs175.msgr.ho:1863 ESTABLISHED ridelystar 8270 2162/wish
tcp 0 0 ns1:http ARennes-303-1-21-1:4594 ESTABLISHED nobody 10426 2280/
tcp 0 0 ns1:http ARennes-303-1-21-1:4595 ESTABLISHED nobody 10427 2153/
udp 0 0 *:32768 *:* rpcuser 2939 829/
udp 0 0 *:who *:* root 3560 1403/rwhod
udp 0 0 *:nfs *:* root 3486 -
udp 0 0 *:32769 *:* named 3250 1123/
udp 0 0 *:32770 *:* root 3495 -
udp 0 0 *:32771 *:* root 3520 1388/rpc.mountd
udp 0 0 ns1:netbios-ns *:* root 4320 1775/nmbd
udp 0 0 *:netbios-ns *:* root 4311 1775/nmbd
udp 0 0 ns1:netbios-dgm *:* root 4321 1775/nmbd
udp 0 0 *:netbios-dgm *:* root 4312 1775/nmbd
udp 0 0 *:10000 *:* root 4100 1745/perl
udp 0 0 *:snmp *:* root 3306 1099/snmpd
udp 0 0 *:686 *:* root 3464 1357/rpc.rquotad
udp 0 0 ns1:domain *:* named 3248 1123/
udp 0 0 localhost:domain *:* named 3246 1123/
udp 0 0 *:7741 *:* root 5003 1799/lisa
udp 0 0 *:600 *:* root 2957 846/ypserv
udp 0 0 *:730 *:* root 3102 977/rpc.ypxfrd
udp 0 0 *:749 *:* root 3573 1420/rpc.yppasswdd
udp 0 0 *:sunrpc *:* root 2838 764/
udp 0 0 *:ipp *:* root 3427 1230/cupsd

et

[root@ns1 ridelystar]# netstat -plantu
Connexions Internet actives (serveurs et établies)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN 829/
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:32769 0.0.0.0:* LISTEN 1196/xinetd
tcp 0 0 0.0.0.0:32770 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:32771 0.0.0.0:* LISTEN 1388/rpc.mountd
tcp 0 0 0.0.0.0:199 0.0.0.0:* LISTEN 1099/snmpd
tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN 1918/Xvnc
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1734/
tcp 0 0 0.0.0.0:61611 0.0.0.0:* LISTEN 2162/wish
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1765/smbd
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 1918/Xvnc
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 1196/xinetd
tcp 0 0 127.0.0.1:783 0.0.0.0:* LISTEN 1987/perl
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 764/
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1839/httpd
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 1201/
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 1918/Xvnc
tcp 0 0 0.0.0.0:689 0.0.0.0:* LISTEN 1357/rpc.rquotad
tcp 0 0 0.0.0.0:10002 0.0.0.0:* LISTEN 1745/perl
tcp 0 0 0.0.0.0:63251 0.0.0.0:* LISTEN 2162/wish
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1670/
tcp 0 0 192.168.0.102:53 0.0.0.0:* LISTEN 1123/
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1123/
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1163/sshd
tcp 0 0 0.0.0.0:631 0.0.0.0:* LISTEN 1230/cupsd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1625/
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1123/
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 2340/
tcp 0 0 0.0.0.0:603 0.0.0.0:* LISTEN 846/ypserv
tcp 0 0 0.0.0.0:732 0.0.0.0:* LISTEN 977/rpc.ypxfrd
tcp 0 0 0.0.0.0:7741 0.0.0.0:* LISTEN 1799/lisa
tcp 0 0 192.168.0.102:22 192.168.0.103:32787 ESTABLISHED 2337/sshd: admin [p
tcp 0 0 192.168.0.102:32784 207.46.106.175:1863 ESTABLISHED 2162/wish
udp 0 0 0.0.0.0:32768 0.0.0.0:* 829/
udp 0 0 0.0.0.0:513 0.0.0.0:* 1403/rwhod
udp 0 0 0.0.0.0:2049 0.0.0.0:* -
udp 0 0 0.0.0.0:32769 0.0.0.0:* 1123/
udp 0 0 0.0.0.0:32770 0.0.0.0:* -
udp 0 0 0.0.0.0:32771 0.0.0.0:* 1388/rpc.mountd
udp 0 0 192.168.0.102:137 0.0.0.0:* 1775/nmbd
udp 0 0 0.0.0.0:137 0.0.0.0:* 1775/nmbd
udp 0 0 192.168.0.102:138 0.0.0.0:* 1775/nmbd
udp 0 0 0.0.0.0:138 0.0.0.0:* 1775/nmbd
udp 0 0 0.0.0.0:10000 0.0.0.0:* 1745/perl
udp 0 0 0.0.0.0:161 0.0.0.0:* 1099/snmpd
udp 0 0 0.0.0.0:686 0.0.0.0:* 1357/rpc.rquotad
udp 0 0 192.168.0.102:53 0.0.0.0:* 1123/
udp 0 0 127.0.0.1:53 0.0.0.0:* 1123/
udp 0 0 0.0.0.0:7741 0.0.0.0:* 1799/lisa
udp 0 0 0.0.0.0:600 0.0.0.0:* 846/ypserv
udp 0 0 0.0.0.0:730 0.0.0.0:* 977/rpc.ypxfrd
udp 0 0 0.0.0.0:749 0.0.0.0:* 1420/rpc.yppasswdd
udp 0 0 0.0.0.0:111 0.0.0.0:* 764/
udp 0 0 0.0.0.0:631 0.0.0.0:* 1230/cupsd

la comme tu peut voir on vois les port de vnc ouvert iptables (script firewall desactiver) .

Poste le Monday 29 December 2003 13:10:11
Répondre     Citer    
Re: vnc et iptables
Envoyé par: maston28

tu pourrais nous montrer ton script de fw ? (et/ou iptables -L)


Poste le Monday 29 December 2003 13:29:08
Répondre     Citer    
Re: vnc et iptables
Envoyé par: car

voici le script :

#!/bin/sh
# firewall v1.0 Sept 15 20:45:21 PDT 2001 written by : Kernel <kernel@trustonme.net>
# this script is free software according to the GNU General Public License (see [www.gnu.org])
# Start/stop/restart/status firewall:

firewall_start() {

echo "[Démarrage du firewall]"

############################### REGLES PAR DEFAUT ###########################

echo "[Initialisation de la table filter]"
iptables -F
iptables -X

echo "[Politique par défaut de la table filter]"

# On ignore tout ce qui entre ou transite par la passerelle
iptables -P INPUT DROP
iptables -P FORWARD DROP

# On accepte, ce qui sort
iptables -P OUTPUT ACCEPT

# Pour éviter les mauvaises suprises, on va
# autoriser l'accès à la loopback, c'est vital !
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

############################### LOCAL-INTERNET ###########################

echo "[On autorise les clients à accéder à internet ]"

#On créé une nouvelle chaîne, le nom est indifférent
# appelons-la "local-internet"
iptables -N local-internet

# On définit le profil de ceux qui appartiendront à "local-internet"
# "local-internet" concerne toutes les connections sauf celles venant d'internet ( ! = non)
# En gros avec ça, vous rendez, vos serveurs inaccessibles depuis internet.
# Pas de panique, certains serveurs seront autorisés explicitement dans la suite.
iptables -A local-internet -m state --state NEW -i ! eth0 -j ACCEPT
iptables -A local-internet -m state --state NEW -i ! ppp0 -j ACCEPT

#Evidemment, une fois acceptées comme "local-internet", les connections peuvent continuer
# et faire des petits :-)
iptables -A local-internet -m state --state ESTABLISHED,RELATED -j ACCEPT

# On termine en indiquant que les connections appartenant à "local-internet"
# accèdent à internet de manière transparente.
iptables -A INPUT -j local-internet
iptables -A FORWARD -j local-internet

############################### LES TABLES NAT ET MANGLE #############################

echo "[Initialisation des tables nat et mangle]"

iptables -t nat -F
iptables -t nat -X
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT

iptables -t mangle -F
iptables -t mangle -X
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P OUTPUT ACCEPT

############################## ON NOTE LES CONNEXIONX /VAR/LOG/MESSAGE ######################
iptables --append FORWARD --match limit --jump LOG
iptables --append OUTPUT --match limit --jump LOG


#################################### LE MASQUERADING ########################################

# Commentez ces 2 lignes, si vous ne faîtes pas du masquerading (nat)
#echo "[Mise en place du masquerading]"
#iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE

################################# ACTIVATION DE LA PASSERELLE ##################

#echo "[Activation de la passerelle]"
#echo 1 > /proc/sys/net/ipv4/ip_forward

################################# PAS DE SPOOFING ############################

echo "[Pas de spoofing]"
if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ] ; then
for filtre in /proc/sys/net/ipv4/conf/*/rp_filter
do
echo 1 > $filtre
done
fi

########################## PAS DE SYNFLOOD ####################

echo "[Pas de synflood]"
if [ -e /proc/sys/net/ipv4/tcp_syncookies ] ; then
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
fi

################################## PAS DE PING ###############################

# commentez ces 6 lignes, si vous autorisez les pings sur votre passerelle
#echo "[Pas ping]"
#echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
#echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
#if [ -e /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses ] ; then
# echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
#fi

############################ noter dans fichiers les accés ################################

iptables -t filter -A INPUT -j LOG

############################ Fonctionnalités serveurs #####################################

echo "[Etude des fonctionalités serveurs, visibles depuis internet ]"

# A ce stade, tous vos clients du réseau local et de la passerelle ont accès à internet. Mieux,
# vos clients du réseau local, ont accès à vos serveurs apache, proftp ... localement. Mais personne
# depuis internet ne peux accéder à l'un des serveurs que vous hébergés.

# Il est bien-sûr possible de dévérrouiller pontuellement l'accès à un serveur depuis internet,
# en décommentant les 2 ou 3 lignes correspondantes.

#echo "[autorisation du serveur ssh(22) ...]"
iptables -A INPUT -p tcp --dport ssh -j ACCEPT

#echo "[autorisation du serveur smtp(25) ...]"
iptables -A INPUT -p tcp --dport smtp -j ACCEPT

#echo "[autorisation du serveur pop (110)...]"
iptables -A INPUT -p tcp --dport pop3 -j ACCEPT

#echo "[autorisation du serveur http(80) ...]"
iptables -A INPUT -p tcp --dport www -j ACCEPT
#iptables -A OUTPUT -p tcp --sport www -j ACCEPT

#echo "[autorisation du serveur https(443) ...]"
iptables -A INPUT -p tcp --dport https -j ACCEPT

#echo "[autorisation du serveur DNS(53) ...]"
iptables -A INPUT -p udp --dport domain -j ACCEPT
iptables -A INPUT -p tcp --dport domain -j ACCEPT

#echo "[autorisation du serveur irc(6667) ...]"
#iptables -A INPUT -p tcp --dport ircd -j ACCEPT

#echo "[autorisation du serveur cvs (2401) ...]"
#iptables -A INPUT -p tcp --dport cvspserver -j ACCEPT


#echo "[autorisation du serveur FTP(21 et 20) ...]"
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -p tcp --dport 20 -j ACCEPT

#iptables -A INPUT -i ppp0 -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT
#iptables -A OUTPUT -o ppp0 -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
#iptables -A INPUT -i ppp0 -p tcp --sport 20 -m state --state ESTABLISHED,RELATED -j ACCEPT
#iptables -A OUTPUT -o ppp0 -p tcp --dport 20 -m state --state ESTABLISHED -j ACCEPT


#echo "[autorisation du serveur FTP-Passif(1024 a 65535) ...]"
#iptables -A INPUT -i ppp0 -p tcp --sport 1024:65535 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
#iptables -A OUTPUT -o ppp0 -p tcp --sport 1024:65535 --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j ACCEPT



#echo "[autorisation du serveur webmin (10002) ...]"
iptables -A INPUT -p tcp --dport 10002 -j ACCEPT

#echo "[autorisation du serveur xMule (4662 et 4672) ...]"
#iptables -A INPUT -p tcp --dport 4662 -j ACCEPT
#iptables -A INPUT -p udp --dport 4672 -j ACCEPT

#echo "[autorisation du serveur MSNFichiers (6893 et 6894) ...]"
iptables -A INPUT -p tcp --dport 6893 -j ACCEPT
# iptables -A INPUT -p tcp --dport 6894 -j ACCEPT

#echo "[autorisation du serveur VNCserver (5801 et 5901) ...]"
iptables -A INPUT -p tcp --dport 5801 -j ACCEPT
iptables -A INPUT -p tcp --dport 5901 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 5801 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 5901 -j ACCEPT


#echo "[autorisation du webmail (143)....]"
iptables -A INPUT -p tcp --dport 143 -j ACCEPT

#echo "[autorisation du serveur snmp (161) .......]
#iptables -A INPUT -p udp --dport 161 -j ACCEPT

# Ne pas décommenter les 3 lignes qui suivent.
# Plus généralement :
#echo "[autorisation du serveur Mon_truc(10584) ...]"
#iptables -A INPUT -p tcp --dport 10584 -j ACCEPT

echo "[firewall activé !]"

}

firewall_stop() {


iptables -F
iptables -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

iptables -t nat -F
iptables -t nat -X
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT

iptables -t mangle -F
iptables -t mangle -X
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P OUTPUT ACCEPT

echo " [firewall descativé! ]"
}

firewall_restart() {
firewall_stop
sleep 2
firewall_start
}

case "$1" in
'start')
firewall_start
;;
'stop')
firewall_stop
;;
'restart')
firewall_restart
;;
'status')
iptables -L
iptables -t nat -L
iptables -t mangle -L
;;
*)
echo "Usage: firewall {start|stop|restart|status}"
esac

Poste le Monday 29 December 2003 13:55:11
Répondre     Citer    
Re: vnc et iptables
Envoyé par: maston28

essaie en remplacant :

#echo "[autorisation du serveur VNCserver (5801 et 5901) ...]"
iptables -A INPUT -p tcp --dport 5801 -j ACCEPT
iptables -A INPUT -p tcp --dport 5901 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 5801 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 5901 -j ACCEPT

par


#echo "[autorisation du serveur VNCserver (5801 et 5901) ...]"
iptables -A INPUT -p tcp --dport 5801 -j ACCEPT
iptables -A INPUT -p tcp --dport 5901 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 5801 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 5901 -j ACCEPT


Poste le Monday 29 December 2003 16:24:53
Répondre     Citer    
Re: vnc et iptables
Envoyé par: car

j' ai modifier est quand je redemarrer le pc pareil vnc se charge pas tous seul , iptables le bloque je sait pas ou

Poste le Monday 29 December 2003 16:40:22
Répondre     Citer    
Re: vnc et iptables
Envoyé par: maston28

ce que je comprends pas, c est en quoi le fait qu'il y ait iptables empeche le lancement de vnc... ca peut empecher son bon fonctionnement, mais son lancement...
Au démarrage, apres le boot avec iptables, essaie un ps aux |grep -i vnc


Poste le Monday 29 December 2003 18:20:01
Répondre     Citer    
Re: vnc et iptables
Envoyé par: car

la commande donne ca :

ridelys 2117 0.0 0.2 1904 764 pts/1 R 18:50 0:00 grep -i vnc

Poste le Monday 29 December 2003 18:51:29
Répondre     Citer    

Veuillez vous authentifier auparavant pour commenter.

 

Ce forum !
vnc et iptables
Posez dans ce forum les questions qui ne trouvent pas place dans les autres...

Sauf mention contraire, les documentations publiées sont sous licence Creative-Commons