Serious Privileges Problem: Please Help

View: New views
19 Messages — Rating Filter:   Alert me  

Serious Privileges Problem: Please Help

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a serious privileges problem that is making it impossible to serve python pages on a CentOS server. It appears that nobody on the CentOS discussion list has a solution to this problem. I'm desperate and hoping someone on this list can help.

[Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] (2)No such file or
directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py'
failed, referer: http://angrynates.com/global_solutions/
[Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] Premature end of
script headers: index.py, referer: http://angrynates.com/global_solutions/

Now, the file does exist:

[root@13gems global_solutions]# pwd
/var/www/html/angrynates.com/global_solutions
[root@13gems global_solutions]# ls
....
-rwxr-xr-x 1 victor victor 275 Nov 6 07:05 index.py
....
and it serves just fine on another server, so there is no "premature end of script headers".


Here's where it gets really weird. If I copy the code for index.py and template.py which the former calls, and create files test.py and test2.py and paste the code from the former files in those new files changing only the import statement from "template" to "test2", the tests will resolve!! Now, the ownership and mode are identical on all of them!!


[root@13gems global_solutions]# ls -al | grep test.py
-rwxr-xr-x 1 root root 298 Nov 6 12:24 test.py
[root@13gems global_solutions]# ls -al | grep test2.py
-rwxr-xr-x 1 root root 5716 Nov 6 12:25 test2.py
[root@13gems global_solutions]# ls -al | grep index.py
-rwxr-xr-x 1 root root 316 Nov 6 07:05 index.py
[root@13gems global_solutions]# ls -al | grep template.py
-rwxr-xr-x 1 root root 5806 Nov 6 07:06 template.py
-rwxr-xr-x 1 root root 6093 Nov 6 07:06 template.pyc

where test.py is identical to index.py (other than the necessary import) and
template is identical to test2.py


fixfiles relabel /var/www/html
# might just work
It didn't

touch /.autorelabel
# and then reboot will relabel all copied files to the correct contexts for the location
I rebooted apache with no luck

or you could turn off SELinux and reboot
I did that and the following two solutions with no luck:
echo 0 >/selinux/enforce

[root@13gems ~]# cd /etc/
[root@13gems etc]# mv selinux/ selinux.BAK
[root@13gems etc]# mkdir selinux
[root@13gems etc]# echo 0>/selinux/enforce

...and the problem continues:
[root@13gems etc]# tail /var/log/httpd/error_log
[Fri Nov 06 12:51:49 2009] [error] [client 66.248.168.98] Premature end of
script headers: index.py, referer: http://angrynates.com/global_solutions/
[Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] (2)No such file or
directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py'
failed, referer: http://angrynates.com/global_solutions/
[Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] Premature end of
script headers: index.py, referer: http://angrynates.com/global_solutions/
[Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] (2)No such file or
directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py'
failed
[Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] Premature end of
script headers: index.py
[Fri Nov 06 13:52:15 2009] [error] [client 66.249.67.153] File does not
exist: /var/www/html/angrynates.com/robots.txt
[Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] (2)No such file or
directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py'
failed, referer: http://angrynates.com/global_solutions/
[Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] Premature end of
script headers: index.py, referer: http://angrynates.com/global_solutions/
[Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] File does not
exist: /var/www/html/angrynates.com/favicon.ico
[Fri Nov 06 13:52:53 2009] [error] [client 208.84.198.58] File does not
exist: /var/www/html/angrynates.com/favicon.ico
[root@13gems etc]#

Please help.
Victor

--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Rami Chowdhury :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Saturday 07 November 2009 06:13:11 Victor Subervi wrote:

> I have a serious privileges problem that is making it impossible to serve
> python pages on a CentOS server. It appears that nobody on the CentOS
> discussion list has a solution to this problem. I'm desperate and hoping
> someone on this list can help.
>
> [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] (2)No such file
>  or directory: exec of
>  '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer:
>  http://angrynates.com/global_solutions/
> [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] Premature end of
> script headers: index.py, referer: http://angrynates.com/global_solutions/
>
> Now, the file does exist:
>
> [root@13gems global_solutions]# pwd
> /var/www/html/angrynates.com/global_solutions
> [root@13gems global_solutions]# ls
> ....
> -rwxr-xr-x 1 victor victor 275 Nov 6 07:05 index.py
> ....
> and it serves just fine on another server, so there is no "premature end of
> script headers".
>
>
> Here's where it gets really weird. If I copy the code for index.py and
> template.py which the former calls, and create files test.py and test2.py
> and paste the code from the former files in those new files changing only
> the import statement from "template" to "test2", the tests will resolve!!
> Now, the ownership and mode are identical on all of them!!
>
>
> [root@13gems global_solutions]# ls -al | grep test.py
> -rwxr-xr-x 1 root root 298 Nov 6 12:24 test.py
> [root@13gems global_solutions]# ls -al | grep test2.py
> -rwxr-xr-x 1 root root 5716 Nov 6 12:25 test2.py
> [root@13gems global_solutions]# ls -al | grep index.py
> -rwxr-xr-x 1 root root 316 Nov 6 07:05 index.py
> [root@13gems global_solutions]# ls -al | grep template.py
> -rwxr-xr-x 1 root root 5806 Nov 6 07:06 template.py
> -rwxr-xr-x 1 root root 6093 Nov 6 07:06 template.pyc
>
> where test.py is identical to index.py (other than the necessary import)
>  and template is identical to test2.py
>
>
> fixfiles relabel /var/www/html
> # might just work
> It didn't
>
> touch /.autorelabel
> # and then reboot will relabel all copied files to the correct contexts for
> the location
> I rebooted apache with no luck
>
> or you could turn off SELinux and reboot
> I did that and the following two solutions with no luck:
> echo 0 >/selinux/enforce
>
> [root@13gems ~]# cd /etc/
> [root@13gems etc]# mv selinux/ selinux.BAK
> [root@13gems etc]# mkdir selinux
> [root@13gems etc]# echo 0>/selinux/enforce
>
> ...and the problem continues:
> [root@13gems etc]# tail /var/log/httpd/error_log
> [Fri Nov 06 12:51:49 2009] [error] [client 66.248.168.98] Premature end of
> script headers: index.py, referer: http://angrynates.com/global_solutions/
> [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] (2)No such file
>  or directory: exec of
>  '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer:
>  http://angrynates.com/global_solutions/
> [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] Premature end of
> script headers: index.py, referer: http://angrynates.com/global_solutions/
> [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] (2)No such file or
> directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py'
> failed
> [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] Premature end of
> script headers: index.py
> [Fri Nov 06 13:52:15 2009] [error] [client 66.249.67.153] File does not
> exist: /var/www/html/angrynates.com/robots.txt
> [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] (2)No such file
>  or directory: exec of
>  '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer:
>  http://angrynates.com/global_solutions/
> [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] Premature end of
> script headers: index.py, referer: http://angrynates.com/global_solutions/
> [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] File does not
> exist: /var/www/html/angrynates.com/favicon.ico
> [Fri Nov 06 13:52:53 2009] [error] [client 208.84.198.58] File does not
> exist: /var/www/html/angrynates.com/favicon.ico
> [root@13gems etc]#
>
> Please help.
> Victor
>

Can we see the output of 'ls -lZ' and 'fixfiles check' on those directories,
and see what the Apache (httpd.conf or .htaccess) configuration is for them?

----
Rami Chowdhury
"Passion is inversely proportional to the amount of real information
available." -- Benford's Law of Controversy
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

httpd.conf:

<VirtualHost *:80>
ServerAdmin me@...
DocumentRoot /var/www/html/angrynates.com
ServerName angrynates.com
Options +ExecCGI -IncludesNoExec
<Directory /var/www/html/angrynates.com/global_solutions/*>
 Options +ExecCGI
 AllowOverride Options
 AllowOverride FileInfo
 #AddHandler mod_python .py
 #PythonHandler mod_python.publisher
 #PythonDebug On

</Directory>
</VirtualHost>


#ls -lZ
drwxr-xr-x  root root                                  1024
drwxr-xr-x  root root                                  1132
drwxr-xr-x  root root                                  1255
-rwxr-xr-x  root root                                  About_Us_frame.py
-rwxr-xr-x  root root                                  About_Us.py
-rwxr-xr-x  root root                                  ajax.cgi.txt
-rwxr-xr-x  root root                                  ajax.html
-rwxr-xr-x  root root                                  Catalog_frame.py
-rwxr-xr-x  root root                                  Catalog.py
-rwxr-xr-x  root root                                  cats_edit2.py
-rwxr-xr-x  root root                                  cats_edit.py
-rwxr-xr-x  root root                                  client2.py
-rwxr-xr-x  root root                                  client_delete2.py
-rwxr-xr-x  root root                                  client_delete.py
-rwxr-xr-x  root root                                  client_edit2.py
-rwxr-xr-x  root root                                  client_edit3.py
-rwxr-xr-x  root root                                  client_edit.py
-rwxr-xr-x  root root                                  client.py
-rwxr-xr-x  root root                                  Contact_Us_frame.py
-rwxr-xr-x  root root                                  Contact_Us.py
-rwxr-xr-x  root root                                  credit_app.doc
-rwxr-xr-x  root root                                  Credit Application DP Dist .doc
-rwxr-xr-x  root root                                  Customer_Templates_frame.py
-rwxr-xr-x  root root                                  Customer_Templates.py
-rwxr-xr-x  root root                                  display_spreadsheet2.py
-rwxr-xr-x  root root                                  display_spreadsheet.py
-rwxr-xr-x  root root                                  EDDIE-Tool-1.0.0.tar.gz
-rwxr-xr-x  root root                                  email.py
-rwxr-xr-x  root root                                  error.log.0
-rwxr-xr-x  root root                                  favicon.gif
-rwxr-xr-x  root root                                  favicon.ico
-rwxr-xr-x  root root                                  Forms_frame.py
-rwxr-xr-x  root root                                  Forms.py
-rwxr-xr-x  root root                                  fw9.pdf
-rwxr-xr-x  root root                                  getResolution.py
-rw-r--r--  root root                                  hello.py
drwxr-xr-x  root root                                  images
drwxr-xr-x  root root                                  images1024
drwxr-xr-x  root root                                  images1132
drwxr-xr-x  root root                                  images1255
drwxr-xr-x  root root                                  images-old
-rwxr-xr-x  root root                                  index_frame.py
-rwxr-xr-x  root root                                  index.html
-rwxr-xr-x  root root                                  index.py
-rwxr-xr-x  root root                                  login.py
-rwxr-xr-x  root root                                  login.pyc
-rwxr-xr-x  root root                                  Office_Supplies_frame.py
-rwxr-xr-x  root root                                  Office_Supplies.py
-rwxr-xr-x  root root                                  Paper_Plastics_frame.py
-rwxr-xr-x  root root                                  Paper_Plastics.py
-rwxr-xr-x  root root                                  particulars.py
-rwxr-xr-x  root root                                  particulars.pyc
drwxr-xr-x  root root                                  pics
-rwxr-xr-x  root root                                  ping.py
-rwxr-xr-x  root root                                  products2.py
-rwxr-xr-x  root root                                  products3.py
-rwxr-xr-x  root root                                  products_cats.py
-rwxr-xr-x  root root                                  products_delete2.py
-rwxr-xr-x  root root                                  products_delete3.py
-rwxr-xr-x  root root                                  products_delete.py
-rwxr-xr-x  root root                                  products_edit2.py
-rwxr-xr-x  root root                                  products_edit3.py
-rwxr-xr-x  root root                                  products_edit.py
-rwxr-xr-x  root root                                  products_items.py
-rwxr-xr-x  root root                                  products_move2.py
-rwxr-xr-x  root root                                  products_move3.py
-rwxr-xr-x  root root                                  products_move.py
-rwxr-xr-x  root root                                  salesperson2.py
-rwxr-xr-x  root root                                  salesperson_delete2.py
-rwxr-xr-x  root root                                  salesperson_delete.py
-rwxr-xr-x  root root                                  salesperson_edit2.py
-rwxr-xr-x  root root                                  salesperson_edit3.py
-rwxr-xr-x  root root                                  salesperson_edit.py
-rwxr-xr-x  root root                                  salesperson.py
drwxr-xr-x  root root                                  simplemail
-rwxr-xr-x  root root                                  spreadsheet2.py
-rwxr-xr-x  root root                                  spreadsheet3.py
-rwxr-xr-x  root root                                  spreadsheet4.py
-rwxr-xr-x  root root                                  spreadsheet_delete2.py
-rwxr-xr-x  root root                                  spreadsheet_delete.py
-rwxr-xr-x  root root                                  spreadsheet_delete_rows2.py
-rwxr-xr-x  root root                                  spreadsheet_delete_rows3.py
-rwxr-xr-x  root root                                  spreadsheet_delete_rows.py
-rwxr-xr-x  root root                                  spreadsheet_edit2.py
-rwxr-xr-x  root root                                  spreadsheet_edit3.py
-rwxr-xr-x  root root                                  spreadsheet_edit.py
-rwxr-xr-x  root root                                  spreadsheet.py
drwxr-xr-x  root root                                  spreadsheets
-rwxr-xr-x  root root                                  start.py
-rwxr-xr-x  root root                                  stuff.txt
-rwxr-xr-x  root root                                  templateFrame.py
-rwxr-xr-x  root root                                  templateFrame.pyc
-rwxr-xr-x  root root                                  template.py
-rwxrwxrwx  root root                                  template.pyc
-rwxr-xr-x  root root                                  test2.py
-rw-r--r--  root root                                  test2.pyc
-rwxr-xr-x  root root                                  test.html
-rwxr-xr-x  root root                                  test.py
-rwxr-xr-x  root root                                  tsd_sales_tax_dealer_or_purchaser_exemption_certificate_st5.pdf



On Sat, Nov 7, 2009 at 4:09 PM, Rami Chowdhury <rami.chowdhury@...> wrote:
On Saturday 07 November 2009 06:13:11 Victor Subervi wrote:
> I have a serious privileges problem that is making it impossible to serve
> python pages on a CentOS server. It appears that nobody on the CentOS
> discussion list has a solution to this problem. I'm desperate and hoping
> someone on this list can help.
>
> [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] (2)No such file
>  or directory: exec of
>  '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer:
>  http://angrynates.com/global_solutions/
> [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] Premature end of
> script headers: index.py, referer: http://angrynates.com/global_solutions/
>
> Now, the file does exist:
>
> [root@13gems global_solutions]# pwd
> /var/www/html/angrynates.com/global_solutions
> [root@13gems global_solutions]# ls
> ....
> -rwxr-xr-x 1 victor victor 275 Nov 6 07:05 index.py
> ....
> and it serves just fine on another server, so there is no "premature end of
> script headers".
>
>
> Here's where it gets really weird. If I copy the code for index.py and
> template.py which the former calls, and create files test.py and test2.py
> and paste the code from the former files in those new files changing only
> the import statement from "template" to "test2", the tests will resolve!!
> Now, the ownership and mode are identical on all of them!!
>
>
> [root@13gems global_solutions]# ls -al | grep test.py
> -rwxr-xr-x 1 root root 298 Nov 6 12:24 test.py
> [root@13gems global_solutions]# ls -al | grep test2.py
> -rwxr-xr-x 1 root root 5716 Nov 6 12:25 test2.py
> [root@13gems global_solutions]# ls -al | grep index.py
> -rwxr-xr-x 1 root root 316 Nov 6 07:05 index.py
> [root@13gems global_solutions]# ls -al | grep template.py
> -rwxr-xr-x 1 root root 5806 Nov 6 07:06 template.py
> -rwxr-xr-x 1 root root 6093 Nov 6 07:06 template.pyc
>
> where test.py is identical to index.py (other than the necessary import)
>  and template is identical to test2.py
>
>
> fixfiles relabel /var/www/html
> # might just work
> It didn't
>
> touch /.autorelabel
> # and then reboot will relabel all copied files to the correct contexts for
> the location
> I rebooted apache with no luck
>
> or you could turn off SELinux and reboot
> I did that and the following two solutions with no luck:
> echo 0 >/selinux/enforce
>
> [root@13gems ~]# cd /etc/
> [root@13gems etc]# mv selinux/ selinux.BAK
> [root@13gems etc]# mkdir selinux
> [root@13gems etc]# echo 0>/selinux/enforce
>
> ...and the problem continues:
> [root@13gems etc]# tail /var/log/httpd/error_log
> [Fri Nov 06 12:51:49 2009] [error] [client 66.248.168.98] Premature end of
> script headers: index.py, referer: http://angrynates.com/global_solutions/
> [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] (2)No such file
>  or directory: exec of
>  '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer:
>  http://angrynates.com/global_solutions/
> [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] Premature end of
> script headers: index.py, referer: http://angrynates.com/global_solutions/
> [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] (2)No such file or
> directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py'
> failed
> [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] Premature end of
> script headers: index.py
> [Fri Nov 06 13:52:15 2009] [error] [client 66.249.67.153] File does not
> exist: /var/www/html/angrynates.com/robots.txt
> [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] (2)No such file
>  or directory: exec of
>  '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer:
>  http://angrynates.com/global_solutions/
> [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] Premature end of
> script headers: index.py, referer: http://angrynates.com/global_solutions/
> [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] File does not
> exist: /var/www/html/angrynates.com/favicon.ico
> [Fri Nov 06 13:52:53 2009] [error] [client 208.84.198.58] File does not
> exist: /var/www/html/angrynates.com/favicon.ico
> [root@13gems etc]#
>
> Please help.
> Victor
>

Can we see the output of 'ls -lZ' and 'fixfiles check' on those directories,
and see what the Apache (httpd.conf or .htaccess) configuration is for them?

----
Rami Chowdhury
"Passion is inversely proportional to the amount of real information
available." -- Benford's Law of Controversy
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)


--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Rami Chowdhury :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Saturday 07 November 2009 13:51:06 Victor Subervi wrote:
> httpd.conf:
>
> <VirtualHost *:80>
> ServerAdmin me@...
> DocumentRoot /var/www/html/angrynates.com
> ServerName angrynates.com
> Options +ExecCGI -IncludesNoExec
> <Directory /var/www/html/angrynates.com/global_solutions/*>

You may want to change this to:
        <Directory /var/www/html/angrynates.com/global_solutions>

If you want regular expression syntax, I would advise using the syntax
        <Directory ~ EXPRESSION>
or
        <DirectoryMatch ~ EXPRESSION>

> #ls -lZ
> drwxr-xr-x  root root                                  1024
> drwxr-xr-x  root root                                  1132
> drwxr-xr-x  root root                                  1255
[snip]

It looks like you don't have *any* SELinux context information; if SELinux is
on, this will cause problems. Try using the 'restorecon' command to put the
defaults in place, and consider using 'chcon' to change the security context
to an appropriate one (I believe you want something like
'unconfined_u:object_r:httpd_sys_content_t' for Apache content).

>
> On Sat, Nov 7, 2009 at 4:09 PM, Rami Chowdhury
<rami.chowdhury@...>wrote:

> > On Saturday 07 November 2009 06:13:11 Victor Subervi wrote:
> > > I have a serious privileges problem that is making it impossible to
> > > serve python pages on a CentOS server. It appears that nobody on the
> > > CentOS discussion list has a solution to this problem. I'm desperate
> > > and hoping someone on this list can help.
> > >
> > > [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] (2)No such
> > > file or directory: exec of
> > >  '/var/www/html/angrynates.com/global_solutions/index.py' failed,
> >
> > referer:
> > >  http://angrynates.com/global_solutions/
> > > [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] Premature end
> >
> > of
> >
> > > script headers: index.py, referer:
> >
> > http://angrynates.com/global_solutions/
> >
> > > Now, the file does exist:
> > >
> > > [root@13gems global_solutions]# pwd
> > > /var/www/html/angrynates.com/global_solutions
> > > [root@13gems global_solutions]# ls
> > > ....
> > > -rwxr-xr-x 1 victor victor 275 Nov 6 07:05 index.py
> > > ....
> > > and it serves just fine on another server, so there is no "premature
> > > end
> >
> > of
> >
> > > script headers".
> > >
> > >
> > > Here's where it gets really weird. If I copy the code for index.py and
> > > template.py which the former calls, and create files test.py and
> > > test2.py and paste the code from the former files in those new files
> > > changing only the import statement from "template" to "test2", the
> > > tests will resolve!! Now, the ownership and mode are identical on all
> > > of them!!
> > >
> > >
> > > [root@13gems global_solutions]# ls -al | grep test.py
> > > -rwxr-xr-x 1 root root 298 Nov 6 12:24 test.py
> > > [root@13gems global_solutions]# ls -al | grep test2.py
> > > -rwxr-xr-x 1 root root 5716 Nov 6 12:25 test2.py
> > > [root@13gems global_solutions]# ls -al | grep index.py
> > > -rwxr-xr-x 1 root root 316 Nov 6 07:05 index.py
> > > [root@13gems global_solutions]# ls -al | grep template.py
> > > -rwxr-xr-x 1 root root 5806 Nov 6 07:06 template.py
> > > -rwxr-xr-x 1 root root 6093 Nov 6 07:06 template.pyc
> > >
> > > where test.py is identical to index.py (other than the necessary
> > > import) and template is identical to test2.py
> > >
> > >
> > > fixfiles relabel /var/www/html
> > > # might just work
> > > It didn't
> > >
> > > touch /.autorelabel
> > > # and then reboot will relabel all copied files to the correct contexts
> >
> > for
> >
> > > the location
> > > I rebooted apache with no luck
> > >
> > > or you could turn off SELinux and reboot
> > > I did that and the following two solutions with no luck:
> > > echo 0 >/selinux/enforce
> > >
> > > [root@13gems ~]# cd /etc/
> > > [root@13gems etc]# mv selinux/ selinux.BAK
> > > [root@13gems etc]# mkdir selinux
> > > [root@13gems etc]# echo 0>/selinux/enforce
> > >
> > > ...and the problem continues:
> > > [root@13gems etc]# tail /var/log/httpd/error_log
> > > [Fri Nov 06 12:51:49 2009] [error] [client 66.248.168.98] Premature end
> >
> > of
> >
> > > script headers: index.py, referer:
> >
> > http://angrynates.com/global_solutions/
> >
> > > [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] (2)No such
> > > file or directory: exec of
> > >  '/var/www/html/angrynates.com/global_solutions/index.py' failed,
> >
> > referer:
> > >  http://angrynates.com/global_solutions/
> > > [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] Premature end
> >
> > of
> >
> > > script headers: index.py, referer:
> >
> > http://angrynates.com/global_solutions/
> >
> > > [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] (2)No such
> > > file
> >
> > or
> >
> > > directory: exec of '/var/www/html/
> >
> > angrynates.com/global_solutions/index.py'
> >
> > > failed
> > > [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] Premature end
> > > of script headers: index.py
> > > [Fri Nov 06 13:52:15 2009] [error] [client 66.249.67.153] File does not
> > > exist: /var/www/html/angrynates.com/robots.txt
> > > [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] (2)No such
> > > file or directory: exec of
> > >  '/var/www/html/angrynates.com/global_solutions/index.py' failed,
> >
> > referer:
> > >  http://angrynates.com/global_solutions/
> > > [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] Premature end
> >
> > of
> >
> > > script headers: index.py, referer:
> >
> > http://angrynates.com/global_solutions/
> >
> > > [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] File does not
> > > exist: /var/www/html/angrynates.com/favicon.ico
> > > [Fri Nov 06 13:52:53 2009] [error] [client 208.84.198.58] File does not
> > > exist: /var/www/html/angrynates.com/favicon.ico
> > > [root@13gems etc]#
> > >
> > > Please help.
> > > Victor
> >
> > Can we see the output of 'ls -lZ' and 'fixfiles check' on those
> > directories,
> > and see what the Apache (httpd.conf or .htaccess) configuration is for
> > them?
> >
> > ----
> > Rami Chowdhury
> > "Passion is inversely proportional to the amount of real information
> > available." -- Benford's Law of Controversy
> > 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
>


----
Rami Chowdhury
"Strangers are just friends who haven't had enough gin." -- Howdle's Saying
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

restorecon didn't change ls -lZ output
Can you give me the exact command for chcon? It complains there are too few arguments, and I couldn't figure it out.
Does this really matter? I moved the selinux folder and its contents as well as sent an "echo 0>..." command to kill it. Furthermore, 
[root@13gems global_solutions]# ps wax|grep selinux
17645 pts/0    S+     0:00 grep selinux
Please advise.
V

On Sat, Nov 7, 2009 at 5:49 PM, Rami Chowdhury <rami.chowdhury@...> wrote:

On Saturday 07 November 2009 13:51:06 Victor Subervi wrote:
> httpd.conf:
>
> <VirtualHost *:80>
> ServerAdmin me@...
> DocumentRoot /var/www/html/angrynates.com
> ServerName angrynates.com
> Options +ExecCGI -IncludesNoExec
> <Directory /var/www/html/angrynates.com/global_solutions/*>

You may want to change this to:
       <Directory /var/www/html/angrynates.com/global_solutions>

If you want regular expression syntax, I would advise using the syntax
       <Directory ~ EXPRESSION>
or
       <DirectoryMatch ~ EXPRESSION>

> #ls -lZ
> drwxr-xr-x  root root                                  1024
> drwxr-xr-x  root root                                  1132
> drwxr-xr-x  root root                                  1255
[snip]

It looks like you don't have *any* SELinux context information; if SELinux is
on, this will cause problems. Try using the 'restorecon' command to put the
defaults in place, and consider using 'chcon' to change the security context
to an appropriate one (I believe you want something like
'unconfined_u:object_r:httpd_sys_content_t' for Apache content).

>
> On Sat, Nov 7, 2009 at 4:09 PM, Rami Chowdhury
<rami.chowdhury@...>wrote:
> > On Saturday 07 November 2009 06:13:11 Victor Subervi wrote:
> > > I have a serious privileges problem that is making it impossible to
> > > serve python pages on a CentOS server. It appears that nobody on the
> > > CentOS discussion list has a solution to this problem. I'm desperate
> > > and hoping someone on this list can help.
> > >
> > > [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] (2)No such
> > > file or directory: exec of
> > >  '/var/www/html/angrynates.com/global_solutions/index.py' failed,
> >
> > referer:
> > >  http://angrynates.com/global_solutions/
> > > [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] Premature end
> >
> > of
> >
> > > script headers: index.py, referer:
> >
> > http://angrynates.com/global_solutions/
> >
> > > Now, the file does exist:
> > >
> > > [root@13gems global_solutions]# pwd
> > > /var/www/html/angrynates.com/global_solutions
> > > [root@13gems global_solutions]# ls
> > > ....
> > > -rwxr-xr-x 1 victor victor 275 Nov 6 07:05 index.py
> > > ....
> > > and it serves just fine on another server, so there is no "premature
> > > end
> >
> > of
> >
> > > script headers".
> > >
> > >
> > > Here's where it gets really weird. If I copy the code for index.py and
> > > template.py which the former calls, and create files test.py and
> > > test2.py and paste the code from the former files in those new files
> > > changing only the import statement from "template" to "test2", the
> > > tests will resolve!! Now, the ownership and mode are identical on all
> > > of them!!
> > >
> > >
> > > [root@13gems global_solutions]# ls -al | grep test.py
> > > -rwxr-xr-x 1 root root 298 Nov 6 12:24 test.py
> > > [root@13gems global_solutions]# ls -al | grep test2.py
> > > -rwxr-xr-x 1 root root 5716 Nov 6 12:25 test2.py
> > > [root@13gems global_solutions]# ls -al | grep index.py
> > > -rwxr-xr-x 1 root root 316 Nov 6 07:05 index.py
> > > [root@13gems global_solutions]# ls -al | grep template.py
> > > -rwxr-xr-x 1 root root 5806 Nov 6 07:06 template.py
> > > -rwxr-xr-x 1 root root 6093 Nov 6 07:06 template.pyc
> > >
> > > where test.py is identical to index.py (other than the necessary
> > > import) and template is identical to test2.py
> > >
> > >
> > > fixfiles relabel /var/www/html
> > > # might just work
> > > It didn't
> > >
> > > touch /.autorelabel
> > > # and then reboot will relabel all copied files to the correct contexts
> >
> > for
> >
> > > the location
> > > I rebooted apache with no luck
> > >
> > > or you could turn off SELinux and reboot
> > > I did that and the following two solutions with no luck:
> > > echo 0 >/selinux/enforce
> > >
> > > [root@13gems ~]# cd /etc/
> > > [root@13gems etc]# mv selinux/ selinux.BAK
> > > [root@13gems etc]# mkdir selinux
> > > [root@13gems etc]# echo 0>/selinux/enforce
> > >
> > > ...and the problem continues:
> > > [root@13gems etc]# tail /var/log/httpd/error_log
> > > [Fri Nov 06 12:51:49 2009] [error] [client 66.248.168.98] Premature end
> >
> > of
> >
> > > script headers: index.py, referer:
> >
> > http://angrynates.com/global_solutions/
> >
> > > [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] (2)No such
> > > file or directory: exec of
> > >  '/var/www/html/angrynates.com/global_solutions/index.py' failed,
> >
> > referer:
> > >  http://angrynates.com/global_solutions/
> > > [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] Premature end
> >
> > of
> >
> > > script headers: index.py, referer:
> >
> > http://angrynates.com/global_solutions/
> >
> > > [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] (2)No such
> > > file
> >
> > or
> >
> > > directory: exec of '/var/www/html/
> >
> > angrynates.com/global_solutions/index.py'
> >
> > > failed
> > > [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] Premature end
> > > of script headers: index.py
> > > [Fri Nov 06 13:52:15 2009] [error] [client 66.249.67.153] File does not
> > > exist: /var/www/html/angrynates.com/robots.txt
> > > [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] (2)No such
> > > file or directory: exec of
> > >  '/var/www/html/angrynates.com/global_solutions/index.py' failed,
> >
> > referer:
> > >  http://angrynates.com/global_solutions/
> > > [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] Premature end
> >
> > of
> >
> > > script headers: index.py, referer:
> >
> > http://angrynates.com/global_solutions/
> >
> > > [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] File does not
> > > exist: /var/www/html/angrynates.com/favicon.ico
> > > [Fri Nov 06 13:52:53 2009] [error] [client 208.84.198.58] File does not
> > > exist: /var/www/html/angrynates.com/favicon.ico
> > > [root@13gems etc]#
> > >
> > > Please help.
> > > Victor
> >
> > Can we see the output of 'ls -lZ' and 'fixfiles check' on those
> > directories,
> > and see what the Apache (httpd.conf or .htaccess) configuration is for
> > them?
> >
> > ----
> > Rami Chowdhury
> > "Passion is inversely proportional to the amount of real information
> > available." -- Benford's Law of Controversy
> > 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
>


----
Rami Chowdhury
"Strangers are just friends who haven't had enough gin." -- Howdle's Saying
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)


--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Rami Chowdhury :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Saturday 07 November 2009 23:59:23 Victor Subervi wrote:
> restorecon didn't change ls -lZ output

Did the suggested changes to the Apache configuration help at all?

> Can you give me the exact command for chcon? It complains there are too few
> arguments, and I couldn't figure it out.

For chcon, you probably want the 'unconfined_u' user setting, the 'object_r'
role setting, and the 'httpd_sys_content_t' type setting. As 'chcon --help'
tells us, you need to call it as follows:

chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...

Of course, here FILE can also be a directory, or the root of a directory tree,
and the -R option will make chcon run recursively.

> Does this really matter? I moved the selinux folder and its contents as
>  well as sent an "echo 0>..." command to kill it.

I'm not certain -- have you tried confirming through programs such as system-
config-securitylevel that it's off?

>  Furthermore,
> [root@13gems global_solutions]# ps wax|grep selinux
> 17645 pts/0    S+     0:00 grep selinux

SELinux is a kernel subsystem -- it won't show up in the process list.

> Please advise.
> V
>
> On Sat, Nov 7, 2009 at 5:49 PM, Rami Chowdhury
<rami.chowdhury@...>wrote:

> > On Saturday 07 November 2009 13:51:06 Victor Subervi wrote:
> > > httpd.conf:
> > >
> > > <VirtualHost *:80>
> > > ServerAdmin me@...
> > > DocumentRoot /var/www/html/angrynates.com
> > > ServerName angrynates.com
> > > Options +ExecCGI -IncludesNoExec
> > > <Directory /var/www/html/angrynates.com/global_solutions/*>
> >
> > You may want to change this to:
> >         <Directory /var/www/html/angrynates.com/global_solutions>
> >
> > If you want regular expression syntax, I would advise using the syntax
> >        <Directory ~ EXPRESSION>
> > or
> >        <DirectoryMatch ~ EXPRESSION>
> >
> > > #ls -lZ
> > > drwxr-xr-x  root root                                  1024
> > > drwxr-xr-x  root root                                  1132
> > > drwxr-xr-x  root root                                  1255
> >
> > [snip]
> >
> > It looks like you don't have *any* SELinux context information; if
> > SELinux is
> > on, this will cause problems. Try using the 'restorecon' command to put
> > the defaults in place, and consider using 'chcon' to change the security
> > context
> > to an appropriate one (I believe you want something like
> > 'unconfined_u:object_r:httpd_sys_content_t' for Apache content).
> >
> > > On Sat, Nov 7, 2009 at 4:09 PM, Rami Chowdhury
> >
> > <rami.chowdhury@...>wrote:
> > > > On Saturday 07 November 2009 06:13:11 Victor Subervi wrote:
> > > > > I have a serious privileges problem that is making it impossible to
> > > > > serve python pages on a CentOS server. It appears that nobody on
> > > > > the CentOS discussion list has a solution to this problem. I'm
> > > > > desperate and hoping someone on this list can help.
> > > > >
> > > > > [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] (2)No
> > > > > such file or directory: exec of
> > > > >  '/var/www/html/angrynates.com/global_solutions/index.py' failed,
> > > >
> > > > referer:
> > > > >  http://angrynates.com/global_solutions/
> > > > > [Fri Nov 06 11:50:40 2009] [error] [client 66.248.168.98] Premature
> >
> > end
> >
> > > > of
> > > >
> > > > > script headers: index.py, referer:
> > > >
> > > > http://angrynates.com/global_solutions/
> > > >
> > > > > Now, the file does exist:
> > > > >
> > > > > [root@13gems global_solutions]# pwd
> > > > > /var/www/html/angrynates.com/global_solutions
> > > > > [root@13gems global_solutions]# ls
> > > > > ....
> > > > > -rwxr-xr-x 1 victor victor 275 Nov 6 07:05 index.py
> > > > > ....
> > > > > and it serves just fine on another server, so there is no
> > > > > "premature end
> > > >
> > > > of
> > > >
> > > > > script headers".
> > > > >
> > > > >
> > > > > Here's where it gets really weird. If I copy the code for index.py
> >
> > and
> >
> > > > > template.py which the former calls, and create files test.py and
> > > > > test2.py and paste the code from the former files in those new
> > > > > files changing only the import statement from "template" to
> > > > > "test2", the tests will resolve!! Now, the ownership and mode are
> > > > > identical on all of them!!
> > > > >
> > > > >
> > > > > [root@13gems global_solutions]# ls -al | grep test.py
> > > > > -rwxr-xr-x 1 root root 298 Nov 6 12:24 test.py
> > > > > [root@13gems global_solutions]# ls -al | grep test2.py
> > > > > -rwxr-xr-x 1 root root 5716 Nov 6 12:25 test2.py
> > > > > [root@13gems global_solutions]# ls -al | grep index.py
> > > > > -rwxr-xr-x 1 root root 316 Nov 6 07:05 index.py
> > > > > [root@13gems global_solutions]# ls -al | grep template.py
> > > > > -rwxr-xr-x 1 root root 5806 Nov 6 07:06 template.py
> > > > > -rwxr-xr-x 1 root root 6093 Nov 6 07:06 template.pyc
> > > > >
> > > > > where test.py is identical to index.py (other than the necessary
> > > > > import) and template is identical to test2.py
> > > > >
> > > > >
> > > > > fixfiles relabel /var/www/html
> > > > > # might just work
> > > > > It didn't
> > > > >
> > > > > touch /.autorelabel
> > > > > # and then reboot will relabel all copied files to the correct
> >
> > contexts
> >
> > > > for
> > > >
> > > > > the location
> > > > > I rebooted apache with no luck
> > > > >
> > > > > or you could turn off SELinux and reboot
> > > > > I did that and the following two solutions with no luck:
> > > > > echo 0 >/selinux/enforce
> > > > >
> > > > > [root@13gems ~]# cd /etc/
> > > > > [root@13gems etc]# mv selinux/ selinux.BAK
> > > > > [root@13gems etc]# mkdir selinux
> > > > > [root@13gems etc]# echo 0>/selinux/enforce
> > > > >
> > > > > ...and the problem continues:
> > > > > [root@13gems etc]# tail /var/log/httpd/error_log
> > > > > [Fri Nov 06 12:51:49 2009] [error] [client 66.248.168.98] Premature
> >
> > end
> >
> > > > of
> > > >
> > > > > script headers: index.py, referer:
> > > >
> > > > http://angrynates.com/global_solutions/
> > > >
> > > > > [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] (2)No
> > > > > such file or directory: exec of
> > > > >  '/var/www/html/angrynates.com/global_solutions/index.py' failed,
> > > >
> > > > referer:
> > > > >  http://angrynates.com/global_solutions/
> > > > > [Fri Nov 06 12:56:18 2009] [error] [client 66.248.168.98] Premature
> >
> > end
> >
> > > > of
> > > >
> > > > > script headers: index.py, referer:
> > > >
> > > > http://angrynates.com/global_solutions/
> > > >
> > > > > [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] (2)No such
> > > > > file
> > > >
> > > > or
> > > >
> > > > > directory: exec of '/var/www/html/
> > > >
> > > > angrynates.com/global_solutions/index.py'
> > > >
> > > > > failed
> > > > > [Fri Nov 06 12:56:20 2009] [error] [client 67.96.172.81] Premature
> >
> > end
> >
> > > > > of script headers: index.py
> > > > > [Fri Nov 06 13:52:15 2009] [error] [client 66.249.67.153] File does
> >
> > not
> >
> > > > > exist: /var/www/html/angrynates.com/robots.txt
> > > > > [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] (2)No
> > > > > such file or directory: exec of
> > > > >  '/var/www/html/angrynates.com/global_solutions/index.py' failed,
> > > >
> > > > referer:
> > > > >  http://angrynates.com/global_solutions/
> > > > > [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] Premature
> >
> > end
> >
> > > > of
> > > >
> > > > > script headers: index.py, referer:
> > > >
> > > > http://angrynates.com/global_solutions/
> > > >
> > > > > [Fri Nov 06 13:52:52 2009] [error] [client 208.84.198.58] File does
> >
> > not
> >
> > > > > exist: /var/www/html/angrynates.com/favicon.ico
> > > > > [Fri Nov 06 13:52:53 2009] [error] [client 208.84.198.58] File does
> >
> > not
> >
> > > > > exist: /var/www/html/angrynates.com/favicon.ico
> > > > > [root@13gems etc]#
> > > > >
> > > > > Please help.
> > > > > Victor
> > > >
> > > > Can we see the output of 'ls -lZ' and 'fixfiles check' on those
> > > > directories,
> > > > and see what the Apache (httpd.conf or .htaccess) configuration is
> > > > for them?
> > > >
> > > > ----
> > > > Rami Chowdhury
> > > > "Passion is inversely proportional to the amount of real information
> > > > available." -- Benford's Law of Controversy
> > > > 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
> >
> > ----
> > Rami Chowdhury
> > "Strangers are just friends who haven't had enough gin." -- Howdle's
> > Saying 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
>


----
Rami Chowdhury
"A man with a watch knows what time it is. A man with two watches is never
sure". -- Segal's Law
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
--
http://mail.python.org/mailman/listinfo/python-list

Parent Message unknown Re: Serious Privileges Problem: Please Help

by Rami Chowdhury :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 08 November 2009 05:44:31 Victor Subervi wrote:
> [root@13gems angrynates.com]# chcon -u unconfined_u -r object_r -t
> httpd_sys_content_t global_solutions
> chcon: can't apply partial context to unlabeled file global_solutions
> Please advise.

Try 'chcon -R -h unconfined_u:object_r:httpd_sys_content_t
global_solutions/*', which should specify the whole context at once and avoid
that error, as well as apply it recursively to all files and subdirectories.

Also, to narrow down the error, can you let us have the output of:
        tail /var/log/messages
        tail /var/log/httpd/error_log

HTH,
Rami

----
Rami Chowdhury
"As an online discussion grows longer, the probability of a comparison
involving Nazis or Hitler approaches one." -- Godwin's Law
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[root@13gems angrynates.com]# chcon -R -h unconfined_u:object_r:httpd_sys_content_t global_solutions/*

Then I surfed to
http://209.216.9.56/global_solutions/index.py

[root@13gems angrynates.com]# tail /var/log/messages
Nov  8 04:26:02 13gems syslogd 1.4.1: restart.
[root@13gems angrynates.com]# tail /var/log/httpd/error_log
[Sun Nov 08 05:35:10 2009] [notice] Digest: generating secret for digest authentication ...
[Sun Nov 08 05:35:10 2009] [notice] Digest: done
[Sun Nov 08 05:35:10 2009] [notice] mod_python: Creating 4 session mutexes based on 10 max processes and 0 max threads.
[Sun Nov 08 05:35:10 2009] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] File does not exist: /var/www/html/angrynates.com/favicon.ico
[Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] (2)No such file or directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer: http://209.216.9.56/global_solutions/
[Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] Premature end of script headers: index.py, referer: http://209.216.9.56/global_solutions/
[Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] File does not exist: /var/www/html/angrynates.com/favicon.ico
[Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] (2)No such file or directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer: http://209.216.9.56/global_solutions/
[Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] Premature end of script headers: index.py, referer: http://209.216.9.56/global_solutions/

TIA,
V

On Sun, Nov 8, 2009 at 12:28 PM, Rami Chowdhury <rami.chowdhury@...> wrote:
On Sunday 08 November 2009 05:44:31 Victor Subervi wrote:
> [root@13gems angrynates.com]# chcon -u unconfined_u -r object_r -t
> httpd_sys_content_t global_solutions
> chcon: can't apply partial context to unlabeled file global_solutions
> Please advise.

Try 'chcon -R -h unconfined_u:object_r:httpd_sys_content_t
global_solutions/*', which should specify the whole context at once and avoid
that error, as well as apply it recursively to all files and subdirectories.

Also, to narrow down the error, can you let us have the output of:
       tail /var/log/messages
       tail /var/log/httpd/error_log

HTH,
Rami

----
Rami Chowdhury
"As an online discussion grows longer, the probability of a comparison
involving Nazis or Hitler approaches one." -- Godwin's Law
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)


--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Did you give up on me?
V

On Sun, Nov 8, 2009 at 12:40 PM, Victor Subervi <victorsubervi@...> wrote:
[root@13gems angrynates.com]# chcon -R -h unconfined_u:object_r:httpd_sys_content_t global_solutions/*

Then I surfed to
http://209.216.9.56/global_solutions/index.py

[root@13gems angrynates.com]# tail /var/log/messages
Nov  8 04:26:02 13gems syslogd 1.4.1: restart.
[root@13gems angrynates.com]# tail /var/log/httpd/error_log
[Sun Nov 08 05:35:10 2009] [notice] Digest: generating secret for digest authentication ...
[Sun Nov 08 05:35:10 2009] [notice] Digest: done
[Sun Nov 08 05:35:10 2009] [notice] mod_python: Creating 4 session mutexes based on 10 max processes and 0 max threads.
[Sun Nov 08 05:35:10 2009] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] File does not exist: /var/www/html/angrynates.com/favicon.ico
[Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] (2)No such file or directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer: http://209.216.9.56/global_solutions/
[Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] Premature end of script headers: index.py, referer: http://209.216.9.56/global_solutions/
[Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] File does not exist: /var/www/html/angrynates.com/favicon.ico
[Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] (2)No such file or directory: exec of '/var/www/html/angrynates.com/global_solutions/index.py' failed, referer: http://209.216.9.56/global_solutions/
[Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] Premature end of script headers: index.py, referer: http://209.216.9.56/global_solutions/

TIA,
V

On Sun, Nov 8, 2009 at 12:28 PM, Rami Chowdhury <rami.chowdhury@...> wrote:
On Sunday 08 November 2009 05:44:31 Victor Subervi wrote:
> [root@13gems angrynates.com]# chcon -u unconfined_u -r object_r -t
> httpd_sys_content_t global_solutions
> chcon: can't apply partial context to unlabeled file global_solutions
> Please advise.

Try 'chcon -R -h unconfined_u:object_r:httpd_sys_content_t
global_solutions/*', which should specify the whole context at once and avoid
that error, as well as apply it recursively to all files and subdirectories.

Also, to narrow down the error, can you let us have the output of:
       tail /var/log/messages
       tail /var/log/httpd/error_log

HTH,
Rami

----
Rami Chowdhury
"As an online discussion grows longer, the probability of a comparison
involving Nazis or Hitler approaches one." -- Godwin's Law
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)



--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Simon Forman-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 9, 2009 at 12:44 PM, Victor Subervi <victorsubervi@...> wrote:
> Did you give up on me?
> V
>

Please don't top-post.
--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Rami Chowdhury :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 09 Nov 2009 09:44:24 -0800, Victor Subervi  
<victorsubervi@...> wrote:

> Did you give up on me?
> V
>
> On Sun, Nov 8, 2009 at 12:40 PM, Victor Subervi  
> <victorsubervi@...>wrote:
>
>> [root@13gems angrynates.com]# chcon -R -h
>> unconfined_u:object_r:httpd_sys_content_t global_solutions/*
>>
>> Then I surfed to
>> http://209.216.9.56/global_solutions/index.py
>>
>> [root@13gems angrynates.com]# tail /var/log/messages
>> Nov  8 04:26:02 13gems syslogd 1.4.1: restart.
>> [root@13gems angrynates.com]# tail /var/log/httpd/error_log
>> [Sun Nov 08 05:35:10 2009] [notice] Digest: generating secret for digest
>> authentication ...
>> [Sun Nov 08 05:35:10 2009] [notice] Digest: done
>> [Sun Nov 08 05:35:10 2009] [notice] mod_python: Creating 4 session  
>> mutexes
>> based on 10 max processes and 0 max threads.
>> [Sun Nov 08 05:35:10 2009] [notice] Apache/2.2.3 (CentOS) configured --
>> resuming normal operations
>> [Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] File does not
>> exist: /var/www/html/angrynates.com/favicon.ico
>> [Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] (2)No such  
>> file
>> or directory: exec of '/var/www/html/
>> angrynates.com/global_solutions/index.py' failed, referer:
>> http://209.216.9.56/global_solutions/
>> [Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] Premature end  
>> of
>> script headers: index.py, referer: http://209.216.9.56/global_solutions/
>> [Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] File does not
>> exist: /var/www/html/angrynates.com/favicon.ico
>> [Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] (2)No such  
>> file
>> or directory: exec of '/var/www/html/
>> angrynates.com/global_solutions/index.py' failed, referer:
>> http://209.216.9.56/global_solutions/
>> [Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] Premature end  
>> of
>> script headers: index.py, referer: http://209.216.9.56/global_solutions/
>>
>> TIA,
>> V
>>
>> On Sun, Nov 8, 2009 at 12:28 PM, Rami Chowdhury  
>> <rami.chowdhury@...>wrote:
>>
>>> On Sunday 08 November 2009 05:44:31 Victor Subervi wrote:
>>> > [root@13gems angrynates.com]# chcon -u unconfined_u -r object_r -t
>>> > httpd_sys_content_t global_solutions
>>> > chcon: can't apply partial context to unlabeled file global_solutions
>>> > Please advise.
>>>
>>> Try 'chcon -R -h unconfined_u:object_r:httpd_sys_content_t
>>> global_solutions/*', which should specify the whole context at once and
>>> avoid
>>> that error, as well as apply it recursively to all files and
>>> subdirectories.
>>>
>>> Also, to narrow down the error, can you let us have the output of:
>>>        tail /var/log/messages
>>>         tail /var/log/httpd/error_log
>>>

OK, after all this I've forgotten what your .py file looked like -- can  
you post that please?



--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" --  
Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Of course. Let me start with some updates to httpd.conf, which didn't help anyway:

<VirtualHost *:80>
ServerAdmin me@...
DocumentRoot /var/www/html/angrynates.com
ServerName angrynates.com
Options +ExecCGI -IncludesNoExec
<Directory /var/www/html/angrynates.com/global_solutions>
 Options +ExecCGI
 AllowOverride All
 AllowOverride FileInfo
 #AddHandler mod_python .py
 #PythonHandler mod_python.publisher
 #PythonDebug On
AddHandler cgi-script .cgi .py
Options Includes Indexes SymLinksIfOwnerMatch ExecCGI
<IfModule mod_security.c>
 SecFilterEngine Off
</IfModule>
<IfModule mod_security2.c>
 SecRuleEngine Off
</IfModule>
AddHandler cgi-script .cgi .py
Options Includes Indexes SymLinksIfOwnerMatch ExecCGI

<IfModule mod_security.c>
 SecFilterEngine Off
</IfModule>
<IfModule mod_security2.c>
 SecRuleEngine Off
</IfModule>

</Directory>
</VirtualHost>

Here's index.py:

#!/usr/bin/python

import string
import cgitb; cgitb.enable()
import cgi
import sys,os
sys.path.append(os.getcwd())
from template import template

ourFile = string.split(__file__, "/")
page = ourFile[len(ourFile) - 1][:-3]

form = cgi.FieldStorage()
w = form.getfirst('w', '1024')

template(page, w)


Here's template.py:

#!/usr/bin/python

import cgitb; cgitb.enable()
import cgi
import sys,os
sys.path.append(os.getcwd())

p = 'template'

def template(page, w):
  wn = int(w)/1024
  print "Content-Type: text/html"
  print
  print '''
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<head xmlns="http://www.w3.org/1999/xhtml">
<style type='text/css'>
.text {  font-family: Arial, Helvetica, sans-serif; font-size: 16px; text-decoration: none; text-align: justify}
</style>
<title>Global Solutions Group</title>
<meta http-equiv="distribution" content="Global" />
<meta http-equiv="robots" content="index all, follow all" />
<meta name="author" content="This web site developed by beno. You may reach him at his web site [beno.vi], or by dialing 340-773-0687 and asking for room 102." />
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body onload="MM_preloadImages('images/office-supplies-on.jpg','images/catalog-on.jpg','images/customer-template-on.jpg','images/forms-on.jpg','images/about-on.jpg','images/contact-on.jpg')">
<script language="JavaScript1.2" src="quickmenu/sample_data.js"></script>
<script language="JavaScript1.2" src="quickmenu/dqm_script.js"></script>'''
  print "<table width='%s' bgcolor='#ffffff' cellpadding='0' cellspacing='0'><!--" % (str(wn*1008))
  print '--><tr><!--'
  print '--><td><!--'
  print '--><img src="images/top.jpg" width="%s" height="%s" alt="" /><!--' % (str(wn*1008), str(wn*101))
  print '--></td><!--'
  print '--></tr><tr><!--'
  print '--><td><!--'
  print '--><table align="left" width="%s" cellpadding="0" cellspacing="0"><!--' % (str(wn*1008))
  print '--><tr><!--'
  print "--><td><img src='images/left.jpg' alt='' width='%s' height='%s' /></td><!--" % (str(wn*219), str(wn*21))
  print '--><td><a href="index.py" onMouseOver="MM_swapImage("Home","","images/home-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/home-off.jpg" name="Home" id="Home" alt="Home" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*80), str(wn*21))
  print '--><td><a href="Office_Supplies.py" onMouseOver="MM_swapImage("office-supplies","","images/office-supplies-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/office-supplies-off.jpg" name="office-supplies" id="office-supplies" alt="office supplies" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*137), str(wn*21))
  print '--><td><a href="Catalog.py" onMouseOver="MM_swapImage("catalog","","images/catalog-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/catalog-off.jpg" name="catalog" id="catalog" alt="catalog" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*86), str(wn*21))
  print '--><td><a href="Customer_Templates.py" onMouseOver="MM_swapImage("customer-template","","images/customer-template-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/customer-template-off.jpg" name="customer-template" id="customer-template" alt="customer template" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*145), str(wn*21))
  print '--><td><a href="Forms.py" onMouseOver="MM_swapImage("forms","","images/forms-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/forms-off.jpg" name="forms" id="forms" alt="forms" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*84), str(wn*21))
  print '--><td><a href="About_Us.py" onMouseOver="MM_swapImage("about","","images/about-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/about-off.jpg" name="about" id="about" alt="about us" width="%s" height="%s" border="0" /></a></td><!--' % (str(wn*101), str(wn*21))
  print '--><td><a href="Contact_Us.py" onMouseOver="MM_swapImage("contact","","images/contact-on.jpg",1)" onMouseOut="MM_swapImgRestore()"><img src="images/contact-off.jpg" name="contact" id="contact" alt="contact us" width="%s" height="%s" border=0></a></td><!--' % (str(wn*100), str(wn*21))
  print '--><td><img src="images/right.jpg" alt="" width="%s" height="%s" /></td><!--' % (str(wn*72), str(wn*21))
  print '''--></tr><!--
--></table><!--
--></tr><tr><!--
--><td><!--'''
  print '--><table width="%s" cellpadding="0" cellspacing="0"><!--' % (str(wn*1008))
  print '--><tr><!--'
  print '--><td width="%s"><!--' % (str(wn*1008))
  print '--><img src="images/bottom.jpg" width="%s" height="%s" alt="" /><!--' % (str(wn*1008), str(wn*15))
  print '''--></td><!--
--></tr><tr><!--
--><td><!--
--><table class="text"><tr><td><!--
'''
  print '--><iframe src="%s_frame.py?p=%s&w=%s" width="%s" height="%s" frameborder="0"></iframe><!--' % (page, page, w, str(wn*988), str(wn*400))
  print '''
--></td><!--
--></tr><!--
--></table>
</body>
</html>
'''

TIA,
V

On Mon, Nov 9, 2009 at 1:14 PM, Rami Chowdhury <rami.chowdhury@...> wrote:
On Mon, 09 Nov 2009 09:44:24 -0800, Victor Subervi <victorsubervi@...> wrote:

Did you give up on me?
V

On Sun, Nov 8, 2009 at 12:40 PM, Victor Subervi <victorsubervi@...>wrote:

[root@13gems angrynates.com]# chcon -R -h
unconfined_u:object_r:httpd_sys_content_t global_solutions/*

Then I surfed to
http://209.216.9.56/global_solutions/index.py

[root@13gems angrynates.com]# tail /var/log/messages
Nov  8 04:26:02 13gems syslogd 1.4.1: restart.
[root@13gems angrynates.com]# tail /var/log/httpd/error_log
[Sun Nov 08 05:35:10 2009] [notice] Digest: generating secret for digest
authentication ...
[Sun Nov 08 05:35:10 2009] [notice] Digest: done
[Sun Nov 08 05:35:10 2009] [notice] mod_python: Creating 4 session mutexes
based on 10 max processes and 0 max threads.
[Sun Nov 08 05:35:10 2009] [notice] Apache/2.2.3 (CentOS) configured --
resuming normal operations
[Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] File does not
exist: /var/www/html/angrynates.com/favicon.ico
[Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] (2)No such file
or directory: exec of '/var/www/html/
angrynates.com/global_solutions/index.py' failed, referer:
http://209.216.9.56/global_solutions/
[Sun Nov 08 07:29:40 2009] [error] [client 66.248.168.98] Premature end of
script headers: index.py, referer: http://209.216.9.56/global_solutions/
[Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] File does not
exist: /var/www/html/angrynates.com/favicon.ico
[Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] (2)No such file
or directory: exec of '/var/www/html/
angrynates.com/global_solutions/index.py' failed, referer:
http://209.216.9.56/global_solutions/
[Sun Nov 08 09:38:44 2009] [error] [client 66.248.168.98] Premature end of
script headers: index.py, referer: http://209.216.9.56/global_solutions/

TIA,
V

On Sun, Nov 8, 2009 at 12:28 PM, Rami Chowdhury <rami.chowdhury@...>wrote:

On Sunday 08 November 2009 05:44:31 Victor Subervi wrote:
> [root@13gems angrynates.com]# chcon -u unconfined_u -r object_r -t
> httpd_sys_content_t global_solutions
> chcon: can't apply partial context to unlabeled file global_solutions
> Please advise.

Try 'chcon -R -h unconfined_u:object_r:httpd_sys_content_t
global_solutions/*', which should specify the whole context at once and
avoid
that error, as well as apply it recursively to all files and
subdirectories.

Also, to narrow down the error, can you let us have the output of:
      tail /var/log/messages
       tail /var/log/httpd/error_log


OK, after all this I've forgotten what your .py file looked like -- can you post that please?



--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" -- Hanlon's Razor

408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)


--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Rami Chowdhury :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 09 Nov 2009 10:36:31 -0800, Victor Subervi  
<victorsubervi@...> wrote:

> Of course. Let me start with some updates to httpd.conf, which didn't  
> help
> anyway:
>
> <VirtualHost *:80>
> ServerAdmin me@...
> DocumentRoot /var/www/html/angrynates.com
> ServerName angrynates.com
> Options +ExecCGI -IncludesNoExec
> <Directory /var/www/html/angrynates.com/global_solutions>
>  Options +ExecCGI
>  AllowOverride All
>  AllowOverride FileInfo
>  #AddHandler mod_python .py
>  #PythonHandler mod_python.publisher
>  #PythonDebug On
> AddHandler cgi-script .cgi .py
> Options Includes Indexes SymLinksIfOwnerMatch ExecCGI
> <IfModule mod_security.c>
>  SecFilterEngine Off
> </IfModule>
> <IfModule mod_security2.c>
>  SecRuleEngine Off
> </IfModule>
> AddHandler cgi-script .cgi .py
> Options Includes Indexes SymLinksIfOwnerMatch ExecCGI
>
> <IfModule mod_security.c>
>  SecFilterEngine Off
> </IfModule>
> <IfModule mod_security2.c>
>  SecRuleEngine Off
> </IfModule>
>
> </Directory>
> </VirtualHost>
>
> Here's index.py:
>
> #!/usr/bin/python
>
> import string
> import cgitb; cgitb.enable()
> import cgi
> import sys,os
> sys.path.append(os.getcwd())
> from template import template
>
> ourFile = string.split(__file__, "/")
> page = ourFile[len(ourFile) - 1][:-3]
>
> form = cgi.FieldStorage()
> w = form.getfirst('w', '1024')
>
> template(page, w)
>
>

Can you try running index.py from the command-line, and let me know if  
that works?

Also, as you've already been asked - please start your replies *below* the  
text you are replying to. Putting your replies above the last email, or  
"top-posting" makes reading long email threads with lots of text  
distracting and frustrating.



--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" --  
Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Mon, Nov 9, 2009 at 1:53 PM, Rami Chowdhury <rami.chowdhury@...> wrote:
On Mon, 09 Nov 2009 10:36:31 -0800, Victor Subervi <victorsubervi@...> wrote:

Of course. Let me start with some updates to httpd.conf, which didn't help
anyway:

<VirtualHost *:80>
ServerAdmin me@...
DocumentRoot /var/www/html/angrynates.com
ServerName angrynates.com
Options +ExecCGI -IncludesNoExec
<Directory /var/www/html/angrynates.com/global_solutions>
 Options +ExecCGI
 AllowOverride All
 AllowOverride FileInfo
 #AddHandler mod_python .py
 #PythonHandler mod_python.publisher
 #PythonDebug On
AddHandler cgi-script .cgi .py
Options Includes Indexes SymLinksIfOwnerMatch ExecCGI
<IfModule mod_security.c>
 SecFilterEngine Off
</IfModule>
<IfModule mod_security2.c>
 SecRuleEngine Off
</IfModule>
AddHandler cgi-script .cgi .py
Options Includes Indexes SymLinksIfOwnerMatch ExecCGI

<IfModule mod_security.c>
 SecFilterEngine Off
</IfModule>
<IfModule mod_security2.c>
 SecRuleEngine Off
</IfModule>

</Directory>
</VirtualHost>

Here's index.py:

#!/usr/bin/python

import string
import cgitb; cgitb.enable()
import cgi
import sys,os
sys.path.append(os.getcwd())
from template import template

ourFile = string.split(__file__, "/")
page = ourFile[len(ourFile) - 1][:-3]

form = cgi.FieldStorage()
w = form.getfirst('w', '1024')

template(page, w)



Can you try running index.py from the command-line, and let me know if that works?

It runs fine. So I created a test file of the same, chmod and tried it on my browser. Rendered. So I deleted index.py and recreated it from the command line, chmod. Rendered! Apparently, somehow in the translation from uploading it via ftp to moving the files to a new dir, something got screwed up in the permissions that I can't see! Any idea what the heck that could possibly be??
TIA,
V

--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Rami Chowdhury :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 09 Nov 2009 11:24:33 -0800, Victor Subervi  
<victorsubervi@...> wrote:

> On Mon, Nov 9, 2009 at 1:53 PM, Rami Chowdhury  
> <rami.chowdhury@...>wrote:
>
>> On Mon, 09 Nov 2009 10:36:31 -0800, Victor Subervi <
>> victorsubervi@...> wrote:
>>
>>  Of course. Let me start with some updates to httpd.conf, which didn't  
>> help
>>> anyway:
>>>
>>> <VirtualHost *:80>
>>> ServerAdmin me@...
>>> DocumentRoot /var/www/html/angrynates.com
>>> ServerName angrynates.com
>>> Options +ExecCGI -IncludesNoExec
>>> <Directory /var/www/html/angrynates.com/global_solutions>
>>>  Options +ExecCGI
>>>  AllowOverride All
>>>  AllowOverride FileInfo
>>>  #AddHandler mod_python .py
>>>  #PythonHandler mod_python.publisher
>>>  #PythonDebug On
>>> AddHandler cgi-script .cgi .py
>>> Options Includes Indexes SymLinksIfOwnerMatch ExecCGI
>>> <IfModule mod_security.c>
>>>  SecFilterEngine Off
>>> </IfModule>
>>> <IfModule mod_security2.c>
>>>  SecRuleEngine Off
>>> </IfModule>
>>> AddHandler cgi-script .cgi .py
>>> Options Includes Indexes SymLinksIfOwnerMatch ExecCGI
>>>
>>> <IfModule mod_security.c>
>>>  SecFilterEngine Off
>>> </IfModule>
>>> <IfModule mod_security2.c>
>>>  SecRuleEngine Off
>>> </IfModule>
>>>
>>> </Directory>
>>> </VirtualHost>
>>>
>>> Here's index.py:
>>>
>>> #!/usr/bin/python
>>>
>>> import string
>>> import cgitb; cgitb.enable()
>>> import cgi
>>> import sys,os
>>> sys.path.append(os.getcwd())
>>> from template import template
>>>
>>> ourFile = string.split(__file__, "/")
>>> page = ourFile[len(ourFile) - 1][:-3]
>>>
>>> form = cgi.FieldStorage()
>>> w = form.getfirst('w', '1024')
>>>
>>> template(page, w)
>>>
>>>
>>>
>> Can you try running index.py from the command-line, and let me know if  
>> that
>> works?
>>
>
> It runs fine. So I created a test file of the same, chmod and tried it  
> on my
> browser. Rendered. So I deleted index.py and recreated it from the  
> command
> line, chmod. Rendered! Apparently, somehow in the translation from  
> uploading
> it via ftp to moving the files to a new dir, something got screwed up in  
> the
> permissions that I can't see! Any idea what the heck that could possibly
> be??
> TIA,
> V

What platform did you upload from? Something as seemingly insignificant as  
Windows line-endings can mess up file execution...



--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" --  
Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
--
http://mail.python.org/mailman/listinfo/python-list

Parent Message unknown Re: Serious Privileges Problem: Please Help

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 9, 2009 at 2:30 PM, Victor Subervi <victorsubervi@...> wrote:

On Mon, Nov 9, 2009 at 2:27 PM, Rami Chowdhury <rami.chowdhury@...> wrote:
On Mon, 09 Nov 2009 11:24:33 -0800, Victor Subervi <victorsubervi@...> wrote:

On Mon, Nov 9, 2009 at 1:53 PM, Rami Chowdhury <rami.chowdhury@...>wrote:

On Mon, 09 Nov 2009 10:36:31 -0800, Victor Subervi <
victorsubervi@...> wrote:

 Of course. Let me start with some updates to httpd.conf, which didn't help
anyway:

<VirtualHost *:80>
ServerAdmin me@...
DocumentRoot /var/www/html/angrynates.com
ServerName angrynates.com
Options +ExecCGI -IncludesNoExec
<Directory /var/www/html/angrynates.com/global_solutions>
 Options +ExecCGI
 AllowOverride All
 AllowOverride FileInfo
 #AddHandler mod_python .py
 #PythonHandler mod_python.publisher
 #PythonDebug On
AddHandler cgi-script .cgi .py
Options Includes Indexes SymLinksIfOwnerMatch ExecCGI
<IfModule mod_security.c>
 SecFilterEngine Off
</IfModule>
<IfModule mod_security2.c>
 SecRuleEngine Off
</IfModule>
AddHandler cgi-script .cgi .py
Options Includes Indexes SymLinksIfOwnerMatch ExecCGI

<IfModule mod_security.c>
 SecFilterEngine Off
</IfModule>
<IfModule mod_security2.c>
 SecRuleEngine Off
</IfModule>

</Directory>
</VirtualHost>

Here's index.py:

#!/usr/bin/python

import string
import cgitb; cgitb.enable()
import cgi
import sys,os
sys.path.append(os.getcwd())
from template import template

ourFile = string.split(__file__, "/")
page = ourFile[len(ourFile) - 1][:-3]

form = cgi.FieldStorage()
w = form.getfirst('w', '1024')

template(page, w)



Can you try running index.py from the command-line, and let me know if that
works?


It runs fine. So I created a test file of the same, chmod and tried it on my
browser. Rendered. So I deleted index.py and recreated it from the command
line, chmod. Rendered! Apparently, somehow in the translation from uploading
it via ftp to moving the files to a new dir, something got screwed up in the
permissions that I can't see! Any idea what the heck that could possibly
be??
TIA,
V

What platform did you upload from? Something as seemingly insignificant as Windows line-endings can mess up file execution...

OS is Windoze XL. Have we caught the thief? How can I upload from this box and not have this problem, or undo it at the server? You know, of course, I don't see this line-ending from the command prompt when I vi it.
TIA,
V

Hold everything. Apparently line-endings got mangled. What I don't understand is why I didn't see them when I opened the file to edit, and why they didn't copy and paste when I did that. But dos2unix cleaned up a couple of files so I presume it will clean up the rest. However, I tried one file, that reads exactly the same as index.py, and when I surfed to it got a 500 error. Here's what the log said:

[Mon Nov 09 12:30:27 2009] [notice] mod_python: (Re)importing module 'mptest'
[Mon Nov 09 12:30:27 2009] [error] [client 98.189.137.242] PythonHandler mptest: Traceback (most recent call last):, referer: http://www.angrynates.com/global_solutions/
[Mon Nov 09 12:30:27 2009] [error] [client 98.189.137.242] PythonHandler mptest:   File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 287, in HandlerDispatch\n    log=debug), referer: http://www.angrynates.com/global_solutions/
[Mon Nov 09 12:30:27 2009] [error] [client 98.189.137.242] PythonHandler mptest:   File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 461, in import_module\n    f, p, d = imp.find_module(parts[i], path), referer: http://www.angrynates.com/global_solutions/
[Mon Nov 09 12:30:27 2009] [error] [client 98.189.137.242] PythonHandler mptest: ImportError: No module named mptest, referer: http://www.angrynates.com/global_solutions/

Huh? Got no "mptest" anywhere. Not even using mod_python. Why doesn't it refer to a specific file in the folder? Any ideas on this one?
TIA,
V



--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" -- Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)



--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Dave Angel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Victor Subervi wrote:

> On Mon, Nov 9, 2009 at 2:30 PM, Victor Subervi <victorsubervi@...>wrote:
>
>  
>> On Mon, Nov 9, 2009 at 2:27 PM, Rami Chowdhury <rami.chowdhury@...>wrote:
>>
>>    
>>>
>> <snip>
>>
>> Hold everything. Apparently line-endings got mangled. What I don't
>>    
> understand is why I didn't see them when I opened the file to edit, and why
> they didn't copy and paste when I did that. But dos2unix cleaned up a couple
> of files so I presume it will clean up the rest. However, I tried one file,
> that reads exactly the same as index.py, and when I surfed to it got a 500
> error. Here's what the log said:
>
> <snip>
>  
>
What I've diagnosed as happening when a python script with Windows
line-ending was posted on my server's cgi environment:

The actual error seemed to be a failure to find the python interpreter,
since some Unix shells take the shebang line to include the \r character
that preceded the newline.   Seems to me they could be more tolerant,
since I don't think control characters are likely in the interpreter
file name.

DaveA

--
http://mail.python.org/mailman/listinfo/python-list

Re: Serious Privileges Problem: Please Help

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For others who discover this error, here's what happened as I've traced it:
1) I never before had built a python interpreter on my Windoze box. That was kind of silly, since I was uploading to my server every time I wanted to test. So I built on my Windoze box. Thereafter, Windoze assumed that all *.py files were native to its environment. That's where the little devil crept in.
2) When I went to edit my files on the server, I never saw any lines ending in "^M", the dead giveaway that Windoze has mangled the line endings. So the problem was __invisible__.

Wow. What a pain in the &(%(
Thanks for everyone's help!
V

On Mon, Nov 9, 2009 at 9:12 PM, Dave Angel <davea@...> wrote:
Victor Subervi wrote:
On Mon, Nov 9, 2009 at 2:30 PM, Victor Subervi <victorsubervi@...>wrote:

 
On Mon, Nov 9, 2009 at 2:27 PM, Rami Chowdhury <rami.chowdhury@...>wrote:

   

<snip>


Hold everything. Apparently line-endings got mangled. What I don't
   
understand is why I didn't see them when I opened the file to edit, and why
they didn't copy and paste when I did that. But dos2unix cleaned up a couple
of files so I presume it will clean up the rest. However, I tried one file,
that reads exactly the same as index.py, and when I surfed to it got a 500
error. Here's what the log said:

<snip>
 
What I've diagnosed as happening when a python script with Windows line-ending was posted on my server's cgi environment:

The actual error seemed to be a failure to find the python interpreter, since some Unix shells take the shebang line to include the \r character that preceded the newline.   Seems to me they could be more tolerant, since I don't think control characters are likely in the interpreter file name.

DaveA



--
http://mail.python.org/mailman/listinfo/python-list

Parent Message unknown Re: Serious Privileges Problem: Please Help

by Scott David Daniels :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dave Angel wrote:
> Victor Subervi wrote:
>> On Mon, Nov 9, 2009 at 2:30 PM, Victor Subervi
>> <victorsubervi@...>wrote:
>>> On Mon, Nov 9, 2009 at 2:27 PM, Rami Chowdhury
>>> <rami.chowdhury@...>wrote:
>>> <snip>
>>>
>>> Hold everything. Apparently line-endings got mangled. What I don't
...
>>  
> What I've diagnosed as happening when a python script with Windows
> line-ending was posted on my server's cgi environment:
>
> The actual error seemed to be a failure to find the python interpreter,
> since some Unix shells take the shebang line to include the \r character
> that preceded the newline.   Seems to me they could be more tolerant,
> since I don't think control characters are likely in the interpreter
> file name.

You could work around this by creating a symlink (or even hard link to
the python executable named "python\r"

--Scott David Daniels
Scott.Daniels@...
--
http://mail.python.org/mailman/listinfo/python-list