#NEWLINE# def archivedCertificateHandle( self , domain , ee_wp_email ) : #NEWLINE# #INDENT# Log . warn ( self , ( 'You already have an existing certificate for the domain requested.\n(ref: /etc/letsencrypt/renewal/{0}.conf)' . format ( domain ) + '\nPlease select an option from below?\n\t1: Reinstall existing certificate\n\t2: Keep the existing certificate for now\n\t3: Renew & replace the certificate (limit ~5 per 7 days)' ) ) #NEWLINE# check_prompt = input ( '\nType the appropriate number [1-3] or any other key to cancel: ' ) #NEWLINE# if ( not os . path . isfile ( '/etc/letsencrypt/live/{0}/cert.pem' . format ( domain ) ) ) : #NEWLINE# #INDENT# Log . error ( self , '/etc/letsencrypt/live/{0}/cert.pem file is missing.' . format ( domain ) ) #NEWLINE# #UNINDENT# if ( check_prompt == '1' ) : #NEWLINE# #INDENT# Log . info ( self , 'Please Wait while we reinstall SSL Certificate for your site.\nIt may take time depending upon network.' ) #NEWLINE# ssl = EEShellExec . cmd_exec ( self , ( './letsencrypt-auto certonly --reinstall --webroot -w /var/www/{0}/htdocs/ -d {0} -d www.{0} ' . format ( domain ) + '--email {0} --text --agree-tos' . format ( ee_wp_email ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( check_prompt == '2' ) : #NEWLINE# #INDENT# Log . info ( self , 'Using Existing Certificate files' ) #NEWLINE# if ( not ( os . path . isfile ( '/etc/letsencrypt/live/{0}/fullchain.pem' . format ( domain ) ) or os . path . isfile ( '/etc/letsencrypt/live/{0}/privkey.pem' . format ( domain ) ) ) ) : #NEWLINE# #INDENT# Log . error ( self , 'Certificate files not found. Skipping.\nPlease check if following file exist\n\t/etc/letsencrypt/live/{0}/fullchain.pem\n\t/etc/letsencrypt/live/{0}/privkey.pem' . format ( domain ) ) #NEWLINE# #UNINDENT# ssl = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( check_prompt == '3' ) : #NEWLINE# #INDENT# Log . info ( self , 'Please Wait while we renew SSL Certificate for your site.\nIt may take time depending upon network.' ) #NEWLINE# ssl = EEShellExec . cmd_exec ( self , ( './letsencrypt-auto --renew-by-default certonly --webroot -w /var/www/{0}/htdocs/ -d {0} -d www.{0} ' . format ( domain ) + '--email {0} --text --agree-tos' . format ( ee_wp_email ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# Log . error ( self , 'Operation cancelled by user.' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if os . path . isfile ( '{0}/conf/nginx/ssl.conf' . format ( domain ) ) : #NEWLINE# #INDENT# Log . info ( self , 'Existing ssl.conf . Backing it up ..' ) #NEWLINE# EEFileUtils . mvfile ( self , '/var/www/{0}/conf/nginx/ssl.conf' . format ( domain ) , '/var/www/{0}/conf/nginx/ssl.conf.bak' . format ( domain ) ) #NEWLINE# #UNINDENT# return ssl