Re: [Zope] useradd command in Zope
ajit mote wrote: command=/usr/sbin/adduser -p +password+ + userName return os.system(command) You are going to get yourself into a world of pain. os.system isn't the right thing to use here due to its lack of output redirection. Calling adduser like that is a really big hole in your system's security. Adding in sudo in there will make it even worse ;-) Seriously, I don't mean this is a nasty way, but you have neither the skill not the experience to attempt the development of the application you are trying to develop. Give up, or pay someone who knows better to do it for you :-S Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
this is what i tried #External script addUser.py (stored in instance/Extensions folder) import crypt import os def addUser(userName,password): password=crypt.crypt(password,5Ag5zoM9) command=/usr/sbin/adduser -p +password+ + userName return os.system(command) /// attaching the application exported from zope2.8.1 ,python-2.3.4-11,mysql-3.23.58-13 and Linux 2.6.9-1.667 now i hope that , problem defination is very clear and open.. /// On 11/7/05, Tino Wildenhain [EMAIL PROTECTED] wrote: Am Montag, den 07.11.2005, 09:32 +0530 schrieb ajit mote: i did the same but still not working. On 11/3/05, Tino Wildenhain [EMAIL PROTECTED] wrote: ajit mote schrieb: useradd ... On 11/3/05, *Andreas Jung* [EMAIL PROTECTED] mailto: [EMAIL PROTECTED] wrote: Look at the sudo command (man sudo). This is basically a non-Zope question. i don't think this is non-zope question bca'z... i am using python script to add user to system which works fine when run outside of zope ... but when i run it through zope as external script (with all permission) it's not working and returning 256 without giving any error... as root, su zopeuser first and then try your script. Zopeuser meaning the user account your zope runs. Again, double and tripple check if you secured this application in any way before opening it to the web.Try harder :-) Seriously, what should we do to help you? If something isn'tworking as expected, give us the code you try, theenvironment and exact error messages, preferably tracebacks. addUser.zexp Description: Binary data ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
ajit mote schrieb: this is what i tried #External script addUser.py (stored in instance/Extensions folder) import crypt import os def addUser(userName,password): password=crypt.crypt(password,5Ag5zoM9) command=/usr/sbin/adduser -p +password+ + userName return os.system(command) Heaven! Is this external method available via web? If so be prepared for massive attack :-) That aside you may consider md5 instead of crypt to make it not too easy to crack (otoh, its not really important as your script really allows for any command) /// attaching the application exported from zope2.8.1 ,python-2.3.4-11,mysql-3.23.58-13 and Linux 2.6.9-1.667 now i hope that , problem defination is very clear and open.. /// Well no, at least not your it does not work problem you told us. Still missing: the call to the script as User which runs zope which might be zope or nobody or something, depending on your configuration and the way you start zope. Add the following lines to your external method and you can run it as script too: if __name__=='__main__': import sys try: user=sys.argv[1] pass=sys.argv[2] except IndexError: sys.stderr.write(Please start me with %s username password\n % sys.argv[0]) sys.exit(20) addUser(user,pass) and try it like this: su zope (or whoever your zope runs) ./yourmethod.py someuser somepass You will see it fail (apart from the fact you need the #!/path/to/python.bin and set the execution bit with chmod a+x before you try) Because you did not use sudo as adviced. Please try to copy the way mails are cited from other mails in this list. Dont put all your text on the top of a full quote. Thank you. Regards Tino ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
On 11/7/05, Tino Wildenhain [EMAIL PROTECTED] wrote: ajit mote schrieb: this is what i tried #External script addUser.py (stored in instance/Extensions folder) import crypt import os def addUser(userName,password): password=crypt.crypt(password,5Ag5zoM9) command=/usr/sbin/adduser -p +password+ + userName return os.system(command)Heaven! Is this external method available via web? If so be prepared for massive attack :-)That aside you may consider md5 instead of crypt to make it not too easy to crack (otoh, its not really importantas your script really allows for any command) as we are going to use application only in intranet . we are developing this web application only for our purpose ie. using only inside our firm my sys admin allow me to do this so no security problem ///attaching the application exported from zope2.8.1 ,python-2.3.4-11,mysql-3.23.58-13 and Linux2.6.9-1.667 now i hope that , problem defination is very clear and open.. /// Well no, at least not your it does not work problem you told us.Still missing: the call to the script as User which runs zopewhich might be zope or nobody or something, depending on your configuration and the way you start zope.Add the following lines to your external method and you canrun it as script too:if __name__=='__main__':import systry: user=sys.argv [1] pass=sys.argv[2]except IndexError: sys.stderr.write(Please start me with %s usernamepassword\n % sys.argv[0]) sys.exit(20) addUser(user,pass) and try it like this:su zope (or whoever your zope runs)./yourmethod.py someuser somepassYou will see it fail (apart from the fact you needthe #!/path/to/python.bin and set the execution bit with chmod a+x before you try) i tried using another user outside of zope . working very well(adding user to system) owner of external method is root and set_user_id bit is set. but problem is when i run attached app it is not adding user Because you did not use sudo as adviced.Please try to copy the way mails are cited from other mails in this list. Dont put all your text on thetop of a full quote. Thank you.RegardsTino i am really sorry for the same ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
i did the same but still not working.On 11/3/05, Tino Wildenhain [EMAIL PROTECTED] wrote: ajit mote schrieb:useradd ... On 11/3/05, *Andreas Jung* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Look at the sudo command (man sudo). This is basically a non-Zope question. i don't think this is non-zope question bca'z...i am using python script to add user to system which works fine when run outside of zope ... but when i run it through zope as external script (with all permission) it's not working and returning 256 without giving any error...as root, su zopeuser first and then try your script. Zopeuser meaning the user account your zope runs.Again, double and tripple check if you secured thisapplication in any way before opening it to the web. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
Am Montag, den 07.11.2005, 09:32 +0530 schrieb ajit mote: i did the same but still not working. On 11/3/05, Tino Wildenhain [EMAIL PROTECTED] wrote: ajit mote schrieb: useradd ... On 11/3/05, *Andreas Jung* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Look at the sudo command (man sudo). This is basically a non-Zope question. i don't think this is non-zope question bca'z... i am using python script to add user to system which works fine when run outside of zope ... but when i run it through zope as external script (with all permission) it's not working and returning 256 without giving any error... as root, su zopeuser first and then try your script. Zopeuser meaning the user account your zope runs. Again, double and tripple check if you secured this application in any way before opening it to the web. Try harder :-) Seriously, what should we do to help you? If something isn't working as expected, give us the code you try, the environment and exact error messages, preferably tracebacks. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] useradd command in Zope
Hi , how to use command that require Root privileges like useradd,reading shadow file bca'z iinstallzopeasnon root user now i need to use useradd command in my application ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
--On 3. November 2005 17:06:55 +0530 ajit mote [EMAIL PROTECTED] wrote: Hi , how to use command that require Root privileges like useradd,reading shadow file bca'z i install zope as non root user now i need to use useradd command in my application Look at the sudo command (man sudo). This is basically a non-Zope question. -aj pgpGDW91L7XWq.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] useradd command in Zope
useradd ... On 11/3/05, Andreas Jung [EMAIL PROTECTED] wrote: Look at the sudo command (man sudo). This is basically a non-Zope question. i don't think this is non-zope question bca'z... i am using python script to add user to system which works fine when run outside of zope ... but when i run it through zope as external script (with all permission) it's not working and returning 256 without giving any error... ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] useradd command in Zope
ajit mote schrieb: useradd ... On 11/3/05, *Andreas Jung* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Look at the sudo command (man sudo). This is basically a non-Zope question. i don't think this is non-zope question bca'z... i am using python script to add user to system which works fine when run outside of zope ... but when i run it through zope as external script (with all permission) it's not working and returning 256 without giving any error... as root, su zopeuser first and then try your script. Zopeuser meaning the user account your zope runs. Again, double and tripple check if you secured this application in any way before opening it to the web. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )