do not gen at runtime, use pre-built ones

This commit is contained in:
Arthur Passos 2024-06-24 16:43:19 -03:00
parent d4da0a0a21
commit 5bdd49f36c
2 changed files with 11 additions and 5 deletions

View File

@ -7,7 +7,6 @@ New password should work
Two new passwords were added, should both work
1
1
Gen ssh key
Authenticating with ssh key
1
Altering credentials and keeping only bcrypt_password

View File

@ -4,6 +4,14 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
ssh_key="-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACAc6mt3bktHHukGJM1IJKPVtFMe4u3d8T6LHha8J4WOGAAAAJApc2djKXNn
YwAAAAtzc2gtZWQyNTUxOQAAACAc6mt3bktHHukGJM1IJKPVtFMe4u3d8T6LHha8J4WOGA
AAAEAk15S5L7j85LvmAivo2J8lo44OR/tLILBO1Wb2//mFwBzqa3duS0ce6QYkzUgko9W0
Ux7i7d3xPoseFrwnhY4YAAAADWFydGh1ckBhcnRodXI=
-----END OPENSSH PRIVATE KEY-----"
function test_login_pwd
{
${CLICKHOUSE_CLIENT} --user $1 --password $2 --query "select 1"
@ -38,12 +46,11 @@ test_login_pwd ${user} '3'
test_login_pwd ${user} '4'
echo "Gen ssh key"
yes 'yes' | ssh-keygen -t ed25519 -N '' -f 'ssh_key' > /dev/null
ssh_pub_key="AAAAC3NzaC1lZDI1NTE5AAAAIBzqa3duS0ce6QYkzUgko9W0Ux7i7d3xPoseFrwnhY4Y"
pub_key=$(awk '{print $2}' ssh_key.pub)
${CLICKHOUSE_CLIENT} --query "ALTER USER ${user} ADD IDENTIFIED WITH ssh_key BY KEY '${ssh_pub_key}' TYPE 'ssh-ed25519'"
${CLICKHOUSE_CLIENT} --query "ALTER USER ${user} ADD IDENTIFIED WITH ssh_key BY KEY '${pub_key}' TYPE 'ssh-ed25519'"
echo ${ssh_key} > ssh_key
echo "Authenticating with ssh key"
${CLICKHOUSE_CLIENT} --user ${user} --ssh-key-file 'ssh_key' --ssh-key-passphrase "" --query "SELECT 1"