Browse Source

feature(certs): dynamically generate certs based on OS

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
1d23e53a21
  1. 2
      app/main.dev.js
  2. 6
      darwin_generate_certs.sh
  3. 11
      linux_generate_certs.sh
  4. 11
      win32_generate_certs.sh

2
app/main.dev.js

@ -112,7 +112,7 @@ app.on('ready', async () => {
if (!results.length) {
// Run a bash script that checks for the LND folder and generates Node.js compatible certs
console.log('CHECKING/GENERATING CERTS')
exec('sh generate_certs.sh')
exec(`sh ${platform()}_generate_certs.sh`)
// After the certs are generated, it's time to start LND
console.log('STARTING LND')

6
generate_certs.sh → darwin_generate_certs.sh

@ -9,9 +9,3 @@ openssl ecparam -genkey -name prime256v1 -out ~/Library/Application\ Support/Lnd
openssl req -new -sha256 -key ~/Library/Application\ Support/Lnd/tls.key -out ~/Library/Application\ Support/Lnd/csr.csr -subj '/CN=localhost/O=lnd'
openssl req -x509 -sha256 -days 3650 -key ~/Library/Application\ Support/Lnd/tls.key -in ~/Library/Application\ Support/Lnd/csr.csr -out ~/Library/Application\ Support/Lnd/tls.cert
rm ~/Library/Application\ Support/Lnd/csr.csr
# Linux
# openssl ecparam -genkey -name prime256v1 -out ~/.lnd/tls.key
# openssl req -new -sha256 -key ~/.lnd/tls.key -out ~/.lnd/csr.csr -subj '/CN=localhost/O=lnd'
# openssl req -x509 -sha256 -days 3650 -key ~/.lnd/tls.key -in ~/.lnd/csr.csr -out ~/.lnd/tls.cert
# rm ~/.lnd/csr.csr

11
linux_generate_certs.sh

@ -0,0 +1,11 @@
# Generate Node.js compatible certs
# If Lnd folder doesn't exist we have to create it
if [ ! -d ~/Library/Application\ Support/Lnd ]; then
mkdir -p ~/.lnd;
fi
# Generate compatible certs
openssl ecparam -genkey -name prime256v1 -out ~/Library/Application\ Support/Lnd/tls.key
openssl req -new -sha256 -key ~/Library/Application\ Support/Lnd/tls.key -out ~/Library/Application\ Support/Lnd/csr.csr -subj '/CN=localhost/O=lnd'
openssl req -x509 -sha256 -days 3650 -key ~/Library/Application\ Support/Lnd/tls.key -in ~/Library/Application\ Support/Lnd/csr.csr -out ~/Library/Application\ Support/Lnd/tls.cert
rm ~/Library/Application\ Support/Lnd/csr.csr

11
win32_generate_certs.sh

@ -0,0 +1,11 @@
# Generate Node.js compatible certs
# If Lnd folder doesn't exist we have to create it
if [ ! -d ~/Library/Application\ Support/Lnd ]; then
mkdir -p ~/AppData/Local/Lnd;
fi
# Generate compatible certs
openssl ecparam -genkey -name prime256v1 -out ~/Library/Application\ Support/Lnd/tls.key
openssl req -new -sha256 -key ~/Library/Application\ Support/Lnd/tls.key -out ~/Library/Application\ Support/Lnd/csr.csr -subj '/CN=localhost/O=lnd'
openssl req -x509 -sha256 -days 3650 -key ~/Library/Application\ Support/Lnd/tls.key -in ~/Library/Application\ Support/Lnd/csr.csr -out ~/Library/Application\ Support/Lnd/tls.cert
rm ~/Library/Application\ Support/Lnd/csr.csr
Loading…
Cancel
Save