+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Please advice... OS: Fedora... Problem: httpd config

  1. #1
    uplinked's Avatar
    uplinked is offline x10Hosting Member uplinked is an unknown quantity at this point
    Join Date
    Oct 2008
    Location
    Malmö, Sweden
    Posts
    71

    Exclamation Please advice... OS: Fedora... Problem: httpd config

    Hi

    I have installed and configured Apache on Fedora. I am trying to serve a virtual desktop solution. I have chmoded -R 777, chown apache to the root, allowed +ExecCGI, chcon to cgi_exec_t. Still, I get a 403 forbidden error when trying to configure the database (which is working). It is the POST that gets forbidden on the configuration files, not the GET. I have tried curl, it shows 403 forbidden for POST, although I have <limit POST> to allow.

    I am out of ideas what the problem might be... Please advice.

    SeLinux is disabled.
    Best regards
    Uplinked.

    Link to my website: http://www.uplinked.x10hosting.com

  2. #2
    Brandon's Avatar
    Brandon is offline Former Senior Account Rep Brandon is on a distinguished road
    Join Date
    Jun 2006
    Location
    Tewksbury, MA
    Posts
    9,589

    Re: Please advice... OS: Fedora... Problem: httpd config

    Depending on how you have apache setup, you want the files chowned to the 'nobody' or 'apache' user, and do not set the files to 777, 755 should be enough.
    Thanks,
    Brandon Long

  3. #3
    uplinked's Avatar
    uplinked is offline x10Hosting Member uplinked is an unknown quantity at this point
    Join Date
    Oct 2008
    Location
    Malmö, Sweden
    Posts
    71

    Re: Please advice... OS: Fedora... Problem: httpd config

    This is not the sharp mode, just test mode in a closed network. What I meant was that not even chmod 777 allows the configuration through the post method. I have tried both apache and www users, without any luck. Any other ideas on what I might have missed? I really cannot find the reason to this 403 forbidden. I will try the nobody... Thank you.

    Btw, I added all users (apache and www) to the apache group, which is chowner of the files...
    Last edited by uplinked; 11-21-2010 at 11:09 AM.
    Best regards
    Uplinked.

    Link to my website: http://www.uplinked.x10hosting.com

  4. #4
    Brandon's Avatar
    Brandon is offline Former Senior Account Rep Brandon is on a distinguished road
    Join Date
    Jun 2006
    Location
    Tewksbury, MA
    Posts
    9,589

    Re: Please advice... OS: Fedora... Problem: httpd config

    Find and check your error_log, the reason will be in there.
    Thanks,
    Brandon Long

  5. #5
    uplinked's Avatar
    uplinked is offline x10Hosting Member uplinked is an unknown quantity at this point
    Join Date
    Oct 2008
    Location
    Malmö, Sweden
    Posts
    71

    Re: Please advice... OS: Fedora... Problem: httpd config

    Nothing shows in the error log, all I get is this 403 on POST in the access log and Preferences:Fail in the virtual desktop log. It must be the permissions somehow, as I had it up running before. But it won't work this time... I will try the nobody though and return. Thanks for your time!

    ---------- Post added at 06:50 PM ---------- Previous post was at 06:19 PM ----------

    I think I also had a headers already sent warning... Could this be it?
    Last edited by uplinked; 11-21-2010 at 11:50 AM.
    Best regards
    Uplinked.

    Link to my website: http://www.uplinked.x10hosting.com

  6. #6
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Please advice... OS: Fedora... Problem: httpd config

    If you comment out the <Limit POST> directive to make it accessible to all, does it work? If so, what is your <Limit POST> section? Do any other pages in the folder (assuming there are any) generate a 403 response when posting to them? If necessary, create a simple script in the same folder and request it with both a GET and a POST. Report the results here.

    ExecCGI should only be necessary if using mod_cgi. What handler are you using for the virtual desktop scripts?

    Quote Originally Posted by uplinked View Post
    chcon to cgi_exec_t [...] SeLinux is disabled.
    Shouldn't the security context be "httpd_sys_script_exec_t"? Of course, if SELinux is disabled, it shouldn't matter.

    Quote Originally Posted by uplinked View Post
    I think I also had a headers already sent warning... Could this be it?
    If you get a 403 response for a script resource, the request was never handed off to the script. A warning that headers were sent means that the request made it to that particular script. I very much doubt that early output from the script is somehow causing a 403.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  7. #7
    uplinked's Avatar
    uplinked is offline x10Hosting Member uplinked is an unknown quantity at this point
    Join Date
    Oct 2008
    Location
    Malmö, Sweden
    Posts
    71

    Re: Please advice... OS: Fedora... Problem: httpd config

    Hello

    Thank you both for your support to begin with... Well, I am reporting back the following:

    I enabled SELinux.

    The httpd config contains the following of interest for the document root:
    <Directory />
    Options +ExecCGI +Indexes FollowSymLinks
    AddHandler cgi-script .cgi
    AllowOverride Limit
    Order Allow,Deny
    Allow from all
    Allow from 127.0.0.1
    </Directory>
    My .htaccess only contains the following:
    <Limit GET POST>
    Order allow,deny
    Allow from all
    Allow from 127.0.0.1
    </Limit>
    - I tried a simple contact php-script as you suggested. I still get POST errors. I got the same results as with the virtual desktop files. My access_log looks like this:
    127.0.0.1 - - [22/Nov/2010:15:40:20 +0100] "POST /index.php HTTP/1.1" 403 312 "http://localhost/index.php" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.15) Gecko/2009102704 Fedora/3.0.15-1.fc10 Firefox/3.0.15"
    127.0.0.1 - - [22/Nov/2010:15:40:41 +0100] "GET /index.php HTTP/1.1" 200 2390 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.15) Gecko/2009102704 Fedora/3.0.15-1.fc10 Firefox/3.0.15"
    127.0.0.1 - - [22/Nov/2010:15:40:41 +0100] "GET /index.php HTTP/1.1" 200 2390 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.15) Gecko/2009102704 Fedora/3.0.15-1.fc10 Firefox/3.0.15"
    127.0.0.1 - - [22/Nov/2010:15:40:41 +0100] "GET /index.php HTTP/1.1" 200 2390 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.15) Gecko/2009102704 Fedora/3.0.15-1.fc10 Firefox/3.0.15"
    127.0.0.1 - - [22/Nov/2010:15:40:41 +0100] "GET /index.php HTTP/1.1" 200 2390 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.15) Gecko/2009102704 Fedora/3.0.15-1.fc10 Firefox/3.0.15"
    127.0.0.1 - - [22/Nov/2010:15:40:44 +0100] "POST /index.php HTTP/1.1" 403 312 "http://localhost/index.php" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.15) Gecko/2009102704 Fedora/3.0.15-1.fc10 Firefox/3.0.15"
    The error_log:
    [Mon Nov 22 15:40:38 2010] [notice] caught SIGTERM, shutting down
    [Mon Nov 22 15:40:39 2010] [notice] core dump file size limit raised to 4294967295 bytes
    [Mon Nov 22 15:40:39 2010] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
    [Mon Nov 22 15:40:40 2010] [notice] ModSecurity for Apache/2.5.10 (http://www.modsecurity.org/) configured.
    [Mon Nov 22 15:40:40 2010] [notice] Original server signature: Apache/2.2.14 (Fedora)
    [Mon Nov 22 15:40:40 2010] [notice] Digest: generating secret for digest authentication ...
    [Mon Nov 22 15:40:40 2010] [notice] Digest: done
    [Mon Nov 22 15:40:41 2010] [notice] mod_python: Creating 4 session mutexes based on 150 max processes and 0 max threads.
    [Mon Nov 22 15:40:41 2010] [notice] mod_python: using mutex_directory /tmp
    [Mon Nov 22 15:40:41 2010] [notice] Apache/2.2.14 (Unix) DAV/2 mod_auth_kerb/5.3 mod_auth_pgsql/2.0.3 mod_ssl/2.2.14 OpenSSL/0.9.8g PHP/5.2.9 mod_python/3.3.1 Python/2.5.2 mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming normal operations
    I tried to fix this unconfined_u error but it did not dissappear after relabelling.
    [Mon Nov 22 15:40:39 2010] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
    Any idea why?

    Also, my last change of ownership (besides nobody:nobody which didn't work either...) looks like this for the test file, in which I solely used the GET and POST methods:
    -rwxr-xr-x apache nobody system_u:object_r:httpd_sys_content_t:s0 .htaccess
    -rwxr-xr-x apache nobody system_u:object_r:httpd_sys_content_t:s0 index.php
    I am still getting the 403 forbidden. I don't know which script is used by the virtual desktop solution, the error is in the POST. I allowed cgi to be sure since I didn't have the time to go through all the files.

    Any new ideas please why I get 403 on POST?

    Thank you in advance!
    Best regards
    Uplinked.

    Link to my website: http://www.uplinked.x10hosting.com

  8. #8
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Please advice... OS: Fedora... Problem: httpd config

    What virtual desktop are you using? I suspect the problem lies there rather than with Apache or SELinux settings, given that GET works while POST doesn't, and that the virtual desktop logs an error (which shows it's processing the request). There's still a possibility SELinux could be involved.

    Quote Originally Posted by uplinked View Post
    I enabled SELinux.
    It's better to try to get everything working with SELinux disabled, so you can rule it out as a cause.


    Quote Originally Posted by uplinked View Post
    Code:
    <Limit GET POST>
        Order allow,deny
        Allow from all
        Allow from 127.0.0.1
    </Limit>
    The <Limit> is fine. Moreover, GET and POST are configured the same. Similarly, permission and ownership issues would affect GET and POST requests equally.

    Note: [CODE] is more appropriate than [QUOTE] for settings. Also, when quoting someone, anything in [QUOTE]s in their post are stripped out.



    If you're using mod_php to handle PHP, whether or not ExecCGI is set won't matter. It's only important when running PHP in CGI or FastCGI mode. That the index.php is in the httpd_sys_content_t context strongly suggests you're using mod_php.

    Quote Originally Posted by uplinked View Post
    I tried to fix this unconfined_u error but it did not dissappear after relabelling.
    The line mentioning "unconfined_u" isn't an error. It just means httpd is running as an unconfined user, which is typical. What's more important is that httpd is running in the httpd_t context, which is proper.

    Quote Originally Posted by uplinked View Post
    -rwxr-xr-x apache nobody system_u:object_r:httpd_sys_content_t:s0 index.php
    As previously suggested, try placing the scripts in the httpd_sys_script_exec_t context. They could be failing when SELinux is enabled because the script is trying to access something it doesn't have access to. You might need to find out what that is, then place it in the httpd_sys_content_t context.

    The time period for the error_log excerpt doesn't include the POST requests. You mentioned that there was nothing in the error log for earlier failed POSTs; does this still hold true for the POSTs logged above (22/Nov/2010:15:40:20 and 22/Nov/2010:15:40:44)?

    You might want to ask a question on ServerFault/, if it doesn't turn out to be the virtual desktop.
    Last edited by misson; 11-23-2010 at 11:27 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  9. #9
    uplinked's Avatar
    uplinked is offline x10Hosting Member uplinked is an unknown quantity at this point
    Join Date
    Oct 2008
    Location
    Malmö, Sweden
    Posts
    71

    Re: Please advice... OS: Fedora... Problem: httpd config

    Thank you for your explanations... However, I had SELinux enabled now for more detailed trouble-shooting in the logs. My virtual desktop is Ulteo OVD. It must run with SeLinux disabled. Yet, even with SELinux disabled, I still get the 403. Even after removing the SELinux module or after setting all content to httpd_sys_script_exec_t and then removing SeLinux completely. I kept it on the server, in the disabled mode in the case I need to relabel.

    Yes, the logs are as published above... No POST in the error_log, just access_log.

    I had this OVD configured and running once before, but it won't work now. I went through a lot of trouble that time as well. It is different now though... The results published above are the outcome of a simple php.script, a contact form with GET for the fields and POST set to PHP_SELF. This shouldn't be the outcome of a simple POST request... yet it is. I posted this here in the case you guys had experienced this at home...

    The log from the OVD does not behave differently at all. The same 403 on POST. I will try to locate it. It complains about not having access to some .js files and some .php-files which it needs for its partial configuration before summing it up in sum-config.php. But the files should be accessible. The same applies to the contact script.

    Is there a chance that I could get to read a complete http.conf file which allows the simple execution of a php-contact script to see if I missed something?

    Well, until then, I'll keep trying. If anyone successfully installs this OVD-software on a Fedora server, please let me know and share your success...
    Last edited by uplinked; 11-24-2010 at 05:02 AM. Reason: Mistyping
    Best regards
    Uplinked.

    Link to my website: http://www.uplinked.x10hosting.com

  10. #10
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Please advice... OS: Fedora... Problem: httpd config

    Quote Originally Posted by uplinked View Post
    The results published above are the outcome of a simple php.script, a contact form with GET for the fields and POST set to PHP_SELF. This shouldn't be the outcome of a simple POST request... yet it is. I posted this here in the case you guys had experienced this at home...
    Duh. So we can mostly rule out v. desktop settings. Next thing to test is to create a CGI script in the same folder (since it's configured to run them) and try GETting it and POSTing to it. This should tell us if the issue lies with the PHP module or elsewhere.

    Quote Originally Posted by uplinked View Post
    The log from the OVD does not behave differently at all. The same 403 on POST. I will try to locate it. It complains about not having access to some .js files and some .php-files which it needs for its partial configuration before summing it up in sum-config.php. But the files should be accessible. The same applies to the contact script.
    Are the JS accessed server side? You can use the POSIX functions to get the real and effective user IDs the script process is running as, then make sure that that user has appropriate access to the files mentioned in the log. You might want to throw in a file_exists and is_readable to check within the script.

    Quote Originally Posted by uplinked View Post
    Is there a chance that I could get to read a complete http.conf file which allows the simple execution of a php-contact script to see if I missed something?
    The httpd configuration file templates are available via SVN. Google lists plenty of example httpd.conf for PHP. I don't know of any in particular that would be helpful for you to look at.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Please advice... OS: Fedora... Problem: httpd configuration...
    By uplinked in forum Scripts & 3rd Party Apps
    Replies: 1
    Last Post: 11-21-2010, 10:58 AM
  2. php config problem?
    By nashua in forum Free Hosting
    Replies: 1
    Last Post: 08-18-2008, 06:47 PM
  3. PHP Config Problem
    By Mohron in forum Free Hosting
    Replies: 3
    Last Post: 04-28-2008, 01:10 AM
  4. IPB config problem
    By george7004 in forum Free Hosting
    Replies: 7
    Last Post: 12-11-2005, 07:47 PM
  5. httpd problem
    By svepe in forum Free Hosting
    Replies: 1
    Last Post: 10-12-2005, 06:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers