Auto-unlock LND wallet/node

The latest release added a new config option for auto-unlocking the
wallet/node using a password file. This changeset adds support for just
that to the lnd recipe, so that nobody has to manually unlock it after
reboots or service restarts.
This commit is contained in:
Basti 2021-06-30 17:09:31 +02:00
parent a65065c793
commit 2ca576468e
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72
3 changed files with 17 additions and 2 deletions

View File

@ -45,8 +45,9 @@ node.default['lnd']['public_ip'] = '148.251.237.111'
node.default['lnd']['public_port'] = '9735'
node.default['lnd']['port'] = '9736'
node.default['lnd']['minchansize'] = '1000000'
node.default['lnd']['basefee'] = '500'
node.default['lnd']['feerate'] = '1'
node.default['lnd']['basefee'] = '1000'
node.default['lnd']['feerate'] = '50'
node.default['lnd']['auto_unlock'] = true # requires credentials/lnd data bag item
node.default['rtl']['repo'] = 'https://github.com/Ride-The-Lightning/RTL.git'
node.default['rtl']['revision'] = 'v0.11.0'

View File

@ -36,6 +36,17 @@ directory lnd_dir do
action :create
end
if node['lnd']['auto_unlock']
lnd_credentials = Chef::EncryptedDataBagItem.load('credentials', 'lnd')
file "#{lnd_dir}/.unlock.txt" do
content lnd_credentials['password']
mode '0600'
owner bitcoin_user
group bitcoin_group
end
end
template "#{lnd_dir}/lnd.conf" do
source "lnd.conf.erb"
owner bitcoin_user
@ -49,6 +60,8 @@ template "#{lnd_dir}/lnd.conf" do
lnd_minchansize: node['lnd']['minchansize'],
lnd_basefee: node['lnd']['basefee'],
lnd_feerate: node['lnd']['feerate'],
lnd_dir: lnd_dir,
auto_unlock: node['lnd']['auto_unlock'],
bitcoin_datadir: node['bitcoin']['datadir'],
bitcoin_rpc_user: node['bitcoin']['conf']['rpcuser'],
bitcoin_rpc_password: bitcoin_credentials["rpcpassword"],

View File

@ -6,6 +6,7 @@ alias=<%= @lnd_alias %>
color=<%= @lnd_color %>
maxpendingchannels=2
minchansize=<%= @lnd_minchansize %>
<% if @auto_unlock %>wallet-unlock-password-file=<%= @lnd_dir %>/.unlock.txt<% end %>
[autopilot]
autopilot.active=0