Skip to content

Commit 6182084

Browse files
committed
Use the letsencrypt renewal process
1 parent 91c2281 commit 6182084

File tree

1 file changed

+20
-3
lines changed
  • manager/src/backend/internal

1 file changed

+20
-3
lines changed

manager/src/backend/internal/ssl.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ const internalSsl = {
3939
// This host is due to expire in 1 day, time to renew
4040
logger.info('Host ' + host.hostname + ' is due for SSL renewal');
4141

42-
internalSsl.configureSsl(host)
42+
internalSsl.renewSsl(host)
4343
.then(() => {
44-
return internalNginx.generateConfig(host);
44+
// Certificate was requested ok, update the timestamp on the host
45+
db.hosts.update({_id: host._id}, {ssl_expires: timestamp.now('+90d')}, {
46+
multi: false,
47+
upsert: false
48+
});
4549
})
46-
.then(internalNginx.reload)
4750
.then(next)
4851
.catch(err => {
4952
logger.error(err);
@@ -88,6 +91,20 @@ const internalSsl = {
8891
});
8992
},
9093

94+
/**
95+
* @param {Object} host
96+
* @returns {Promise}
97+
*/
98+
renewSsl: host => {
99+
logger.info('Renewing SSL certificates for ' + host.hostname);
100+
101+
return utils.exec('/usr/bin/letsencrypt renew --force-renewal --disable-hook-validation --cert-name "' + host.hostname + '"')
102+
.then(result => {
103+
logger.info(result);
104+
return result;
105+
});
106+
},
107+
91108
/**
92109
* @param {Object} host
93110
* @returns {Promise}

0 commit comments

Comments
 (0)