Code: Select all
user@A$ ssh -X B
you've got to be joking! what aboutmks99 wrote: If you are talking about allowing ssh but disallowing X11 forwarding over SSH then this is next to impossible. The only thing you could do is to have something that either limits packet size or limits the amount of data sent (typically X11 over ssh will be much higher than interactive typing). Of course, this method would clobber use of scp and sftp since you cant tell what is in the encrypted packet.
`cat /etc/ssh/sshd_config` wrote:X11Forwarding no
you could compare sequential packet counts in `iptables -v -L` to see where the packets are being dropped.aaronf0 wrote:X forwarding works fine without the firewall on.
Code: Select all
#!/bin/bash
IPTABLES="/sbin/iptables"
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP
$IPTABLES -F
$IPTABLES -A INPUT -i eth0 -p all -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A OUTPUT -o eth0 -j ACCEPT
$IPTABLES -A INPUT -i eth0 -p tcp --dport ssh --syn -m state --state NEW -j ACCEPT
$IPTABLES -A INPUT -i eth0 -p tcp --dport http --syn -m state --state NEW -j ACCEPTAs I said before: you have to allow connections to 127.0.0.1 resp. the loopback interface. That's what you don't do (provided the above snippet contains all the relevant rules). With the rules above you throw away absolutely everything - even packets from the local machine targeted to lo - except the few packet types going in and out eth0.aaronf0 wrote:yes, everything works when the firewalls down. yes, i want x11-forwarding. heres the script, see if you can find any errors.
Code: Select all
#!/bin/bash IPTABLES="/sbin/iptables" $IPTABLES -P INPUT DROP $IPTABLES -P OUTPUT DROP $IPTABLES -P FORWARD DROP $IPTABLES -F $IPTABLES -A INPUT -i eth0 -p all -m state --state ESTABLISHED,RELATED -j ACCEPT $IPTABLES -A OUTPUT -o eth0 -j ACCEPT $IPTABLES -A INPUT -i eth0 -p tcp --dport ssh --syn -m state --state NEW -j ACCEPT $IPTABLES -A INPUT -i eth0 -p tcp --dport http --syn -m state --state NEW -j ACCEPT
Code: Select all
$IPTABLES -A INPUT -i lo -j ACCEPT
Code: Select all
$IPTABLES -A INPUT -i eth0 -p tcp --dport ssh -j ACCEPTCode: Select all
iptables -I INPUT -i lo -j ACCEPT