View previous topic :: View next topic |
Author |
Message |
har3 n00b
Joined: 28 Apr 2004 Posts: 5
|
Posted: Thu Sep 23, 2004 8:43 am Post subject: Privileged ports and users |
|
|
Hi all.
I need to run some services as a user on privileged ports (<1024).
How can I accomplish that.
Thanks. |
|
Back to top |
|
|
nightblade Guru
Joined: 20 Jul 2004 Posts: 368 Location: back from SE Asia
|
Posted: Thu Sep 23, 2004 9:44 am Post subject: |
|
|
If you mean that a service on a privileged port must run with low privileges, just drop root privileges after the service is started (apache does that, for instance). You should be able to accomplish this with setuid() and setgid() functions.
If you mean that a regular user must be able to start a service on a privileged port, I think you only need to set the suid bit of the program that launches that service, so that it will be launched by the user but it will run with root privileges.
Keep in mind that you are messing with limitations that are in place to secure your system, so be careful _________________ In God we trust. All the others must provide a valid X.509 certificate |
|
Back to top |
|
|
har3 n00b
Joined: 28 Apr 2004 Posts: 5
|
Posted: Thu Sep 23, 2004 12:49 pm Post subject: |
|
|
Thanks for your reply nightblade.
I'm trying to run eggdrop, so that its telnet part will listen on some privileged port (firewall issues).
Code: |
Eggdrop v1.6.16+Gentoo (C) 1997 Robey Pointer (C) 2004 Eggheads
[15:48] --- Loading eggdrop v1.6.16+Gentoo (Thu Sep 23 2004)
[15:48] Tcl error in file 'eggdrop.conf':
[15:48] Couldn't grab nearby port
while executing
"listen 650 all"
(file "eggdrop.conf" line 251)
|
Setting suid bit on eggdrop executable won't help me I'm afraid...
Code: |
Eggdrop v1.6.16+Gentoo (C) 1997 Robey Pointer (C) 2004 Eggheads
[09:46] * ERROR: Eggdrop will not run as root!
|
|
|
Back to top |
|
|
nightblade Guru
Joined: 20 Jul 2004 Posts: 368 Location: back from SE Asia
|
Posted: Thu Sep 23, 2004 1:42 pm Post subject: |
|
|
what about getting eggdrop to listen on some non-privileged port, and then set an iptables rule to forward the traffic from a privileged port to the non-privileged one ? You would solve the problem making eggdrop run without root privileges, which I think is quite nice _________________ In God we trust. All the others must provide a valid X.509 certificate |
|
Back to top |
|
|
har3 n00b
Joined: 28 Apr 2004 Posts: 5
|
Posted: Fri Sep 24, 2004 6:17 am Post subject: |
|
|
Great idea!
Got it working with some iptables trickery.
Thank you nightblade. |
|
Back to top |
|
|
nightblade Guru
Joined: 20 Jul 2004 Posts: 368 Location: back from SE Asia
|
Posted: Fri Sep 24, 2004 8:21 am Post subject: |
|
|
Glad it was useful, mate ! _________________ In God we trust. All the others must provide a valid X.509 certificate |
|
Back to top |
|
|
|