|
36 |
from listener import configRegistry, setuid, unsetuid |
36 |
from listener import configRegistry, setuid, unsetuid |
37 |
import grp |
37 |
import grp |
38 |
import os |
38 |
import os |
|
|
39 |
import tempfile |
39 |
|
40 |
|
40 |
import univention.debug as ud |
41 |
import univention.debug as ud |
41 |
import subprocess |
42 |
import subprocess |
Lines 159-169
def create_certificate(hostname, domainname):
|
Link Here
|
---|
|
159 |
ud.debug(ud.LISTENER, ud.INFO, |
160 |
ud.debug(ud.LISTENER, ud.INFO, |
160 |
'CERTIFICATE: Creating certificate %s' % hostname) |
161 |
'CERTIFICATE: Creating certificate %s' % hostname) |
161 |
|
162 |
|
162 |
cmd = '. /usr/share/univention-ssl/make-certificates.sh;gencert "%s" "%s"' % \ |
163 |
with tempfile.NamedTemporaryFile() as fd: |
163 |
(fqdn, fqdn) |
164 |
fd.write('. /usr/share/univention-ssl/make-certificates.sh;gencert "$UCS_FQDN" "$UCS_FQDN"') |
164 |
ret = subprocess.call(cmd, shell=True) |
165 |
fd.flush() |
165 |
if ret: |
166 |
env = os.environ.copy() |
166 |
raise Exception("Certificate creation failed.") |
167 |
env['UCS_FQDN'] = fqdn |
|
|
168 |
ret = subprocess.call(['/bin/sh', fd.name], env=env) |
169 |
if ret: |
170 |
raise Exception("Certificate creation failed.") |
167 |
|
171 |
|
168 |
# Create symlink |
172 |
# Create symlink |
169 |
try: |
173 |
try: |