diff --git a/test/config/tls/example.com/*.example.com.key b/test/config/tls/example.com/_.example.com.key similarity index 100% rename from test/config/tls/example.com/*.example.com.key rename to test/config/tls/example.com/_.example.com.key diff --git a/tls_socket.js b/tls_socket.js index f167c3996..30df76ac4 100644 --- a/tls_socket.js +++ b/tls_socket.js @@ -181,7 +181,7 @@ exports.parse_x509 = async (string) => { res.expire = new Date(raw.match(/notAfter=(.* [A-Z]{3})/)[1]) - const match = /CN\s*=\s*([^\s,]+)/.exec(raw); + const match = /CN\s*=\s*([^/\s,]+)/.exec(raw); if (match && match[1]) res.names = [ match[1] ] for (let name of Array.from(raw.matchAll(/DNS:([^\s,]+)/gm), (m) => m[0])) { @@ -416,7 +416,8 @@ exports.get_certs_dir = async (tlsDir) => { // a file with a key and no cert, get name from file if (!r[fp].names) r[fp].names = [ path.parse(fp).name ] - for (const name of r[fp].names) { + for (let name of r[fp].names) { + if (name[0] === '_') name = name.replace('_', '*') // windows if (s[name] === undefined) s[name] = {} if (!s[name].key && r[fp].keys) s[name].key = r[fp].keys[0] if (!s[name].cert && r[fp].chain) {