v0.6.3: support wildname in search

This commit is contained in:
AJ ONeal 2019-10-29 07:24:55 +00:00
parent c9eb5aef36
commit 0c88e09d7d
3 changed files with 25 additions and 13 deletions

View File

@ -180,30 +180,42 @@ Manage.create = function(opts) {
//args.issuedBefore = Date.now() - 30 * 24 * 60 * 60 * 1000;
// i.e. find certs more that will expire in less than 45 days
//args.expiresBefore = Date.now() + 45 * 24 * 60 * 60 * 1000;
var issuedBefore = args.issuedBefore || 0;
var issuedBefore = args.issuedBefore || Infinity;
var expiresBefore = args.expiresBefore || Infinity; //Date.now() + 21 * 24 * 60 * 60 * 1000;
var altnames = (args.altnames || args.domains || []).slice(0);
if (args.servername && !altnames.includes(args.servername)) {
altnames.push(args.servername);
}
if (args.subject && !altnames.includes(args.subject)) {
altnames.push(args.subject);
if (args.wildname && !altnames.includes(args.wildname)) {
altnames.push(args.wildname);
}
// TODO match ANY domain on any cert
var sites = Object.keys(config.sites || {})
.filter(function(sub) {
var site = config.sites[sub];
if (
!site.deletedAt ||
site.expiresAt < expiresBefore ||
site.issuedAt < issuedBefore
) {
return (site.altnames || []).some(function(name) {
return altnames.includes(name);
});
if (site.deletedAt) {
return false;
}
if (site.expiresAt >= expiresBefore) {
return false;
}
if (site.issuedAt >= issuedBefore) {
return false;
}
// if subject is specified, don't return anything else
if (args.subject) {
if (site.subject === args.subject) {
return true;
}
}
// altnames, servername, and wildname all get rolled into one
return (site.altnames || []).some(function(name) {
return altnames.includes(name);
});
})
.map(function(name) {
var site = config.sites[name];

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "greenlock-manager-fs",
"version": "0.6.2",
"version": "0.6.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "greenlock-manager-fs",
"version": "0.6.2",
"version": "0.6.3",
"description": "A simple file-based management strategy for Greenlock",
"main": "manager.js",
"scripts": {