#NEWLINE# def renewLetsEncrypt( self , ee_domain_name ) : #NEWLINE# #INDENT# ee_wp_email = EEVariables . ee_email #NEWLINE# while ( not ee_wp_email ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ee_wp_email = input ( 'Enter email address: ' ) #NEWLINE# #UNINDENT# except EOFError as e : #NEWLINE# #INDENT# Log . debug ( self , '{0}' . format ( e ) ) #NEWLINE# raise SiteError ( 'Input WordPress email failed' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not os . path . isdir ( '/opt/letsencrypt' ) ) : #NEWLINE# #INDENT# cloneLetsEncrypt ( self ) #NEWLINE# #UNINDENT# EEFileUtils . chdir ( self , '/opt/letsencrypt' ) #NEWLINE# EEShellExec . cmd_exec ( self , 'git pull' ) #NEWLINE# Log . info ( self , 'Renewing SSl cert for https://{0}' . format ( ee_domain_name ) ) #NEWLINE# ssl = EEShellExec . cmd_exec ( self , ( './letsencrypt-auto --renew-by-default certonly --webroot -w /var/www/{0}/htdocs/ -d {0} -d www.{0} ' . format ( ee_domain_name ) + '--email {0} --text --agree-tos' . format ( ee_wp_email ) ) ) #NEWLINE# mail_list = '' #NEWLINE# if ( not ssl ) : #NEWLINE# #INDENT# Log . error ( self , 'ERROR : Cannot RENEW SSL cert !' , False ) #NEWLINE# if ( SSL . getExpirationDays ( self , ee_domain_name ) > 0 ) : #NEWLINE# #INDENT# Log . error ( self , ( ( 'Your current cert will expire within ' + str ( SSL . getExpirationDays ( self , ee_domain_name ) ) ) + ' days.' ) , False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# Log . error ( self , 'Your current cert already EXPIRED !' , False ) #NEWLINE# #UNINDENT# EESendMail ( 'easyengine@{0}' . format ( ee_domain_name ) , ee_wp_email , '[FAIL] SSL cert renewal {0}' . format ( ee_domain_name ) , ( ( ( 'Hey Hi,\n\nSSL Certificate renewal for https://{0} was unsuccessful.' . format ( ee_domain_name ) + '\nPlease check easyengine log for reason. Your SSL Expiry date : ' ) + str ( SSL . getExpirationDate ( self , ee_domain_name ) ) ) + "\n\nFor support visit https://easyengine.io/support/ .\n\nYour's faithfully,\nEasyEngine" ) , files = mail_list , port = 25 , isTls = False ) #NEWLINE# Log . error ( self , 'Check logs for reason `tail /var/log/ee/ee.log` & Try Again!!!' ) #NEWLINE# #UNINDENT# EEGit . add ( self , [ '/etc/letsencrypt' ] , msg = 'Adding letsencrypt folder' ) #NEWLINE# EESendMail ( 'easyengine@{0}' . format ( ee_domain_name ) , ee_wp_email , '[SUCCESS] SSL cert renewal {0}' . format ( ee_domain_name ) , ( ( ( 'Hey Hi,\n\nYour SSL Certificate has been renewed for https://{0} .' . format ( ee_domain_name ) + '\nYour SSL will Expire on : ' ) + str ( SSL . getExpirationDate ( self , ee_domain_name ) ) ) + "\n\nYour's faithfully,\nEasyEngine" ) , files = mail_list , port = 25 , isTls = False )