aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Using amule as non-root with TCP<1024 (iptables)  (Read 2372 times)

breizh76

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 2
Using amule as non-root with TCP<1024 (iptables)
« on: January 11, 2005, 12:13:18 PM »

Hi !

I have some troubles using amule with port >=1024 with my ISP, so I have configured amule to work with TCP port 119.
Lanching amule as root is not a pb, all works perfectly, but for security reasons, I'd like to launch it as non-root user.

I have configured iptables to do some port translation (1400 is my TCP port in amule, 15000 is UDP ):
...
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 119 -j REDIRECT --to-ports 14000
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 122 -j REDIRECT --to-ports 14003
....
iptables -A INPUT -i eth0 -p tcp --dport 14000 -j ACCEPT
iptables -A INPUT -i eth0 -p udp -m multiport --dport 14003,15000 -j ACCEPT
iptables -A OUTPUT -o eth0 -j ACCEPT
...

iptables -t nat -A POSTROUTING -o eth0 -p tcp --sport 14000 -j MASQUERADE --to-ports 119
iptables -t nat -A POSTROUTING -o eth0 -p udp --sport 14003 -j MASQUERADE --to-ports 122
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
....


All seems to work, but I loose a lot of sources with this method.


1) Have I forgotten something? Is there an another system tools that can help me?

2) Question to devs: will amule be able in the furture to use port <1024 as non-root user (bind to port <1024 with root rights and drop rights after)?

Thanks in advance for your answers, amule is great!

Yann
« Last Edit: January 11, 2005, 01:37:11 PM by breizh76 »
Logged

lfroen

  • Guest
RE: Using amule as non-root with TCP<1024 (iptables)
« Reply #1 on: January 11, 2005, 01:06:33 PM »

I will answer to second part of post:
Quote
2) Question to devs: will amule be able in the furture to use port <1024 as non-root user (bind to port <1024 with root rights and drop rights after)?

Not really. Changing effective gid/uid is quite OS-specific, prone to configuration errors.
Logged

breizh76

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 2
RE: Using amule as non-root with TCP<1024 (iptables)
« Reply #2 on: January 11, 2005, 01:30:55 PM »

lfroen,
OK. Thanks for your answer.
Logged