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

Relax restriction on [admins] in dev local.ini #4893

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

jaydoane
Copy link
Contributor

@jaydoane jaydoane commented Dec 2, 2023

Overview

Currently, dev/run only starts CouchDB if the [admins] section is last in local.ini. Otherwise, it will fail, and log this message:

[info] 2023-12-02T21:50:40.510174Z [email protected] <0.262.0> --------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  No Admin Account Found, aborting startup.
  Please configure an admin account in your local.ini file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

looking at the local.ini in question, we see:

[admins]
;admin = mysecretpassword
[foo]
bar = baz

adm = -pbkdf2:sha256-8b982d3bfcf15ded130fcfe721c34fe77cda990850d6ec42fb056fe4478c79a9,01d8d790d7fd4526bf342a90f706168f,10

where the admin user has been appended to the end of the file instead of in the [admins] section.

This relaxes that restriction by inserting the admin user just after the [admin] section line, rather than at the end of the file.

Testing recommendations

echo -e '[foo]\nbar = baz\n' >> rel/overlay/etc/local.ini
dev/run -a adm:pass 

should actually start, and e.g. tail -20 dev/lib/node1/etc/local.ini should contain something like

[admins]
adm = -pbkdf2:sha256-058897f910d5b0385621c8004ef340f570643d89fd7c9caf43823c917ad6112f,a97a639b0edb2842a7b9f907763c1b0b,50000
;admin = mysecretpassword
[foo]
bar = baz

Related Issues or Pull Requests

Checklist

  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • Documentation changes were made in the src/docs folder
  • Documentation changes were backported (separated PR) to affected branches

Currently, `dev/run` relies on the `[admins]` section be last in
`local.ini`, or it will fail to start and log this message:
```
[info] 2023-12-02T21:50:40.510174Z [email protected] <0.262.0> --------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  No Admin Account Found, aborting startup.
  Please configure an admin account in your local.ini file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
```

This relaxes that restriction by inserting the admin user just after
the `[admin]` section line, rather than at the end of the file.
Copy link
Contributor

@nickva nickva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Python has a built-in ini parser at some time in the future we could probably use that instead of the hack_ini_local thing we have there.

@jaydoane
Copy link
Contributor Author

jaydoane commented Dec 4, 2023

+1

Python has a built-in ini parser at some time in the future we could probably use that instead of the hack_ini_local thing we have there.

Oh, nice. An actual parser would be a good idea. Thanks for the suggestion!

@jaydoane jaydoane merged commit 9d0e067 into main Dec 4, 2023
15 checks passed
@jaydoane jaydoane deleted the relax-local-ini-admins-last branch December 4, 2023 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants