Jan Ulrich Hasecke
2019-11-14 d80dd3dd28e2960b877f2157d20fc7d8cfe7ac46
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
import random
import string
import sys
from hs.admin.api import API
 
api = API(cas=dict(
    uri='https://login.hostsharing.net/cas/v1/tickets',
    service='https://config.hostsharing.net:443/hsar/backend'),
    credentials=dict(username='xyz00', password='Y2kbZb)d*GQF%q1~m?7d8,]+'),
    backends=[
        'https://config.hostsharing.net:443/hsar/xmlrpc/hsadmin',
        'https://config2.hostsharing.net:443/hsar/xmlrpc/hsadmin'])
 
def pwGen(stringLength=12):
    """Function to generate a random password """
 
    password_characters = string.ascii_letters + string.digits
    return ''.join(random.choice(password_characters) for i in range(stringLength))
 
pw_dadmin = pwGen()
pw_dbuser = pwGen()
 
domainname = sys.argv[1]
dbname = domainname.replace(".", "_")
 
api.user.add(set={'name': 'xyz00-'+domainname, 'password': pw_dadmin, 'shell': '/bin/bash'})
api.domain.add(set={'name': domainname, 'user': 'xyz00-'+domainname})
api.mysqluser.add(set={'name': 'xyz00_'+dbname, 'password': pw_dbuser})
api.mysqldb.add(set={'name': 'xyz00_'+dbname, 'owner': 'xyz00_'+dbname})
 
print("Domainname:" +domainname)
print("Domain-Admin: xyz00-"+domainname + "Passwort:" +pw_dadmin)
print("Datenbank-Nutzer: " +dbname + "Passwort:" +pw_dbuser)
print("Datenbank: " +dbname)