mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-11-03 17:13:33 +00:00 
			
		
		
		
	request via cloudflare dns working
This commit is contained in:
		@@ -146,7 +146,11 @@ const internalCertificate = {
 | 
			
		||||
								.then(internalNginx.reload)
 | 
			
		||||
								.then(() => {
 | 
			
		||||
									// 4. Request cert
 | 
			
		||||
									return internalCertificate.requestLetsEncryptSsl(certificate);
 | 
			
		||||
									if (data.meta.cloudflare_use) {
 | 
			
		||||
										return internalCertificate.requestLetsEncryptCloudFlareDnsSsl(certificate, data.meta.cloudflare_token);
 | 
			
		||||
									} else {
 | 
			
		||||
										return internalCertificate.requestLetsEncryptSsl(certificate);
 | 
			
		||||
									}
 | 
			
		||||
								})
 | 
			
		||||
								.then(() => {
 | 
			
		||||
									// 5. Remove LE config
 | 
			
		||||
@@ -748,6 +752,40 @@ const internalCertificate = {
 | 
			
		||||
			});
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param   {Object}  certificate   the certificate row
 | 
			
		||||
	 * @param	{String} apiToken		the cloudflare api token
 | 
			
		||||
	 * @returns {Promise}
 | 
			
		||||
	 */
 | 
			
		||||
	requestLetsEncryptCloudFlareDnsSsl: (certificate, apiToken) => {
 | 
			
		||||
		logger.info('Requesting Let\'sEncrypt certificates via Cloudflare DNS for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', '));
 | 
			
		||||
 | 
			
		||||
		let tokenLoc = '~/cloudflare-token';
 | 
			
		||||
		let storeKey = 'echo "dns_cloudflare_api_token = ' + apiToken + '" > ' + tokenLoc;	
 | 
			
		||||
 | 
			
		||||
		let cmd = certbot_command + ' certonly --non-interactive ' +
 | 
			
		||||
			'--cert-name "npm-' + certificate.id + '" ' +
 | 
			
		||||
			'--agree-tos ' +
 | 
			
		||||
			'--email "' + certificate.meta.letsencrypt_email + '" ' +			
 | 
			
		||||
			'--domains "' + certificate.domain_names.join(',') + '" ' +
 | 
			
		||||
			'--dns-cloudflare --dns-cloudflare-credentials ' + tokenLoc + ' ' +
 | 
			
		||||
			(le_staging ? '--staging' : '');
 | 
			
		||||
 | 
			
		||||
		if (debug_mode) {
 | 
			
		||||
			logger.info('Command:', cmd);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return utils.exec(storeKey).then((result) => {
 | 
			
		||||
			utils.exec(cmd).then((result) => {
 | 
			
		||||
				utils.exec('rm ' + tokenLoc).then(result => {
 | 
			
		||||
					logger.success(result);
 | 
			
		||||
					return result;
 | 
			
		||||
				});				
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param   {Access}  access
 | 
			
		||||
	 * @param   {Object}  data
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user