Skip to content

Commit 80fa256

Browse files
committed
admin user
1 parent b49a738 commit 80fa256

File tree

3 files changed

+16
-61
lines changed

3 files changed

+16
-61
lines changed

infra/clickhouse/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@
578578
<default_password_type>sha256_password</default_password_type>
579579

580580
<!-- Work factor for bcrypt_password authentication type -->
581-
<bcrypt_workfactor>12</bcrypt_workfactor>
581+
<bcrypt_workfactor>12</bcrypt_workfactor>
582582

583583
<!-- Complexity requirements for user passwords.
584584
Note: ClickHouse Cloud https://clickhouse.com/cloud is always configured for strong passwords.

infra/clickhouse/docker-compose.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ services:
1212
- ./config.xml:/etc/clickhouse-server/config.xml:ro
1313
- ./users.xml:/etc/clickhouse-server/users.xml:ro
1414
- ./flags:/var/lib/clickhouse/flags
15-
environment:
16-
CLICKHOUSE_DB: default
17-
CLICKHOUSE_USER: default
18-
CLICKHOUSE_PASSWORD: "analyticsarecool"
1915
ulimits:
2016
nofile:
2117
soft: 262144

infra/clickhouse/users.xml

Lines changed: 15 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,63 +18,7 @@
1818
<users>
1919
<!-- If user name was not specified, 'default' user is used. -->
2020
<default>
21-
<!-- See also the files in users.d directory where the password can be overridden.
22-
23-
Password could be specified in plaintext or in SHA256 (in hex format).
24-
25-
If you want to specify password in plaintext (not recommended), place it in 'password' element.
26-
Example: <password>qwerty</password>.
27-
Password could be empty.
28-
29-
If you want to specify SHA256, place it in 'password_sha256_hex' element.
30-
Example: <password_sha256_hex>65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5</password_sha256_hex>
31-
Restrictions of SHA256: impossibility to connect to ClickHouse using MySQL JS client (as of July 2019).
32-
33-
If you want to specify double SHA1, place it in 'password_double_sha1_hex' element.
34-
Example: <password_double_sha1_hex>e395796d6546b1b65db9d665cd43f0e858dd4303</password_double_sha1_hex>
35-
36-
If you want to specify a previously defined LDAP server (see 'ldap_servers' in the main config) for authentication,
37-
place its name in 'server' element inside 'ldap' element.
38-
Example: <ldap><server>my_ldap_server</server></ldap>
39-
40-
If you want to authenticate the user via Kerberos (assuming Kerberos is enabled, see 'kerberos' in the main config),
41-
place 'kerberos' element instead of 'password' (and similar) elements.
42-
The name part of the canonical principal name of the initiator must match the user name for authentication to succeed.
43-
You can also place 'realm' element inside 'kerberos' element to further restrict authentication to only those requests
44-
whose initiator's realm matches it.
45-
Example: <kerberos />
46-
Example: <kerberos><realm>EXAMPLE.COM</realm></kerberos>
47-
48-
How to generate decent password:
49-
Execute: PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-'
50-
In first line will be password and in second - corresponding SHA256.
51-
52-
How to generate double SHA1:
53-
Execute: PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-'
54-
In first line will be password and in second - corresponding double SHA1.
55-
-->
5621
<password></password>
57-
58-
<!-- List of networks with open access.
59-
60-
To open access from everywhere, specify:
61-
<ip>::/0</ip>
62-
63-
To open access only from localhost, specify:
64-
<ip>::1</ip>
65-
<ip>127.0.0.1</ip>
66-
67-
Each element of list has one of the following forms:
68-
<ip> IP-address or network mask. Examples: 213.180.204.3 or 10.0.0.1/8 or 10.0.0.1/255.255.255.0
69-
2a02:6b8::3 or 2a02:6b8::3/64 or 2a02:6b8::3/ffff:ffff:ffff:ffff::.
70-
<host> Hostname. Example: server01.clickhouse.com.
71-
To check access, DNS query is performed, and all received addresses compared to peer address.
72-
<host_regexp> Regular expression for host names. Example, ^server\d\d-\d\d-\d\.clickhouse\.com$
73-
To check access, DNS PTR query is performed for peer address and then regexp is applied.
74-
Then, for result of PTR query, another DNS query is performed and all received addresses compared to peer address.
75-
Strongly recommended that regexp is ends with $
76-
All results of DNS requests are cached till server restart.
77-
-->
7822
<networks>
7923
<ip>::/0</ip>
8024
</networks>
@@ -96,6 +40,21 @@
9640
<query>GRANT ALL ON *.*</query>
9741
</grants>
9842
</default>
43+
44+
<admin>
45+
<password>StrongPassword123</password>
46+
<networks>
47+
<ip>::/0</ip>
48+
</networks>
49+
<profile>default</profile>
50+
<quota>default</quota>
51+
<access_management>1</access_management>
52+
<named_collection_control>1</named_collection_control>
53+
<grants>
54+
<query>GRANT ALL ON *.* TO admin</query>
55+
</grants>
56+
</admin>
57+
9958
</users>
10059

10160
<!-- Quotas. -->

0 commit comments

Comments
 (0)