{"id":51,"date":"2008-11-24T16:40:45","date_gmt":"2008-11-24T21:40:45","guid":{"rendered":"http:\/\/xux.in\/blog\/?p=51"},"modified":"2008-11-24T16:41:30","modified_gmt":"2008-11-24T21:41:30","slug":"ensim-parallels-pro-control-panel-x-for-linux-alternative-changepasswdvirtuser","status":"publish","type":"post","link":"http:\/\/xux.in\/blog\/post\/ensim-parallels-pro-control-panel-x-for-linux-alternative-changepasswdvirtuser\/","title":{"rendered":"Ensim&#8217;s (aka Parallels Pro Control Panel X for Linux) alternative ChangePasswdVirtUser"},"content":{"rendered":"<p>Ensim former <a href=\"http:\/\/www.parallels.com\/pro\/\">Parallels Pro Control Panel X for Linux<\/a> has a <a href=\"http:\/\/download.pro.parallels.com\/10.3.2\/docs\/linux\/Guides\/Technical\/html\/index.htm\">command line interface scripts<\/a> as you SHOULD know \ud83d\ude09 which allows you to do several administrative tasks without login to the appliance. The other day I started to write an <a href=\"http:\/\/en.wikipedia.org\/wiki\/API\">API<\/a> in order to admin N Ensim servers with only 1 interface which is a lot of work\/code but hell, I&#8217;ll post some screenshots later \ud83d\ude42 &#8230; 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&#8217;s password asking for the new password 2 times and I didn&#8217;t want to ruin my weekend and decided to hack that script and make it work like this: ChangePasswdVirtUser domain.com user newpassword<\/p>\n<p>That&#8217;s so insecure! I know and I&#8217;ll come later with a more secure alternative don&#8217;t worry \ud83d\ude09 in the meantime you can play with it:<\/p>\n<p>File: \/usr\/local\/bin\/ChangePasswdVirtUser1<\/p>\n<pre lang=\"python\">#!\/usr\/bin\/ensim-python\r\n#\r\n# Usage:\r\n#\r\n# ChangePasswdVirtUser <domainname> <username> <passwd>\r\n#\r\n# Example:\r\n#\r\n# AddVirtUser myco.com joe doe\r\n\r\nimport getopt\r\nimport getpass\r\nimport sys\r\nimport traceback\r\nfrom vh3 import virthost\r\nfrom vh3 import virtutil\r\nfrom vh3.modules import users\r\nimport string\r\nimport be_vherrordisp\r\n\r\nif (len(sys.argv) < 4) or (sys.argv[1] == \"--help\"):\r\n    print \"usage: ChangePasswdVirtUser1 <domainname> <username> <passwd>\"\r\n    sys.exit(0)\r\nelse:\r\n    # checks to see if we are in maintenance mode\r\n    virthost.checkMaintenance()\r\n\r\n    status = be_vherrordisp.CLIError.SUCCESS\r\n    status_obj = be_vherrordisp.CLIError()\r\n    options, args = getopt.getopt(sys.argv[1:],\"\")\r\n    siteindex = virthost.get_site_from_anything(string.lower(args[0]))\r\n    username = string.lower(args[1])\r\n    passwd1 = args[2]\r\n    if not siteindex:\r\n        print \"Domain %s does not exist on this server.\"% string.lower(args[0])\r\n        sys.exit(1)\r\n    ret = []\r\n    try:\r\n        virthost.edit_user(ret, siteindex, username, None, passwd1, None, None)\r\n        status = virthost.cli_display_status_list(ret)\r\n    except:\r\n        status = be_vherrordisp.CLIError.ERROR\r\n        print traceback.print_exc()\r\n    sys.exit(status)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Ensim former Parallels Pro Control Panel X for Linux has a command line interface scripts as you SHOULD know \ud83d\ude09 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,10,8,1,5],"tags":[13,32,28,16],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-code","category-ensim","category-linux","category-lostfound","category-software","tag-centos","tag-ensim","tag-python","tag-snippet"],"_links":{"self":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/comments?post=51"}],"version-history":[{"count":2,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":53,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/51\/revisions\/53"}],"wp:attachment":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}