mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 15:53:33 +00:00 
			
		
		
		
	add cloudflare renew and make revoke working for both by deleting unnecessary config command
This commit is contained in:
		| @@ -818,7 +818,9 @@ const internalCertificate = { | |||||||
| 			}) | 			}) | ||||||
| 			.then((certificate) => { | 			.then((certificate) => { | ||||||
| 				if (certificate.provider === 'letsencrypt') { | 				if (certificate.provider === 'letsencrypt') { | ||||||
| 					return internalCertificate.renewLetsEncryptSsl(certificate) | 					let renewMethod = certificate.meta.cloudflare_use ? internalCertificate.renewLetsEncryptCloudFlareSsl : internalCertificate.renewLetsEncryptSsl;		 | ||||||
|  |  | ||||||
|  | 					return renewMethod(certificate) | ||||||
| 						.then(() => { | 						.then(() => { | ||||||
| 							return internalCertificate.getCertificateInfoFromFile('/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem'); | 							return internalCertificate.getCertificateInfoFromFile('/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem'); | ||||||
| 						}) | 						}) | ||||||
| @@ -872,6 +874,29 @@ const internalCertificate = { | |||||||
| 			}); | 			}); | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param   {Object}  certificate   the certificate row | ||||||
|  | 	 * @returns {Promise} | ||||||
|  | 	 */ | ||||||
|  | 	renewLetsEncryptCloudFlareSsl: (certificate) => { | ||||||
|  | 		logger.info('Renewing Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', ')); | ||||||
|  |  | ||||||
|  | 		let cmd = certbot_command + ' renew --non-interactive ' + | ||||||
|  | 			'--cert-name "npm-' + certificate.id + '" ' + | ||||||
|  | 			'--disable-hook-validation ' + | ||||||
|  | 			(le_staging ? '--staging' : ''); | ||||||
|  |  | ||||||
|  | 		if (debug_mode) { | ||||||
|  | 			logger.info('Command:', cmd); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		return utils.exec(cmd) | ||||||
|  | 			.then((result) => { | ||||||
|  | 				logger.info(result); | ||||||
|  | 				return result; | ||||||
|  | 			}); | ||||||
|  | 	}, | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @param   {Object}  certificate    the certificate row | 	 * @param   {Object}  certificate    the certificate row | ||||||
| 	 * @param   {Boolean} [throw_errors] | 	 * @param   {Boolean} [throw_errors] | ||||||
| @@ -881,7 +906,6 @@ const internalCertificate = { | |||||||
| 		logger.info('Revoking Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', ')); | 		logger.info('Revoking Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', ')); | ||||||
|  |  | ||||||
| 		let cmd = certbot_command + ' revoke --non-interactive ' + | 		let cmd = certbot_command + ' revoke --non-interactive ' + | ||||||
| 			'--config "' + le_config + '" ' + |  | ||||||
| 			'--cert-path "/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem" ' + | 			'--cert-path "/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem" ' + | ||||||
| 			'--delete-after-revoke ' + | 			'--delete-after-revoke ' + | ||||||
| 			(le_staging ? '--staging' : ''); | 			(le_staging ? '--staging' : ''); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user