Create .conf file with RPC credentials if none exists. #6258

pull Alex-van-der-Peet wants to merge 1 commits into bitcoin:master from Alex-van-der-Peet:CreateConfOnFirstRun changing 1 files +54 −14
  1. Alex-van-der-Peet commented at 2:27 am on June 9, 2015: contributor

    I’ve attempted to implement issue #3902 as described in its discussion. Description:

    If no username and password are provided through the conf file or command line and no conf file exists, one will be created and preconfigured with the username and password recommended in the original console message. The generated username and password will be set in memory too, so the RPC server is immediately accessible with these details.

    If a conf file does exists but does not contain a username and password, the old error will show, as I felt it too forward to start modifying a user’s existing conf file without their consent.

    First attempt to contribute, please don’t bite my head off.

  2. Attempted implementation of issue #3902 4cf53d0f1e
  3. jonasschnelli commented at 11:55 am on June 9, 2015: contributor

    @Alex-van-der-Peet: your contribution are very welcome! Thanks.

    This PR would make things more convenient, but, i have a strong feeling that the bitcoin.conf file should stay readonly. I think apps like bitcoin-core (critical security requirements) should not create config files automatically.

  4. laanwj commented at 12:09 pm on June 9, 2015: member

    @gmaxwell and I had an interesting conversation about this once. The idea would be not to generate a bitcoin.conf - there are good reasons to keep config files read-only - but a special ‘cookie’ file for authentication. This file is generated with random content when the daemon starts. Read access to this file stored in the data directory controls who can access through RPC. This method would be active by default if no rpcpassword and rpcuser is specified.

    This is similar to Tor’s CookieAuthentication: see https://www.torproject.org/docs/tor-manual.html.en

  5. laanwj added the label RPC on Jun 9, 2015
  6. paveljanik commented at 1:30 pm on June 9, 2015: contributor

    I think that we should only create the file when there is no such file. We should not change the file if it doesn’t contain rpcuser and password at all.

    So NACK as it is right now.

  7. Alex-van-der-Peet commented at 1:35 pm on June 9, 2015: contributor

    @paveljanik Eh? That is how it is implented though. No file -> create file, file -> do nothing.

    Also, I might be having a moment of stupidity, but a read-only config file? How would that work exactly?

    I checked the access rights of the created file in Ubuntu, I think they’re correct.

  8. paveljanik commented at 1:38 pm on June 9, 2015: contributor
    @Alex-van-der-Peet ups, sorry. I have reread again and yes, this is how it is implemented. utACK
  9. luke-jr commented at 0:09 am on June 15, 2015: member
    Commit description also needs to be fixed to actually describe the change being made.
  10. Alex-van-der-Peet renamed this:
    Attempted implementation of issue #3902
    Create .conf file with RPC credentials if none exists.
    on Jun 15, 2015
  11. sipa commented at 11:15 am on June 15, 2015: member
    @laanwj I like that cookie idea!
  12. laanwj commented at 8:46 pm on July 6, 2015: member
    I’ll have a stab at implementing the cookie authentication.
  13. laanwj referenced this in commit 9477cad895 on Jul 7, 2015
  14. laanwj commented at 1:07 pm on July 7, 2015: member
    See #6388
  15. sipa commented at 1:56 pm on July 9, 2015: member
    I prefer #6388’s approach.
  16. laanwj referenced this in commit 71cbeaad9a on Jul 13, 2015
  17. laanwj commented at 11:23 am on July 13, 2015: member
    Closing in favor of #6388
  18. laanwj closed this on Jul 13, 2015

  19. luke-jr referenced this in commit 2452206ceb on Oct 15, 2015
  20. luke-jr referenced this in commit 2bd82db425 on Dec 2, 2015
  21. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-04 19:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me