Postinst: do not ask for password if it was already specified#12413
Postinst: do not ask for password if it was already specified#12413alexey-milovidov wants to merge 7 commits intomasterfrom
Conversation
debian/clickhouse-server.postinst
Outdated
| chmod 600 ${CLICKHOUSE_CONFDIR}/users.d/default-password.xml | ||
| fi | ||
| # Ask for password for default user. But only if it was not specified in configuration. | ||
| if [ -z "$($(su -s $SHELL ${CLICKHOUSE_USER} -c "$CLICKHOUSE_BINDIR/$EXTRACT_FROM_CONFIG --config-file=\"$CLICKHOUSE_USERS\" --key=users.default.password" 2>/dev/null; su -s $SHELL ${CLICKHOUSE_USER} -c "$CLICKHOUSE_BINDIR/$EXTRACT_FROM_CONFIG --config-file=\"$CLICKHOUSE_USERS\" --key=users.default.password_sha256_hex" 2>/dev/null) ||: )" ]; then |
There was a problem hiding this comment.
Maybe move this quite long line out of if clause and store both values in a separate variable?
There was a problem hiding this comment.
Ok.
The main concern is that I cannot add a test and have to test it manually just once before merging...
There was a problem hiding this comment.
Also Debian already remembers that the password was specified.
And the fix is only for corner case when the password already specified in config but clickhouse-server package was not installed before.
|
Unfortunately CI did not create a build for this PR |
|
I will modify some unrelated file for this purpose... |
…ub.com:yandex/ClickHouse into postinst-dont-ask-for-password-if-already-have
This check is unreliable @exprmntr |
|
This modification is practially untestable. The only way is to test manually... I have tested and it does not work. |
|
Test 1: Install debian package and check that it's asking for password. Test 2: Install ClickHouse without debian package (by any other means), set up default password either with plaintext or with sha256 (both options should be tested). Then install ClickHouse with debian package and check that it does not ask for password. Test 3: Install ClickHouse with debian package, do dpkg purge but save config file with password. Then install again and check that it does not ask for password. |
|
I've changed "bugfix" to "improvement" so no one will dare to backport this insignificant mostly unneeded useless fix. |
The bots fight you again... better use |
|
debconf does not follow script execution. Instead it parses the script and tries to ask for configuration for all options listed inside: |
|
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Do not ask for password for default user during installation of debian package if the password was already specified in condiguration but this fact was not saved earlier inside debian tools. This closes #8316.