You've already forked nginx-proxy-manager
							
							
				mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-11-04 04:11:42 +03:00 
			
		
		
		
	Fix cerbot plugin installation issues
This commit is contained in:
		@@ -874,12 +874,8 @@ const internalCertificate = {
 | 
				
			|||||||
		// Escape single quotes and backslashes
 | 
							// Escape single quotes and backslashes
 | 
				
			||||||
		const escapedCredentials = certificate.meta.dns_provider_credentials.replaceAll('\'', '\\\'').replaceAll('\\', '\\\\');
 | 
							const escapedCredentials = certificate.meta.dns_provider_credentials.replaceAll('\'', '\\\'').replaceAll('\\', '\\\\');
 | 
				
			||||||
		const credentialsCmd     = 'mkdir -p /etc/letsencrypt/credentials 2> /dev/null; echo \'' + escapedCredentials + '\' > \'' + credentialsLocation + '\' && chmod 600 \'' + credentialsLocation + '\'';
 | 
							const credentialsCmd     = 'mkdir -p /etc/letsencrypt/credentials 2> /dev/null; echo \'' + escapedCredentials + '\' > \'' + credentialsLocation + '\' && chmod 600 \'' + credentialsLocation + '\'';
 | 
				
			||||||
		let prepareCmd           = 'pip install ' + dns_plugin.package_name + (dns_plugin.version_requirement || '') + ' ' + dns_plugin.dependencies;
 | 
							// we call `. /opt/certbot/bin/activate` (`.` is alternative to `source` in dash) to access certbot venv
 | 
				
			||||||
 | 
							let prepareCmd           = '. /opt/certbot/bin/activate && pip install ' + dns_plugin.package_name + (dns_plugin.version_requirement || '') + ' ' + dns_plugin.dependencies + " && deactivate";
 | 
				
			||||||
		// Special case for cloudflare
 | 
					 | 
				
			||||||
		if (dns_plugin.package_name === 'certbot-dns-cloudflare') {
 | 
					 | 
				
			||||||
			prepareCmd = 'pip install certbot-dns-cloudflare --index-url https://www.piwheels.org/simple --prefer-binary';
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Whether the plugin has a --<name>-credentials argument
 | 
							// Whether the plugin has a --<name>-credentials argument
 | 
				
			||||||
		const hasConfigArg = certificate.meta.dns_provider !== 'route53';
 | 
							const hasConfigArg = certificate.meta.dns_provider !== 'route53';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -171,18 +171,13 @@ const setupCertbotPlugins = () => {
 | 
				
			|||||||
			if (certificates && certificates.length) {
 | 
								if (certificates && certificates.length) {
 | 
				
			||||||
				let plugins                   = [];
 | 
									let plugins                   = [];
 | 
				
			||||||
				let promises                  = [];
 | 
									let promises                  = [];
 | 
				
			||||||
				let install_cloudflare_plugin = false;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				certificates.map(function (certificate) {
 | 
									certificates.map(function (certificate) {
 | 
				
			||||||
					if (certificate.meta && certificate.meta.dns_challenge === true) {
 | 
										if (certificate.meta && certificate.meta.dns_challenge === true) {
 | 
				
			||||||
						const dns_plugin = dns_plugins[certificate.meta.dns_provider];
 | 
											const dns_plugin = dns_plugins[certificate.meta.dns_provider];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						if (dns_plugin.package_name === 'certbot-dns-cloudflare') {
 | 
					 | 
				
			||||||
							install_cloudflare_plugin = true;
 | 
					 | 
				
			||||||
						} else {
 | 
					 | 
				
			||||||
						const packages_to_install = `${dns_plugin.package_name}${dns_plugin.version_requirement || ''} ${dns_plugin.dependencies}`;
 | 
											const packages_to_install = `${dns_plugin.package_name}${dns_plugin.version_requirement || ''} ${dns_plugin.dependencies}`;
 | 
				
			||||||
						if (plugins.indexOf(packages_to_install) === -1) plugins.push(packages_to_install);
 | 
											if (plugins.indexOf(packages_to_install) === -1) plugins.push(packages_to_install);
 | 
				
			||||||
						}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
						// Make sure credentials file exists
 | 
											// Make sure credentials file exists
 | 
				
			||||||
						const credentials_loc = '/etc/letsencrypt/credentials/credentials-' + certificate.id;
 | 
											const credentials_loc = '/etc/letsencrypt/credentials/credentials-' + certificate.id;
 | 
				
			||||||
@@ -194,14 +189,10 @@ const setupCertbotPlugins = () => {
 | 
				
			|||||||
				});
 | 
									});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (plugins.length) {
 | 
									if (plugins.length) {
 | 
				
			||||||
					const install_cmd = 'pip install ' + plugins.join(' ');
 | 
										const install_cmd = '. /opt/certbot/bin/activate && pip install ' + plugins.join(' ') + " && deactivate";
 | 
				
			||||||
					promises.push(utils.exec(install_cmd));
 | 
										promises.push(utils.exec(install_cmd));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (install_cloudflare_plugin) {
 | 
					 | 
				
			||||||
					promises.push(utils.exec('pip install certbot-dns-cloudflare --index-url https://www.piwheels.org/simple --prefer-binary'));
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				if (promises.length) {
 | 
									if (promises.length) {
 | 
				
			||||||
					return Promise.all(promises)
 | 
										return Promise.all(promises)
 | 
				
			||||||
						.then(() => {
 | 
											.then(() => {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user