Skip to content
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

hsm_secret encryption #3129

Merged
merged 8 commits into from
Oct 10, 2019
Merged

Commits on Oct 10, 2019

  1. daemons: initialize libsodium at setup

    According to the doc (https://download.libsodium.org/doc):
    "sodium_init() initializes the library and should be called before
    any other function provided by Sodium. [...]
    the function ensures that the system's random number generator has
    been properly seeded.".
    darosior authored and rustyrussell committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    c0e3a74 View commit details
    Browse the repository at this point in the history
  2. lightningd: '--encrypted-hsm', a new startup option

    Add a new startup option which will, if set, prompt the user for a
    password to derive a key from. This key will later be used to encrypt
    and/or decrypt `hsm_secret`.
    
    This was made a noarg option even if it would have been preferable to
    let the user the choice of how to specify the password. Since we have
    to chose, better to not let the password in the commands history.
    darosior authored and rustyrussell committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    28e00e3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6e51ef4 View commit details
    Browse the repository at this point in the history
  4. hsmd: encrypt hsm_secret if 'lightningd' pass an encryption key

    This splits maybe_create_hsm_secret() in two parts (either encrypted
    or in clear) for clarity, and adds an encryption detection in load_hsm().
    There are actually three cases if an encryption key is passed:
    - There is no hsm_secret => just create it and store the encrypted seed
    - There is an encrypted hsm_secret => the provided key should be able to
    decrypt the seed, if the wrong key is passed libsodium will nicely error
    and hsmd will exit() to not throw a backtrace (using status_failed() as for
    other errors) at the face of an user who mistyped its password.
    - There is a non-encrypted hsm_secret => load the seed, delete the
    hsm_secret, create the hsm_secret, store the encrypted seed.
    darosior authored and rustyrussell committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    7a45061 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5cbf091 View commit details
    Browse the repository at this point in the history
  6. pytest: allow to set stdin, stdout and stderr at lightningd startup

    And also allow to not wait for it to be started.
    Passing stderr=subprocess.STDOUT can be useful to wait_for_log() also on
    stderr messages.
    darosior authored and rustyrussell committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    8d04ba1 View commit details
    Browse the repository at this point in the history
  7. pytest: test hsm_secret encryption

    darosior authored and rustyrussell committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    9c576cb View commit details
    Browse the repository at this point in the history
  8. Document hsm_secret encryption

    darosior authored and rustyrussell committed Oct 10, 2019
    Configuration menu
    Copy the full SHA
    e1af450 View commit details
    Browse the repository at this point in the history