• Re: suexec error

    From Richard Kettlewell@110:300/1.1 to All on Fri May 31 10:07:06 2013
    nagia.retsina@gmail.com writes:
    Richard Kettlewell έγραψε:
    That can’t be right; suexec opens the logfile before changing UID.
    The most likely explanation is that suexec is wrongly installed.

    But i have mnay python scripts why the problem only appear to this one (koukos.py) ?

    Perhpas you’re not invoking those scripts through suexec.

    --
    http://www.greenend.org.uk/rjk/

    --- MBSE BBS v0.95.15 (GNU/Linux-x86_64)
    * Origin: Anjou (110:300/1.1@linuxnet)
  • From Richard Kettlewell@110:300/1.1 to All on Fri May 31 14:53:44 2013
    nikos.gr33k@gmail.com writes:
    Should i delete and recreate the koukos.py file?

    There is no point doing that. suexec is not getting as far as running
    the script. You need to study the Apache manual and your local
    configuration, to discover why suexec is being used when (apparently)
    you don’t want it to be. Making random changes without understanding what’s going on is not likely to help.

    --
    http://www.greenend.org.uk/rjk/

    --- MBSE BBS v0.95.15 (GNU/Linux-x86_64)
    * Origin: Anjou (110:300/1.1@linuxnet)
  • From nikos.gr33k@gmail.com@1:0/0 to All on Fri May 31 10:00:34 2013
    If i delete the script and recreate it i would still ahve the same problem? Whjy the problem doesnt appear in other scrips as well?

    --- MBSE BBS v0.95.15 (GNU/Linux-x86_64)
    * Origin: The Kofo BBS MBSE - telnet://fido1.kofobbs.ne
  • From nikos.gr33k@gmail.com@1:0/0 to All on Fri May 31 10:29:30 2013
    =CE=A4=CE=B7 =CE=A0=CE=B1=CF=81=CE=B1=CF=83=CE=BA=CE=B5=CF=85=CE=AE, 31 =CE= =9C=CE=B1=CE=90=CE=BF=CF=85 2013 11:07:06 =CF=80.=CE=BC. UTC+3, =CE=BF =CF= =87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 Richard Kettlewell =CE=AD=CE=B3=CF= =81=CE=B1=CF=88=CE=B5:
    nagia.retsina@gmail.com writes:
    =20
    Richard Kettlewell =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
    =20
    That can=E2=80=99t be right; suexec opens the logfile before changing =
    UID.
    =20
    The most likely explanation is that suexec is wrongly installed.
    =20

    =20
    But i have mnay python scripts why the problem only appear to this one
    =20
    (koukos.py) ?
    =20
    =20
    =20
    Perhpas you=E2=80=99re not invoking those scripts through suexec.
    =20
    =20
    =20
    --=20
    =20
    http://www.greenend.org.uk/rjk/

    I'am using CentOS v6.4

    What is 'suexec' and why is this happening only when i try to run koukos.py=
    script and doesnt not also happen to any other pythons cripts iam using to=
    o?

    --- MBSE BBS v0.95.15 (GNU/Linux-x86_64)
    * Origin: The Kofo BBS MBSE - telnet://fido1.kofobbs.ne
  • From Richard Kettlewell@110:300/1.1 to All on Fri May 31 11:16:58 2013
    nikos.gr33k@gmail.com writes:
    Richard Kettlewell έγραψε:
    nagia.retsina@gmail.com writes:
    Richard Kettlewell έγραψε:

    That can’t be right; suexec opens the logfile before changing UID.
    The most likely explanation is that suexec is wrongly installed.

    But i have mnay python scripts why the problem only appear to this one
    (koukos.py) ?

    Perhpas you’re not invoking those scripts through suexec.

    I'am using CentOS v6.4

    What is 'suexec' and why is this happening only when i try to run
    koukos.py script and doesnt not also happen toany other pythons cripts
    iam using too?

    http://httpd.apache.org/docs/2.2/suexec.html

    I have no idea what’s special about this particular script. Studying
    the ‘Using suEXEC’ section of the documentation might help.

    --
    http://www.greenend.org.uk/rjk/

    --- MBSE BBS v0.95.15 (GNU/Linux-x86_64)
    * Origin: Anjou (110:300/1.1@linuxnet)
  • From nikos.gr33k@gmail.com@1:0/0 to All on Fri May 31 14:42:48 2013
    [QUOTE=3Dzxq9]On CentOS the Apache server is guarded by a pretty huge set o=
    f SELinux protections. These are almost certainly denying access to stuff i=
    n /home from scripts run by Apache.

    suexec is an Apache plugin that lets the part of Apache that executes scrip=
    ts run another program as a user other than "apache". In this case it is tr= ying to execute your .py script as your username.

    I hate to sound paternal here, but you should read the Apache and RHEL/Cent= OS/SL docs to understand what you're getting into.

    That said, what problem are you actually trying to solve? What is the overa=
    ll thing you are trying to do or effect you are trying to achieve?[/QUOTE]

    I have created a python 3 script to actually try to set up a cooki, nothign=
    special or somethign that need some extra access. here is the code:


    [code]
    #!/usr/bin/python3
    # coding=3Dutf-8

    import cgitb; cgitb.enable()
    import cgi, os, sys
    from http import cookies

    # initialize cookie
    cookie =3D cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') )
    cookie.load( cookie )
    nikos =3D cookie.get('nikos')

    # if visitor cookie does exist
    if nikos:
    msg =3D "=CE=91=CE=A0=CE=9F =CE=A4=CE=97=CE=9D =CE=95=CE=A0=CE=9F=CE=9C=CE=
    =95=CE=9D=CE=97 =CE=95=CE=A0=CE=99=CE=A3=CE=9A=CE=95=CE=A8=CE=97 =CE=A3=CE= =9F=CE=A5 =CE=98=CE=91 =CE=A3=CE=95 =CE=A5=CE=A0=CE=9F=CE=9B=CE=9F=CE=93=CE= =99=CE=96=CE=A9 =CE=A9=CE=A3 =CE=95=CE=A0=CE=99=CE=A3=CE=9A=CE=95=CE=A0=CE= =A4=CE=97 =CE=91=CE=A5=CE=9E=CE=91=CE=9D=CE=9F=CE=9D=CE=A4=CE=91=CE=A3 =CE= =A4=CE=9F=CE=9D =CE=9C=CE=95=CE=A4=CE=A1=CE=97=CE=A4=CE=97!"
    cookie['nikos'] =3D 'admin'
    cookie['nikos']['path'] =3D '/'
    cookie['nikos']['expires'] =3D -1 #this cookie will expire now
    else:
    msg =3D "=CE=91=CE=A0=CE=9F =CE=94=CE=A9 =CE=9A=CE=91=CE=99 =CE=A3=CE=A4=
    =CE=9F =CE=95=CE=9E=CE=97=CE=A3 =CE=94=CE=95=CE=9D =CE=A3=CE=95 =CE=95=CE= =99=CE=94=CE=91, =CE=94=CE=95=CE=9D =CE=A3=CE=95 =CE=9E=CE=95=CE=A1=CE=A9, = =CE=94=CE=95=CE=9D =CE=A3=CE=95 =CE=91=CE=9A=CE=9F=CE=A5=CE=A3=CE=91! =CE= =98=CE=91 =CE=95=CE=99=CE=A3=CE=91=CE=99 =CE=A0=CE=9B=CE=95=CE=9F=CE=9D =CE= =9F =CE=91=CE=9F=CE=A1=CE=91=CE=A4=CE=9F=CE=A3 =CE=95=CE=A0=CE=99=CE=A3=CE= =9A=CE=95=CE=A0=CE=A4=CE=97=CE=A3!!"
    cookie['nikos'] =3D 'admin'
    cookie['nikos']['path'] =3D '/'
    cookie['nikos']['expires'] =3D 60*60*24*30*12 #this cookie will expire in=
    a year


    #needed line, script does *not* work without it
    sys.stdout =3D os.fdopen(1, 'w', encoding=3D'utf-8')

    print( cookie )
    print ( "Content-type: text/html; charset=3Dutf-8\n" )
    print( msg )

    sys.exit(0)
    [/code]

    is till wonder how the other scripts which they do more stuff dont provide =
    me this suecec error.

    Should i delete and recreate the koukos.py file?

    --- MBSE BBS v0.95.15 (GNU/Linux-x86_64)
    * Origin: The Kofo BBS MBSE - telnet://fido1.kofobbs.ne
  • From nikos.gr33k@gmail.com@1:0/0 to All on Fri May 31 15:03:26 2013
    =CE=A4=CE=B7 =CE=A0=CE=B1=CF=81=CE=B1=CF=83=CE=BA=CE=B5=CF=85=CE=AE, 31 =CE= =9C=CE=B1=CE=90=CE=BF=CF=85 2013 3:53:44 =CE=BC.=CE=BC. UTC+3, =CE=BF =CF= =87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 Richard Kettlewell =CE=AD=CE=B3=CF= =81=CE=B1=CF=88=CE=B5:
    nikos.gr33k@gmail.com writes:
    =20
    Should i delete and recreate the koukos.py file?
    =20
    =20
    =20
    There is no point doing that. suexec is not getting as far as running
    =20
    the script. You need to study the Apache manual and your local
    =20
    configuration, to discover why suexec is being used when (apparently)
    =20
    you don=E2=80=99t want it to be. Making random changes without understan=
    ding
    =20
    what=E2=80=99s going on is not likely to help.

    Can someone please look into this because iam unexperienced with these type=
    s of issues?

    Richard can you give it a try please if i provide you with access to my VPS=
    ?

    --- MBSE BBS v0.95.15 (GNU/Linux-x86_64)
    * Origin: The Kofo BBS MBSE - telnet://fido1.kofobbs.ne
  • From Richard Kettlewell@110:300/1.1 to All on Thu May 30 23:16:14 2013
    Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
    nikos.gr33k@gmail.com wrote:

    i want to test a python script i made online online and i receive
    this message:

    [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file
    [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] fopen: Permission denied
    [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py
    [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] File does not exist: /home/nikos/public_html/500.shtml

    when i tail -F /usr/local/apache/logs/error_log &

    What this error means?

    It appears that the effective user of the script does not have
    permission to open the log file that the suexec call requires.

    That can’t be right; suexec opens the logfile before changing UID. The
    most likely explanation is that suexec is wrongly installed.

    --
    http://www.greenend.org.uk/rjk/

    --- MBSE BBS v0.95.15 (GNU/Linux-x86_64)
    * Origin: Anjou (110:300/1.1@linuxnet)
  • From nagia.retsina@gmail.com@1:0/0 to All on Fri May 31 06:40:14 2013
    =CE=A4=CE=B7 =CE=A0=CE=B1=CF=81=CE=B1=CF=83=CE=BA=CE=B5=CF=85=CE=AE, 31 =CE= =9C=CE=B1=CE=90=CE=BF=CF=85 2013 12:16:14 =CF=80.=CE=BC. UTC+3, =CE=BF =CF= =87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 Richard Kettlewell =CE=AD=CE=B3=CF= =81=CE=B1=CF=88=CE=B5:
    Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
    =20
    nikos.gr33k@gmail.com wrote:
    =20
    =20
    =20
    i want to test a python script i made online online and i receive
    =20
    this message:
    =20
    =20
    =20
    [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure=
    : could not open log file
    =20
    [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] fopen: Permiss=
    ion denied
    =20
    [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] Premature end =
    of script headers: koukos.py
    =20
    [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] File does not =
    exist: /home/nikos/public_html/500.shtml
    =20
    =20
    =20
    when i tail -F /usr/local/apache/logs/error_log &
    =20
    =20
    =20
    What this error means?
    =20

    =20
    It appears that the effective user of the script does not have
    =20
    permission to open the log file that the suexec call requires.
    =20
    =20
    =20
    That can=E2=80=99t be right; suexec opens the logfile before changing UID=
    .. The
    =20
    most likely explanation is that suexec is wrongly installed.
    =20
    =20
    =20
    --=20
    =20
    http://www.greenend.org.uk/rjk/

    But i have mnay python scripts why the problem only appear to this one (kou= kos.py) ?

    --- MBSE BBS v0.95.15 (GNU/Linux-x86_64)
    * Origin: The Kofo BBS MBSE - telnet://fido1.kofobbs.ne