Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Néstor Boscán
Hi

I've been trying to configure Apache and Python 2.7 on Red Hat. I've tried
the different configurations i've seen on the web, I've given chmod -R 777
tu my python code but I still get 403 Forbidden and I don't get any errors.

Regards,

N?stor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150612/613cb174/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

zhou weitao
selinux is causing this, I guess. Please try run *setenforce 1* to bypass
it firstly. If it works then google the related configuration.


from ex-redhatter

2015-06-12 20:51 GMT+08:00 N?stor Bosc?n <nestorjb at gmail.com>:

> Hi
>
> I've been trying to configure Apache and Python 2.7 on Red Hat. I've tried
> the different configurations i've seen on the web, I've given chmod -R 777
> tu my python code but I still get 403 Forbidden and I don't get any errors.
>
> Regards,
>
> N?stor
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150613/10883343/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Néstor Boscán
Tried it and I keep having the same error. Isn't there a log file where I
can check what is causing this?

Regards,

N?stor

On Sat, Jun 13, 2015 at 8:47 AM, zhou weitao <zhouwtlord at gmail.com> wrote:

> selinux is causing this, I guess. Please try run *setenforce 1* to bypass
> it firstly. If it works then google the related configuration.
>
>
> from ex-redhatter
>
> 2015-06-12 20:51 GMT+08:00 N?stor Bosc?n <nestorjb at gmail.com>:
>
>> Hi
>>
>> I've been trying to configure Apache and Python 2.7 on Red Hat. I've
>> tried the different configurations i've seen on the web, I've given chmod
>> -R 777 tu my python code but I still get 403 Forbidden and I don't get any
>> errors.
>>
>> Regards,
>>
>> N?stor
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150615/38dc45ff/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Steven D'Aprano-11
In reply to this post by zhou weitao
On Tuesday 16 June 2015 13:31, N?stor Bosc?n wrote:

> Tried it and I keep having the same error. Isn't there a log file where I
> can check what is causing this?

Probably. Have you googled for "selinux log file"?

We're not experts on SELinux, this is a Python mailing list, not a
specialist SELinux one, so most of us here would have to google for
information of SELinux in order to answer.

What happens if you try to just download the python file instead of run it?
Do you still get a 404? If so, that proves it's not a Python issue, it's
something to do with Apache, file permissions, or SELinux.


--
Steve


Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Néstor Boscán
Hi

I disabled selinux completely and the page worked.

Regards,

Nestor

On Tuesday, June 16, 2015, Steven D'Aprano <
steve+comp.lang.python at pearwood.info> wrote:

> On Tuesday 16 June 2015 13:31, N?stor Bosc?n wrote:
>
> > Tried it and I keep having the same error. Isn't there a log file where I
> > can check what is causing this?
>
> Probably. Have you googled for "selinux log file"?
>
> We're not experts on SELinux, this is a Python mailing list, not a
> specialist SELinux one, so most of us here would have to google for
> information of SELinux in order to answer.
>
> What happens if you try to just download the python file instead of run it?
> Do you still get a 404? If so, that proves it's not a Python issue, it's
> something to do with Apache, file permissions, or SELinux.
>
>
> --
> Steve
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150616/e8ecef5f/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Chris Warrick
On Tue, Jun 16, 2015 at 12:11 PM, N?stor Bosc?n <nestorjb at gmail.com> wrote:
> I disabled selinux completely and the page worked.

So, selinux was the problem (which is typical, it?s a really dumb
piece of software)

The command to disable enforcing temporarily is actually "setenforce
0". Though you would need to issue it on every restart if you did not
change the config file.

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Néstor Boscán
I tried that but it didn't work.

 I had to change /etc/selinux/config and reboot to make it work. It would
be nice if the wsgi module generated some log that explains why you get the
403. There are several posibilities.

Regards,

Nestor

On Tuesday, June 16, 2015, Chris Warrick <kwpolska at gmail.com> wrote:

> On Tue, Jun 16, 2015 at 12:11 PM, N?stor Bosc?n <nestorjb at gmail.com
> <javascript:;>> wrote:
> > I disabled selinux completely and the page worked.
>
> So, selinux was the problem (which is typical, it?s a really dumb
> piece of software)
>
> The command to disable enforcing temporarily is actually "setenforce
> 0". Though you would need to issue it on every restart if you did not
> change the config file.
>
> --
> Chris Warrick <https://chriswarrick.com/>
> PGP: 5EAAEA16
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150616/df023783/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Chris Warrick
On Tue, Jun 16, 2015 at 8:14 PM, N?stor Bosc?n <nestorjb at gmail.com> wrote:
> I tried that but it didn't work.
>
>  I had to change /etc/selinux/config and reboot to make it work. It would be
> nice if the wsgi module generated some log that explains why you get the
> 403. There are several posibilities.

Well, that?s not wsgi?s fault.  There was a ?permission denied? error,
that?s everything wsgi ever knew.
As a RHEL sysadmin, you should know that this is most likely caused by
braindead syslinux and to read the audit log.

PS. please don?t top-post.

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Néstor Boscán
On Tuesday, June 16, 2015, Chris Warrick <kwpolska at gmail.com> wrote:

> On Tue, Jun 16, 2015 at 8:14 PM, N?stor Bosc?n <nestorjb at gmail.com
> <javascript:;>> wrote:
> > I tried that but it didn't work.
> >
> >  I had to change /etc/selinux/config and reboot to make it work. It
> would be
> > nice if the wsgi module generated some log that explains why you get the
> > 403. There are several posibilities.
>
> Well, that?s not wsgi?s fault.  There was a ?permission denied? error,
> that?s everything wsgi ever knew.
> As a RHEL sysadmin, you should know that this is most likely caused by
> braindead syslinux and to read the audit log.
>
> PS. please don?t top-post.
>
> --
> Chris Warrick <https://chriswarrick.com/>
> PGP: 5EAAEA16
>

Yes but it could log which os file was it trying to access.

Thanks for all the replies.

Regards,

Nestor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150616/7eec935c/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Chris Angelico
On Wed, Jun 17, 2015 at 4:22 AM, N?stor Bosc?n <nestorjb at gmail.com> wrote:

>> On Tue, Jun 16, 2015 at 8:14 PM, N?stor Bosc?n <nestorjb at gmail.com> wrote:
>> > I tried that but it didn't work.
>> >
>> >  I had to change /etc/selinux/config and reboot to make it work. It
>> > would be
>> > nice if the wsgi module generated some log that explains why you get the
>> > 403. There are several posibilities.
>>
>> Well, that?s not wsgi?s fault.  There was a ?permission denied? error,
>> that?s everything wsgi ever knew.
>> As a RHEL sysadmin, you should know that this is most likely caused by
>> braindead syslinux and to read the audit log.
>
>
> Yes but it could log which os file was it trying to access.

If you want to know what a program was doing when it got some error,
the obvious sledgehammer to reach for is strace. Cutting the situation
down to size so you can actually find what you want in strace's
output, now, that's a whole new problem. But the information will be
there. You want a log? Be careful what you wish for, you might get one
that spews more text than python-list does :)

ChrisA

Reply | Threaded
Open this post in threaded view
|

Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

Michael Torrie
In reply to this post by Chris Warrick
On 06/16/2015 12:19 PM, Chris Warrick wrote:

> On Tue, Jun 16, 2015 at 8:14 PM, N?stor Bosc?n <nestorjb at gmail.com> wrote:
>> I tried that but it didn't work.
>>
>>  I had to change /etc/selinux/config and reboot to make it work. It would be
>> nice if the wsgi module generated some log that explains why you get the
>> 403. There are several posibilities.
>
> Well, that?s not wsgi?s fault.  There was a ?permission denied? error,
> that?s everything wsgi ever knew.
> As a RHEL sysadmin, you should know that this is most likely caused by
> braindead syslinux and to read the audit log.

The officially-blessed software collections has a version of python2.7
that should work fine with selinux, and it comes with a mod_wsgi module
that will plug it into the stock apache.

https://www.softwarecollections.org/en/scls/rhscl/python27/
https://rhn.redhat.com/errata/RHBA-2014-0610.html

I think the package is called python27-mod_wsgi