From 5c8d06e8b6abd91695b7363a7d358dbe5850e3a3 Mon Sep 17 00:00:00 2001 From: Mayank Chhabra Date: Mon, 28 Sep 2020 15:38:03 +0530 Subject: [PATCH] Expose LND RPC/REST for lndconnect (#237) --- docker-compose.yml | 8 ++++++++ scripts/configure | 4 ++++ scripts/start | 1 + templates/lnd-sample.conf | 1 + templates/torrc-sample | 8 ++++++++ 5 files changed, 22 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 666c304..ef7c894 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -60,6 +60,8 @@ services: stop_grace_period: 5m30s ports: - "9735:9735" + - "8080:8080" + - "10009:10009" networks: net: ipv4_address: 10.11.1.2 @@ -84,6 +86,7 @@ services: - ${PWD}/info.json:/info.json - ${PWD}/db:/db - ${PWD}/events/signals:/signals + - ${PWD}/lnd:/lnd:ro - ${PWD}/statuses:/statuses - ${PWD}/tor/data:/var/lib/tor/ - /var/run/docker.sock:/var/run/docker.sock @@ -98,11 +101,16 @@ services: JWT_EXPIRATION: "3600" DOCKER_COMPOSE_DIRECTORY: $PWD DEVICE_HOSTS: ${DEVICE_HOSTS:-"http://umbrel.local"} + DEVICE_HOSTNAME: ${DEVICE_HOSTNAME:-""} MIDDLEWARE_API_URL: "http://10.11.2.2" UMBREL_SEED_FILE: "/db/umbrel-seed/seed" UMBREL_DASHBOARD_HIDDEN_SERVICE_FILE: "/var/lib/tor/web/hostname" BITCOIN_P2P_HIDDEN_SERVICE_FILE: "/var/lib/tor/bitcoin-p2p/hostname" BITCOIN_P2P_PORT: $BITCOIN_P2P_PORT + LND_REST_HIDDEN_SERVICE_FILE: "/var/lib/tor/lnd-rest/hostname" + LND_GRPC_HIDDEN_SERVICE_FILE: "/var/lib/tor/lnd-grpc/hostname" + LND_CERT_FILE: "/lnd/tls.cert" + LND_ADMIN_MACAROON_FILE: "/lnd/data/chain/bitcoin/${BITCOIN_NETWORK}/admin.macaroon" SHUTDOWN_SIGNAL_FILE: "/signals/shutdown" REBOOT_SIGNAL_FILE: "/signals/reboot" GITHUB_REPO: "getumbrel/umbrel" diff --git a/scripts/configure b/scripts/configure index e189970..e33fd35 100755 --- a/scripts/configure +++ b/scripts/configure @@ -163,6 +163,10 @@ sed -i "s/tor.password=/tor.password=$TOR_PASS/g;" "$LND_CONF_FILE" sed -i "s/TOR_PASSWORD=/TOR_PASSWORD=$TOR_PASS/g;" "$ENV_FILE" sed -i "s/TOR_HASHED_PASSWORD=/TOR_HASHED_PASSWORD=$TOR_HASHED_PASS/g;" "$ENV_FILE" +# Add hostname to lnd.conf for TLS certificate +DEVICE_HOSTNAME="$(hostname)" +sed -i "s/tlsextradomain=/tlsextradomain=$DEVICE_HOSTNAME.local/g;" "$LND_CONF_FILE" + # If node is already synced, do not reset to neutrino if [[ -f "${STATUS_DIR}/node-status-bitcoind-ready" ]]; then sed -i "s/bitcoin.node=.*/bitcoin.node=bitcoind/g;" "$LND_CONF_FILE" diff --git a/scripts/start b/scripts/start index b5fa25d..290643c 100755 --- a/scripts/start +++ b/scripts/start @@ -59,6 +59,7 @@ if [[ -f "${UMBREL_ROOT}/tor/data/web/hostname" ]]; then DEVICE_HOSTS="${DEVICE_HOSTS},http://${hidden_service_url}" fi export DEVICE_HOSTS=$DEVICE_HOSTS +export DEVICE_HOSTNAME="${DEVICE_HOSTNAME}.local" # Increase default Docker and Compose timeouts to 240s # as bitcoin can take a long while to respond diff --git a/templates/lnd-sample.conf b/templates/lnd-sample.conf index 9597c6a..113c126 100644 --- a/templates/lnd-sample.conf +++ b/templates/lnd-sample.conf @@ -6,6 +6,7 @@ maxpendingchannels=3 minchansize=10000 accept-keysend=true tlsextraip=10.11.1.2 +tlsextradomain= tlsautorefresh=1 [Bitcoind] diff --git a/templates/torrc-sample b/templates/torrc-sample index 57744fd..63186e2 100644 --- a/templates/torrc-sample +++ b/templates/torrc-sample @@ -10,4 +10,12 @@ HiddenServicePort 80 10.11.0.2:80 HiddenServiceDir /var/lib/tor/bitcoin-p2p HiddenServicePort 10.11.1.1: +# LND REST Hidden Service +HiddenServiceDir /var/lib/tor/lnd-rest +HiddenServicePort 8080 10.11.1.2:8080 + +# LND gRPC Hidden Service +HiddenServiceDir /var/lib/tor/lnd-grpc +HiddenServicePort 10009 10.11.1.2:10009 + HashedControlPassword