-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wallet password should be optional #899
Comments
If you don't want to use the wallet password, there's the As you note, it depends on your threat model though. If the attacker doesn't have the power to backdoor their running |
if you use |
That's correct. |
@Roasbeef But why would I have the database on a Dropbox account? Lightning doesn't really do backups at this point. Equally, even in a normal wallet, I'd just use GPG for that encryption. |
here's a workaround: https://github.com/Stadicus/RaspiBolt/blob/master/raspibolt_6A_auto-unlock.md |
How to automate the current unlock with the rest api without relying on timing? The unlockwallet endpoint seems to return many things in success cases such as |
just in case this helps anyone, this expect script and systemd unit file I believe are at least a reliable way to automate it even without an optional password. For example on a raspberry pi of mine: /home/pi/lnd/lnd_expect.sh
/etc/systemd/system/lnd.service
|
Peter is right, anyone sensible running something like LND on a server would want this setup:
Encryption enforced in LND is not only annoyance, but goes directly against "restart if it crashes" requirement. If an attacker can break isolation, he can read memory of LND, or kill LND and spawn a proces in its place pretending to be LND in order to sniff the password. (It can read TLS private key and the key must stay readable.) Would you be willing to marge a PR providing an option to disable encryption based on these arguments? The unlock scripts complicate the system needlessly and increase attack surface. |
If anyone is not convinced yet, I may have found the ultimate argument for this: admin macaroon is stored in the same directory. It's astronomically unlikely that the macaroon will be better protected than the wallet file. Funnily enough, attacking admin macaroon might be even preferable to an attacker as he can trivially use it to send transactions, without any file copying or other complicated setups. |
This change adds a script and packages for automatically unlocking LND. The way it works is it generates the seed and stores it in a file, which is then used to init the wallet with a fixed password and unlock it later. This does NOT decrease the security because if an attacker gains access to the seed file or private data he can also gain the access to the macaroon file, which LND doesn't protect. The whole design of LND password is mostly counterproductive as discussed in lightningnetwork/lnd#899 The unlocker uses `wget` instead of `lncli` because `lncli` doesn't allow non-interactive initialization of the wallet. This forcces us to use other tool (``wget`), which is used for unlocking too, for consistency. This is currently implemented for mainnet only. Regtest will come soon.
Came here to voice my agreement. Here's a scenario: The folks at myNode do a nice job with an automated unlocker script. To make it easy, they automatically generate the password and save it in another folder. What security does this provide if we save our passwords in the clear for our unlocker scripts? They fail to mention that the password is different from the main myNode login password. User (me) attempts to transfer the .lnd folder, moving the node to a new machine. Forgets/doesn't know the wallet.db password is elsewhere. User wipes SSD, because 1TB SSDs aren't cheap and I don't exactly have a bunch of extra ones lying around. Now have no password, OhNo.gif, must resort to recoverchanbackup and SCB. This is a foot gun. --noencryptwallet should be a first class flag. |
@realspencerdupre great point, sometimes too much "security" can cause loss. Forgetting being more probable than theft is considered common knowledge by all Bitcoin security experts I know. Why shouldn't it apply here? |
I don't necessarily disagree with the point that the wallet password should be optional.
To make a long story short: Yes, we might want to allow not needing to set a password. But first we need to refactor quite some code to disentangle the two effects of |
@guggero AFAIK everyone in this thread is aware of current working of I am very happy that you're willing to accept such change. Maybe I will be able to find some time to help with it but I'm currently very busy. |
I'd like to move this forward, so here's a proposal to resolve it: The main goal is to get rid of the unreliability of automatic unlocking via unlocker scripts. The unlocking mechanism must allow consumers to get a seed or set their own It'd also be great to make migration from existing unlocker scripts easy. The mechanism must not introduce unreliability or block consumers from writing their scripts reliably. That means if the consumer wants to make the operation safe even in presence of power failure at any instruction, the API must make this possible.
If this is accepted I will codify these requirements as tests written in bash. I will also provide an example of safe, reliable init/unlock script with comments explaining all relevant details. Rationale
|
This makes sense
But for the rest, I don't see the need for initializing/generating a wallet automatically. Sounds scary. |
@realspencerdupre it's required for the whole process to be secure and reliable. Unless you intend all Thus I wrote it based on my experience and what would help me the most. If others have different experience I'll be happy to cooperate and figure out the most optimal approach for everyone. Edit: forgot to mention my proposal also completely removes security risk when initializing the wallet. |
Thank you for your comments and proposal, @Kixunil! There are a lot of very valid points in there. And I agree that we should take this seriously and improve the situation, especially if there is a security issue that can be patched (I wasn't aware of that). My main concern here is UX and backward compatibility. Because we took too long to even allow reading the unlock password from That's why I'm adding my own counter proposal here. I'm interested in hearing what you think and if you see any potential security flaws with it. Let's split the issue into the two parts they are:
I'm aware that this proposal does not not satisfy the last two items of your rationale. The question is: how important are these two points to your use case? |
Right, in case it wasn't clear, I didn't want to propose implicitly nor explicitly to remove current init and unlock calls. At least not initially. People should have enough time to migrate. Recommending migration in release notes would be great though.
Sure, if we can do it without compromising on other important values, that's great.
Sounds good! I'm assuming this binary operates on the data directly - it doesn't use RPC, am I correct?
Interestingly I heard claims that env vars are not safe for storing secrets but I couldn't find an actual exploit yet. I prefer to stay away from them. Maybe it'd be better to have
I'm not sure what problem does it solve, can you clarify?
Do you propose The last point is very important to me. I went great lengths to ensure reliability of my project. It'd be quite sad to see a hole in my effort caused by upstream software that's supposed to be security-critical. Not having to install I also forgot to mention that I have a plugable system that makes auto-unlocking opt-out. I'm 100% sure that there's at least one instance in the wild that opted out and at least one that didn't, so I'm also trying to avoid breaking any of those. So far nothing proposed here seems to conflict with this but I mention it just in case. |
Correct, it would create the wallet DB file directly (nothing else,
Maybe that's something more common in Docker/Kubernetes environments where you don't want hard coded secrets in files (because that's harder to setup/maintain in a "stateless" environment) or command line flags (because they could be visible even to non-privileged cluster users), so secrets injected in environment variables are quite common.
Just to turn Cool, I feel like we have a possible way here that could cover all use cases of this thread while remaining fully backward compatible. And to be honest, this would also make our cluster setup way easier. We definitely also started feeling the pain of this. |
I'm not sure about argument, it's quite a big footgun. I contributed to I will leave the decision to you just please document the footgun if you decide to allow argument.
Yeah, I think the presence of password option should do it automatically.
I agree, I will try to write a test script so the implementors can use it to check the implementation. |
Whoa, great speed! I started writing the example script and test script but didn't finish. I guess I will publish the draft and then improve it. |
Personally I would love it if there was a single flag added to While I hear this argument @guggero :
Perhaps just this single flag (rather than a set of interdependent flags) might be ok? I don't like the idea of having different behavior required to init or unlock the wallet, and I think it might be nice to compress these into a single flag. In the past I wrote a script that did this and it worked nicely for my Lnd deployment. Perhaps I'm missing something though :) |
That sounds very dangerous. Wouldn't that mean that you never even see your seed? If your |
Good point about the seed, I think that's what I was missing - thanks! Just also took a look at your PR #5150 and left a question there. Re: the script, if It remember, I think I manually backed up the mnemonic after writing it to the disk... not great haha |
Please do me a favor and check whether that is the case asap! If you don't have the seed there's still a way to extract the |
@guggero the node that used that script was swept and inactivated almost two years ago :) |
Thinking of closing this as we have the wallet file option, and also |
Thinking of closing this as we have the wallet file option, and also `lndinit` that will fully automated the creation and storage of the password itself.
I do not agree. There are lots of security postures where the password is
totally pointless. Personally I set mine to abcdefgh on every lnd wallet I
have. I'm far more likely to lose funds from it being inconvenient to
auto-restart lnd on reboot - followed by exploitation by a peer - than I am
having my backups be compromised.
|
@petertodd there is wallet-pasword-unlock-file now so the problems associated with mandatory password are solved except for minor annoyance. |
...and using that ends up in pretty the same situation as a passwordless wallet file. But more convoluted and with a risk that the password will be lost.
Not to mention, calling this a "password" is misleading anyway. Since the threat model is offline decryption, we actually need something with significantly more entropy than what would normally be considered a password to resist cracking efforts.
On August 20, 2022 10:02:43 AM GMT+03:00, "Martin Habovštiak" ***@***.***> wrote:
***@***.*** there is [wallet-pasword-unlock-file](https://github.com/lightningnetwork/lnd/blob/a58553d1bd239f0ba8bf2fe267112b964ee6bc3c/sample-lnd.conf#L259-L264) now so the problems associated with mandatory password are solved except for minor annoyance.
…
--
Reply to this email directly or view it on GitHub:
#899 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
|
If the attacker has a copy of your wallet, in most sane threat models they probably also backdoor lnd to capture the password later anyway, rendering it pointless.
I set mine to 12345678, but really, an empty password should be accepted.
The text was updated successfully, but these errors were encountered: