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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
#!/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) |