@@ -7,7 +7,7 @@ const utils = require('./lib/utils');
7
7
const authModel = require ( './models/auth' ) ;
8
8
const settingModel = require ( './models/setting' ) ;
9
9
const dns_plugins = require ( './global/certbot-dns-plugins' ) ;
10
-
10
+ const certbot = require ( './lib/certbot' ) ;
11
11
/**
12
12
* Creates a default admin users if one doesn't already exist in the database
13
13
*
@@ -116,10 +116,7 @@ const setupCertbotPlugins = () => {
116
116
117
117
certificates . map ( function ( certificate ) {
118
118
if ( certificate . meta && certificate . meta . dns_challenge === true ) {
119
- const dns_plugin = dns_plugins [ certificate . meta . dns_provider ] ;
120
-
121
- const packages_to_install = `${ dns_plugin . package_name } ${ dns_plugin . version_requirement || '' } ${ dns_plugin . dependencies } ` ;
122
- if ( plugins . indexOf ( packages_to_install ) === - 1 ) plugins . push ( packages_to_install ) ;
119
+ plugins . push ( certificate . meta . dns_provider ) ;
123
120
124
121
// Make sure credentials file exists
125
122
const credentials_loc = '/etc/letsencrypt/credentials/credentials-' + certificate . id ;
@@ -130,17 +127,15 @@ const setupCertbotPlugins = () => {
130
127
}
131
128
} ) ;
132
129
133
- if ( plugins . length ) {
134
- const install_cmd = '. /opt/certbot/bin/activate && pip install --no-cache-dir ' + plugins . join ( ' ' ) + ' && deactivate' ;
135
- promises . push ( utils . exec ( install_cmd ) ) ;
136
- }
137
-
138
- if ( promises . length ) {
139
- return Promise . all ( promises )
140
- . then ( ( ) => {
141
- logger . info ( 'Added Certbot plugins ' + plugins . join ( ', ' ) ) ;
142
- } ) ;
143
- }
130
+ return certbot . installPlugins ( plugins )
131
+ . then ( ( ) => {
132
+ if ( promises . length ) {
133
+ return Promise . all ( promises )
134
+ . then ( ( ) => {
135
+ logger . info ( 'Added Certbot plugins ' + plugins . join ( ', ' ) ) ;
136
+ } ) ;
137
+ }
138
+ } ) ;
144
139
}
145
140
} ) ;
146
141
} ;
0 commit comments