File tree Expand file tree Collapse file tree 2 files changed +5
-18
lines changed Expand file tree Collapse file tree 2 files changed +5
-18
lines changed Original file line number Diff line number Diff line change @@ -874,12 +874,8 @@ const internalCertificate = {
874874 // Escape single quotes and backslashes
875875 const escapedCredentials = certificate . meta . dns_provider_credentials . replaceAll ( '\'' , '\\\'' ) . replaceAll ( '\\' , '\\\\' ) ;
876876 const credentialsCmd = 'mkdir -p /etc/letsencrypt/credentials 2> /dev/null; echo \'' + escapedCredentials + '\' > \'' + credentialsLocation + '\' && chmod 600 \'' + credentialsLocation + '\'' ;
877- let prepareCmd = 'pip install ' + dns_plugin . package_name + ( dns_plugin . version_requirement || '' ) + ' ' + dns_plugin . dependencies ;
878-
879- // Special case for cloudflare
880- if ( dns_plugin . package_name === 'certbot-dns-cloudflare' ) {
881- prepareCmd = 'pip install certbot-dns-cloudflare --index-url https://www.piwheels.org/simple --prefer-binary' ;
882- }
877+ // we call `. /opt/certbot/bin/activate` (`.` is alternative to `source` in dash) to access certbot venv
878+ let prepareCmd = '. /opt/certbot/bin/activate && pip install ' + dns_plugin . package_name + ( dns_plugin . version_requirement || '' ) + ' ' + dns_plugin . dependencies + " && deactivate" ;
883879
884880 // Whether the plugin has a --<name>-credentials argument
885881 const hasConfigArg = certificate . meta . dns_provider !== 'route53' ;
Original file line number Diff line number Diff line change @@ -171,18 +171,13 @@ const setupCertbotPlugins = () => {
171171 if ( certificates && certificates . length ) {
172172 let plugins = [ ] ;
173173 let promises = [ ] ;
174- let install_cloudflare_plugin = false ;
175174
176175 certificates . map ( function ( certificate ) {
177176 if ( certificate . meta && certificate . meta . dns_challenge === true ) {
178177 const dns_plugin = dns_plugins [ certificate . meta . dns_provider ] ;
179178
180- if ( dns_plugin . package_name === 'certbot-dns-cloudflare' ) {
181- install_cloudflare_plugin = true ;
182- } else {
183- const packages_to_install = `${ dns_plugin . package_name } ${ dns_plugin . version_requirement || '' } ${ dns_plugin . dependencies } ` ;
184- if ( plugins . indexOf ( packages_to_install ) === - 1 ) plugins . push ( packages_to_install ) ;
185- }
179+ const packages_to_install = `${ dns_plugin . package_name } ${ dns_plugin . version_requirement || '' } ${ dns_plugin . dependencies } ` ;
180+ if ( plugins . indexOf ( packages_to_install ) === - 1 ) plugins . push ( packages_to_install ) ;
186181
187182 // Make sure credentials file exists
188183 const credentials_loc = '/etc/letsencrypt/credentials/credentials-' + certificate . id ;
@@ -194,14 +189,10 @@ const setupCertbotPlugins = () => {
194189 } ) ;
195190
196191 if ( plugins . length ) {
197- const install_cmd = 'pip install ' + plugins . join ( ' ' ) ;
192+ const install_cmd = '. /opt/certbot/bin/activate && pip install ' + plugins . join ( ' ' ) + " && deactivate" ;
198193 promises . push ( utils . exec ( install_cmd ) ) ;
199194 }
200195
201- if ( install_cloudflare_plugin ) {
202- promises . push ( utils . exec ( 'pip install certbot-dns-cloudflare --index-url https://www.piwheels.org/simple --prefer-binary' ) ) ;
203- }
204-
205196 if ( promises . length ) {
206197 return Promise . all ( promises )
207198 . then ( ( ) => {
You can’t perform that action at this time.
0 commit comments