mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
Use the letsencrypt renewal process
This commit is contained in:
parent
91c2281237
commit
61820840e0
@ -39,11 +39,14 @@ const internalSsl = {
|
|||||||
// This host is due to expire in 1 day, time to renew
|
// This host is due to expire in 1 day, time to renew
|
||||||
logger.info('Host ' + host.hostname + ' is due for SSL renewal');
|
logger.info('Host ' + host.hostname + ' is due for SSL renewal');
|
||||||
|
|
||||||
internalSsl.configureSsl(host)
|
internalSsl.renewSsl(host)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return internalNginx.generateConfig(host);
|
// Certificate was requested ok, update the timestamp on the host
|
||||||
|
db.hosts.update({_id: host._id}, {ssl_expires: timestamp.now('+90d')}, {
|
||||||
|
multi: false,
|
||||||
|
upsert: false
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.then(internalNginx.reload)
|
|
||||||
.then(next)
|
.then(next)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
@ -88,6 +91,20 @@ const internalSsl = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object} host
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
renewSsl: host => {
|
||||||
|
logger.info('Renewing SSL certificates for ' + host.hostname);
|
||||||
|
|
||||||
|
return utils.exec('/usr/bin/letsencrypt renew --force-renewal --disable-hook-validation --cert-name "' + host.hostname + '"')
|
||||||
|
.then(result => {
|
||||||
|
logger.info(result);
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} host
|
* @param {Object} host
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
|
Loading…
Reference in New Issue
Block a user