Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
apache's http user rights
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Hexorg
Tux's lil' helper
Tux's lil' helper


Joined: 29 Oct 2009
Posts: 116

PostPosted: Sun Feb 07, 2010 3:52 pm    Post subject: apache's http user rights Reply with quote

good daytime to you! I wrote a little program to control my LPT port, and I want to be able to allow php scripts to start it. the program requires root privileges. for LPT access. I was wondering if there is a secure way of allowing php run that program? Maybe an apachesu?
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1338
Location: Sweating in South Florida

PostPosted: Tue Feb 09, 2010 8:26 pm    Post subject: Reply with quote

I would rethink your strategy first, but there is always suexec.

How about have you page write a temp config file via php and then have a cron job scan that dir every x minutes, run a sanity/security check on the file and then load it.
Back to top
View user's profile Send private message
Mad Merlin
Veteran
Veteran


Joined: 09 May 2005
Posts: 1155

PostPosted: Tue Feb 09, 2010 9:02 pm    Post subject: Reply with quote

Your LPT port is just a device in /dev, thus you can assign the group of the device to be apache, or another group that the apache user is in, and give the group read/write access, thus it'll have access to that device without you having to give apache any other rights.
_________________
Game! - Where the stick is mightier than the sword!
Back to top
View user's profile Send private message
PaulBain
Apprentice
Apprentice


Joined: 14 Jun 2005
Posts: 159
Location: Coventry, UK

PostPosted: Wed Feb 10, 2010 6:39 pm    Post subject: Reply with quote

I'm not saying this is a good idea, but a quick solution would be to install sudo and allow the apache user to execute a single script as root without password.
You can then just shell_exec("/my/script/as/root.sh");
Back to top
View user's profile Send private message
chias
Tux's lil' helper
Tux's lil' helper


Joined: 06 Nov 2009
Posts: 77
Location: everywhere

PostPosted: Thu Feb 11, 2010 6:52 pm    Post subject: Reply with quote

couldn't you just use setuid? like assuming your binary is chowned to root, chmod it to 6755 or something. Then anyone can run it and it'll run as root
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum