|
1 | | -const _ = require('lodash'); |
2 | | -const fs = require('fs'); |
3 | | -const https = require('https'); |
4 | | -const tempWrite = require('temp-write'); |
5 | | -const moment = require('moment'); |
6 | | -const logger = require('../logger').ssl; |
7 | | -const error = require('../lib/error'); |
8 | | -const utils = require('../lib/utils'); |
9 | | -const certificateModel = require('../models/certificate'); |
10 | | -const dnsPlugins = require('../global/certbot-dns-plugins'); |
11 | | -const internalAuditLog = require('./audit-log'); |
12 | | -const internalNginx = require('./nginx'); |
13 | | -const internalHost = require('./host'); |
14 | | -const letsencryptStaging = process.env.NODE_ENV !== 'production'; |
| 1 | +const _ = require('lodash'); |
| 2 | +const fs = require('fs'); |
| 3 | +const https = require('https'); |
| 4 | +const tempWrite = require('temp-write'); |
| 5 | +const moment = require('moment'); |
| 6 | +const logger = require('../logger').ssl; |
| 7 | +const config = require('../lib/config'); |
| 8 | +const error = require('../lib/error'); |
| 9 | +const utils = require('../lib/utils'); |
| 10 | +const certificateModel = require('../models/certificate'); |
| 11 | +const dnsPlugins = require('../global/certbot-dns-plugins'); |
| 12 | +const internalAuditLog = require('./audit-log'); |
| 13 | +const internalNginx = require('./nginx'); |
| 14 | +const internalHost = require('./host'); |
| 15 | +const archiver = require('archiver'); |
| 16 | +const path = require('path'); |
| 17 | +const { isArray } = require('lodash'); |
| 18 | + |
| 19 | +const letsencryptStaging = config.useLetsencryptStaging(); |
15 | 20 | const letsencryptConfig = '/etc/letsencrypt.ini'; |
16 | 21 | const certbotCommand = 'certbot'; |
17 | | -const archiver = require('archiver'); |
18 | | -const path = require('path'); |
19 | | -const { isArray } = require('lodash'); |
20 | 22 |
|
21 | 23 | function omissions() { |
22 | 24 | return ['is_deleted']; |
@@ -46,6 +48,8 @@ const internalCertificate = { |
46 | 48 |
|
47 | 49 | const cmd = certbotCommand + ' renew --non-interactive --quiet ' + |
48 | 50 | '--config "' + letsencryptConfig + '" ' + |
| 51 | + '--work-dir "/tmp/letsencrypt-lib" ' + |
| 52 | + '--logs-dir "/tmp/letsencrypt-log" ' + |
49 | 53 | '--preferred-challenges "dns,http" ' + |
50 | 54 | '--disable-hook-validation ' + |
51 | 55 | (letsencryptStaging ? '--staging' : ''); |
@@ -833,6 +837,8 @@ const internalCertificate = { |
833 | 837 |
|
834 | 838 | const cmd = certbotCommand + ' certonly ' + |
835 | 839 | '--config "' + letsencryptConfig + '" ' + |
| 840 | + '--work-dir "/tmp/letsencrypt-lib" ' + |
| 841 | + '--logs-dir "/tmp/letsencrypt-log" ' + |
836 | 842 | '--cert-name "npm-' + certificate.id + '" ' + |
837 | 843 | '--agree-tos ' + |
838 | 844 | '--authenticator webroot ' + |
@@ -871,13 +877,15 @@ const internalCertificate = { |
871 | 877 | const escapedCredentials = certificate.meta.dns_provider_credentials.replaceAll('\'', '\\\'').replaceAll('\\', '\\\\'); |
872 | 878 | const credentialsCmd = 'mkdir -p /etc/letsencrypt/credentials 2> /dev/null; echo \'' + escapedCredentials + '\' > \'' + credentialsLocation + '\' && chmod 600 \'' + credentialsLocation + '\''; |
873 | 879 | // we call `. /opt/certbot/bin/activate` (`.` is alternative to `source` in dash) to access certbot venv |
874 | | - let prepareCmd = '. /opt/certbot/bin/activate && pip install ' + dns_plugin.package_name + (dns_plugin.version_requirement || '') + ' ' + dns_plugin.dependencies + ' && deactivate'; |
| 880 | + const prepareCmd = '. /opt/certbot/bin/activate && pip install --no-cache-dir --user ' + dns_plugin.package_name + (dns_plugin.version_requirement || '') + ' ' + dns_plugin.dependencies + ' && deactivate'; |
875 | 881 |
|
876 | 882 | // Whether the plugin has a --<name>-credentials argument |
877 | 883 | const hasConfigArg = certificate.meta.dns_provider !== 'route53'; |
878 | 884 |
|
879 | 885 | let mainCmd = certbotCommand + ' certonly ' + |
880 | 886 | '--config "' + letsencryptConfig + '" ' + |
| 887 | + '--work-dir "/tmp/letsencrypt-lib" ' + |
| 888 | + '--logs-dir "/tmp/letsencrypt-log" ' + |
881 | 889 | '--cert-name "npm-' + certificate.id + '" ' + |
882 | 890 | '--agree-tos ' + |
883 | 891 | '--email "' + certificate.meta.letsencrypt_email + '" ' + |
@@ -974,6 +982,8 @@ const internalCertificate = { |
974 | 982 |
|
975 | 983 | const cmd = certbotCommand + ' renew --force-renewal ' + |
976 | 984 | '--config "' + letsencryptConfig + '" ' + |
| 985 | + '--work-dir "/tmp/letsencrypt-lib" ' + |
| 986 | + '--logs-dir "/tmp/letsencrypt-log" ' + |
977 | 987 | '--cert-name "npm-' + certificate.id + '" ' + |
978 | 988 | '--preferred-challenges "dns,http" ' + |
979 | 989 | '--no-random-sleep-on-renew ' + |
@@ -1004,6 +1014,8 @@ const internalCertificate = { |
1004 | 1014 |
|
1005 | 1015 | let mainCmd = certbotCommand + ' renew ' + |
1006 | 1016 | '--config "' + letsencryptConfig + '" ' + |
| 1017 | + '--work-dir "/tmp/letsencrypt-lib" ' + |
| 1018 | + '--logs-dir "/tmp/letsencrypt-log" ' + |
1007 | 1019 | '--cert-name "npm-' + certificate.id + '" ' + |
1008 | 1020 | '--disable-hook-validation ' + |
1009 | 1021 | '--no-random-sleep-on-renew ' + |
|
0 commit comments