Ensim’s (aka Parallels Pro Control Panel X for Linux) alternative ChangePasswdVirtUser
Nov 24, 2008 Code, Ensim, Linux, Lost+Found, Software
Ensim former Parallels Pro Control Panel X for Linux has a command line interface scripts as you SHOULD know
which allows you to do several administrative tasks without login to the appliance. The other day I started to write an API in order to admin N Ensim servers with only 1 interface which is a lot of work/code but hell, I’ll post some screenshots later
… So one of the biggest problems I had was the script ChangePasswdVirtUser (located in /usr/local/bin), which allows you to change a virtual user’s password asking for the new password 2 times and I didn’t want to ruin my weekend and decided to hack that script and make it work like this: ChangePasswdVirtUser domain.com user newpassword
That’s so insecure! I know and I’ll come later with a more secure alternative don’t worry
in the meantime you can play with it:
File: /usr/local/bin/ChangePasswdVirtUser1
#!/usr/bin/ensim-python # # Usage: # # ChangePasswdVirtUser <domainname> <username> <passwd> # # Example: # # AddVirtUser myco.com joe doe import getopt import getpass import sys import traceback from vh3 import virthost from vh3 import virtutil from vh3.modules import users import string import be_vherrordisp if (len(sys.argv) < 4) or (sys.argv[1] == "--help"): print "usage: ChangePasswdVirtUser1 <domainname> <username> <passwd>" sys.exit(0) else: # checks to see if we are in maintenance mode virthost.checkMaintenance() status = be_vherrordisp.CLIError.SUCCESS status_obj = be_vherrordisp.CLIError() options, args = getopt.getopt(sys.argv[1:],"") siteindex = virthost.get_site_from_anything(string.lower(args[0])) username = string.lower(args[1]) passwd1 = args[2] if not siteindex: print "Domain %s does not exist on this server."% string.lower(args[0]) sys.exit(1) ret = [] try: virthost.edit_user(ret, siteindex, username, None, passwd1, None, None) status = virthost.cli_display_status_list(ret) except: status = be_vherrordisp.CLIError.ERROR print traceback.print_exc() sys.exit(status)
November 26th, 2008 at 3:13 am
Try php’s proc_open next time
cheers!
November 29th, 2008 at 12:38 pm
@Ahmek: I tried with proc_open with no luck because output is not sent to STDOUT, but as I said, I’ll come back with something better soon don’t worry
thanks for your comments.