Public Access
SSL Cert Fixes
This commit is contained in:
@@ -121,6 +121,25 @@ function startRedirectServer() {
|
||||
|
||||
http
|
||||
.createServer((req, res) => {
|
||||
// DER for Apple tooling, PEM for everything else.
|
||||
if (req.url === '/ca.cer' || req.url === '/ca.der') {
|
||||
try {
|
||||
const der = tls.caCertificateDer();
|
||||
if (!der) {
|
||||
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
||||
return res.end('No certificate authority has been generated yet.');
|
||||
}
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'application/pkix-cert',
|
||||
'Content-Disposition': 'attachment; filename="visitor-signin-ca.cer"',
|
||||
});
|
||||
return res.end(der);
|
||||
} catch (err) {
|
||||
res.writeHead(500, { 'Content-Type': 'text/plain' });
|
||||
return res.end(`Could not convert the certificate: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (req.url === '/ca.crt' || req.url === '/ca.pem') {
|
||||
const ca = tls.caCertificate();
|
||||
if (!ca) {
|
||||
|
||||
Reference in New Issue
Block a user