aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Iptables output for amule  (Read 2770 times)

Axl_Mas

  • Jr. Member
  • **
  • Karma: 1
  • Offline Offline
  • Posts: 73
Iptables output for amule
« on: November 26, 2005, 03:26:20 PM »

It is indispensable to leave iptables's output policy open?
I try to block all and open only few ports

$IPTABLES -A OUTPUT -p tcp --dport 4662  -j ACCEPT
$IPTABLES -A OUTPUT -p udp --dport 4672 -j ACCEPT
$IPTABLES -A OUTPUT -p udp --dport 4665  -j ACCEPT

but i can not connect at many servers and i receive this always this errors:

WARNING! Client UDP-Socket discarded packet due to errors (2) while sending.
WARNING! Client UDP-Socket discarded packet due to errors (2) while sending.
WARNING! Server UDP-Socket discarded packet due to errors (2) while sending.
WARNING! Client UDP-Socket discarded packet due to errors (2) while sending.
« Last Edit: November 26, 2005, 03:28:43 PM by Axl_Mas »
Logged

stefanero

  • Some Support
  • Developer
  • Hero Member
  • *****
  • Karma: 8
  • Offline Offline
  • Posts: 4235
Re: Iptables output for amule
« Reply #1 on: November 26, 2005, 03:51:40 PM »

dont worry about the warings on console ;)
Logged
In its default setup, Windows XP on the Internet amounts to a car
parked in a bad part of town, with the doors unlocked, the key in
the ignition and a Post-It note on the dashboard saying, "Please
don't steal this."

ken

  • Hero Member
  • *****
  • Karma: 4
  • Offline Offline
  • Posts: 825
Re: Iptables output for amule
« Reply #2 on: November 27, 2005, 09:11:27 AM »

You are specifying "--dport" which is the destination port number.  So, you are saying that your firewall should accept output packets coming from any port on your system just so long as they're going to TCP 4662, UDP 4665, or UDP 4672 ports at the destination.  But many clients and almost all servers use different port numbers than those, so you won't be able to transmit to them.  Even if a client keeps the default port configuration, the configured TCP port is only the one they use for incoming connections.  Any connection attempt they make to you will have a different port number on their end, so these rules would prevent you from replying.

Did you maybe mean "--sport" for the source port number?  That would change the rules so that your firewall would accept output packets to any destination port, but only if they originate from the specified ports on your system.  That might make a little more sense, except it will limit your abilitiy to initiate TCP connections.  For UDP, aMule sends from the same ports as it receives from, so the rule will allow aMule to send UDP to everyone.  However, for TCP, aMule accepts connections on the port you configure (4662 by default) but it makes outgoing connections using an arbitrary port number.  It can't use the same port number for accepting incoming connections as it uses to make outgoing connections.

So, I don't see a way to craft a rule which allows all aMule TCP communications in and out but disallows other programs from sending TCP packets out.  I'm not an iptables expert by any means, so maybe somebody who's more familiar with it can correct me if I'm wrong.  Maybe there's an extension to iptables which controls packets based on the originating program.  I see in the iptables documentation that there's a way to control packets based on the user ID of the originating program.  If you set up a special user account on your system and run aMule from there, that would do what you want.
Logged