Skip to content

Commit

Permalink
workaround for windows * restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed May 3, 2024
1 parent 78686e0 commit 35e590f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tls_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 35e590f

Please sign in to comment.