def _remove(domain): from libsw import cert if not domain: domain = cert.select_domain("Select certificate to remove") if not cert.has_cert(domain): print(domain + ' is not covered by a certificate.') return if cert.remove_le_cert(domain) > 0: print('Removed certificate for ' + domain)
def _deploylocal(domain): from libsw import cert if domain == False or not cert.has_cert(domain): domain = cert.select_domain("Select domain to deploy local certs for") updated = cert.add_local_deploy(domain) if updated: print('Added ' + domain + ' to local certificate deployments') else: print(domain + ' already gets local certificate deployments')
def _removelocal(domain, more): from libsw import cert if domain == False or not cert.has_cert(domain): domain = cert.select_domain("Select domain to stop deploying locally") dropped = cert.remove_local_deploy(domain) if dropped: print('Removed ' + domain + ' from local certificate deployments') else: print(domain + ' was not registered to get local certificate deployments') if more and len(more) > 0 and more[0] == 'dropfiles': count = cert.remove_local_certificates(domain) print('Deleted ' + str(count) + ' .pem files')
def _setdomain(domain, more): from libsw import email, user, cert sys_user = False if domain == False: domain = email.select_domain() elif more != False: sys_user = more[0] if not user.exists(sys_user): sys_user = False if sys_user == False: sys_user = user.select_user() email.SetMailDomain(domain, sys_user).run() if cert.has_cert(domain): cert.deploy_exim_domain(domain) cert.update_dovecot_ssl()
def _add(domain, more): from libsw import nginx, user, cert if domain == False: domain = input_util.input_domain() username = False template = False if more != False: username = more[0] if len(more) > 1: template = more[1] if username != False and not user.exists(username): username = False if username == False: username = user.select_user() hide_ssl = True if cert.has_cert(domain): hide_ssl = False if template == False: template = nginx.choose_template("Select a vhost template: ", hide_ssl) nginx.make_vhost(username, domain, template)