Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    2

    Unhappy cPanel Plugin to access configuration files, with web server's user?

    Hi there,

    I have a YAML file that contains OAuth consumer key and secret, they're placed at /var/cpanel/xxx. This file is generated by the administrator via WHM and a user shall not have access to it except the admin and the web server's user.

    The user (say 'luser') accesses to the plugin via /frontend/x3/xxx/index.phpcp, and I just realized that it will be running under the permission of 'luser' instead of the web server.

    Is there any way I can grant access to the web server (I suppose cPanel runs Apache as 'root') and to use that credential to perform something in a plugin?

    Thanks.

  2. #2
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    Well, just for the sake of semantics, cpanel uses it's own webserver - cpsrvd.

    This runs as it's user. The best way to handle this sort of interaction is to make the file owned root:usergroup. This will allow both users and root to access the file.

    Or you could just own the file to the user all together (root can handle it either way).

    Your other option is to create a setuid binary that can retrieve that information using checks to ensure the correct user is calling it.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  3. #3
    Member This forum account has been confirmed by cPanel staff to represent a vendor.
    Join Date
    Nov 2008
    Location
    Amsterdam, The Netherlands
    Posts
    20

    Default

    Quote Originally Posted by cPanelMatt View Post
    Your other option is to create a setuid binary that can retrieve that information using checks to ensure the correct user is calling it.
    Are you able to provide an example program for this? This cPanel design is causing us a lot of trouble as well.

  4. #4
    Member This forum account has been confirmed by cPanel staff to represent a vendor.
    Join Date
    Nov 2008
    Location
    Amsterdam, The Netherlands
    Posts
    20

    Default

    Actually could we write this program simply in PHP, and make it executable (but not readable) by world? And then the PHP script would verify if the action is allowed for the specific user/domain? Or does this have to be some C binary?

  5. #5
    Member This forum account has been confirmed by cPanel staff to represent a vendor.
    Join Date
    Nov 2008
    Location
    Amsterdam, The Netherlands
    Posts
    20

    Default

    Quote Originally Posted by dreas View Post
    Actually could we write this program simply in PHP, and make it executable (but not readable) by world? And then the PHP script would verify if the action is allowed for the specific user/domain? Or does this have to be some C binary?
    It has to be a binary. The (PHP) interpreter cannot execute the file without having read access.

Similar Threads & Tags
Similar threads

  1. Replies: 0
    Last Post: 12-28-2010, 07:42 PM
  2. Cant Access Perl Files from Web
    By rqsweat in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 11-02-2007, 03:11 PM
  3. ssh - user access to another users files
    By ladydi711 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-11-2006, 11:13 AM
  4. Create authorized user to access Web/FTP Stats
    By alex2005 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-04-2005, 09:39 AM
  5. Can't access pro. or web.cpanel.net from server
    By Blue|Fusion in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-16-2004, 07:59 PM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube