mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-23 00:25:18 +00:00
tests: Create certidude user in advance
This commit is contained in:
parent
f9eaa94230
commit
e0eb3ee471
@ -17,6 +17,7 @@ install:
|
|||||||
script:
|
script:
|
||||||
- sudo useradd adminbot -G sudo -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
|
- sudo useradd adminbot -G sudo -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
|
||||||
- sudo useradd userbot -G users -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
|
- sudo useradd userbot -G users -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
|
||||||
|
- sudo adduser --system --no-create-home --group certidude
|
||||||
- sudo py.test --cov-report xml --cov=certidude tests/
|
- sudo py.test --cov-report xml --cov=certidude tests/
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
|
@ -828,6 +828,7 @@ def certidude_setup_authority(username, kerberos_keytab, nginx_config, country,
|
|||||||
if os.getuid() == 0:
|
if os.getuid() == 0:
|
||||||
try:
|
try:
|
||||||
pwd.getpwnam("certidude")
|
pwd.getpwnam("certidude")
|
||||||
|
click.echo("User 'certidude' already exists")
|
||||||
except KeyError:
|
except KeyError:
|
||||||
cmd = "adduser", "--system", "--no-create-home", "--group", "certidude"
|
cmd = "adduser", "--system", "--no-create-home", "--group", "certidude"
|
||||||
if subprocess.call(cmd):
|
if subprocess.call(cmd):
|
||||||
@ -871,8 +872,8 @@ def certidude_setup_authority(username, kerberos_keytab, nginx_config, country,
|
|||||||
port = "80"
|
port = "80"
|
||||||
else:
|
else:
|
||||||
port = "8080"
|
port = "8080"
|
||||||
|
click.echo("Generating: %s" % nginx_config.name)
|
||||||
nginx_config.write(env.get_template("server/nginx.conf").render(vars()))
|
nginx_config.write(env.get_template("server/nginx.conf").render(vars()))
|
||||||
click.echo("Generated: %s" % nginx_config.name)
|
|
||||||
if not os.path.exists("/etc/nginx/sites-enabled/certidude.conf"):
|
if not os.path.exists("/etc/nginx/sites-enabled/certidude.conf"):
|
||||||
os.symlink("../sites-available/certidude.conf", "/etc/nginx/sites-enabled/certidude.conf")
|
os.symlink("../sites-available/certidude.conf", "/etc/nginx/sites-enabled/certidude.conf")
|
||||||
click.echo("Symlinked %s -> /etc/nginx/sites-enabled/" % nginx_config.name)
|
click.echo("Symlinked %s -> /etc/nginx/sites-enabled/" % nginx_config.name)
|
||||||
@ -889,7 +890,7 @@ def certidude_setup_authority(username, kerberos_keytab, nginx_config, country,
|
|||||||
fh.write(env.get_template("server/systemd.service").render(vars()))
|
fh.write(env.get_template("server/systemd.service").render(vars()))
|
||||||
click.echo("File /etc/systemd/system/certidude.service created")
|
click.echo("File /etc/systemd/system/certidude.service created")
|
||||||
else:
|
else:
|
||||||
NotImplemented # No systemd
|
click.echo("Not systemd based OS, don't know how to set up initscripts")
|
||||||
|
|
||||||
_, _, uid, gid, gecos, root, shell = pwd.getpwnam("certidude")
|
_, _, uid, gid, gecos, root, shell = pwd.getpwnam("certidude")
|
||||||
os.setgid(gid)
|
os.setgid(gid)
|
||||||
|
Loading…
Reference in New Issue
Block a user