git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #1108 from oauth2-proxy/secret-gen

Add alternative ways to generate cookie secrets to docs

commit823cb14d01c6cbdb2ef030c56471d2f78f0299bb authorJoel Speed <Joel.speed@hotmail.co.uk> dateSun 23 May 2021, 20:21 (5 years ago) parent0680870a0e2f78
4 files changed+169−3
CHANGELOG.md+1 docs/docs/configuration/overview.md+56−1 docs/versioned_docs/version-6.1.x/configuration/overview.md+56−1 docs/versioned_docs/version-7.0.x/configuration/overview.md+56−1
CHANGELOG.md+1
@@ -8,6 +8,7 @@
88
99## Changes since v7.1.3
1010
11+- [#1108](https://github.com/oauth2-proxy/oauth2-proxy/pull/1108) Add alternative ways to generate cookie secrets to docs (@JoelSpeed)
1112- [#1142](https://github.com/oauth2-proxy/oauth2-proxy/pull/1142) Add pagewriter to upstream proxy (@JoelSpeed)
1213- [#1181](https://github.com/oauth2-proxy/oauth2-proxy/pull/1181) Fix incorrect `cfg` name in show-debug-on-error flag (@iTaybb)
1314
docs/docs/configuration/overview.md+56−1
@@ -7,7 +7,62 @@ title: Overview
77
88### Generating a Cookie Secret
99
10−To generate a strong cookie secret use `python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(16)).decode())'`
10+To generate a strong cookie secret use one of the below commands:
11+
12+import Tabs from '@theme/Tabs';
13+import TabItem from '@theme/TabItem';
14+
15+<Tabs
16+ defaultValue="python"
17+ values={[
18+ {label: 'Python', value: 'python'},
19+ {label: 'Bash', value: 'bash'},
20+ {label: 'OpenSSL', value: 'openssl'},
21+ {label: 'PowerShell', value: 'powershell'},
22+ {label: 'Terraform', value: 'terraform'},
23+ ]}>
24+ <TabItem value="python">
25+
26+ ```shell
27+ python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())'
28+ ```
29+
30+ </TabItem>
31+ <TabItem value="bash">
32+
33+ ```shell
34+ cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 | base64
35+ ```
36+
37+ </TabItem>
38+ <TabItem value="openssl">
39+
40+ ```shell
41+ openssl rand -base64 32 | tr -- '+/' '-_'
42+ ```
43+
44+ </TabItem>
45+ <TabItem value="powershell">
46+
47+ ```shell
48+ # Add System.Web assembly to session, just in case
49+ Add-Type -AssemblyName System.Web
50+ [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Web.Security.Membership]::GeneratePassword(32,4))).Replace("+","-").Replace("/","_")
51+ ```
52+
53+ </TabItem>
54+ <TabItem value="terraform">
55+
56+ ```shell
57+ # Valid 32 Byte Base64 URL encoding set that will decode to 24 []byte AES-192 secret
58+ resource "random_password" "cookie_secret" {
59+ length = 32
60+ override_special = "-_"
61+ }
62+ ```
63+
64+ </TabItem>
65+</Tabs>
1166
1267### Config File
1368
docs/versioned_docs/version-6.1.x/configuration/overview.md+56−1
@@ -7,7 +7,62 @@ title: Overview
77
88### Generating a Cookie Secret
99
10−To generate a strong cookie secret use `python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(16)).decode())'`
10+To generate a strong cookie secret use one of the below commands:
11+
12+import Tabs from '@theme/Tabs';
13+import TabItem from '@theme/TabItem';
14+
15+<Tabs
16+ defaultValue="python"
17+ values={[
18+ {label: 'Python', value: 'python'},
19+ {label: 'Bash', value: 'bash'},
20+ {label: 'OpenSSL', value: 'openssl'},
21+ {label: 'PowerShell', value: 'powershell'},
22+ {label: 'Terraform', value: 'terraform'},
23+ ]}>
24+ <TabItem value="python">
25+
26+ ```shell
27+ python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())'
28+ ```
29+
30+ </TabItem>
31+ <TabItem value="bash">
32+
33+ ```shell
34+ cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 | base64
35+ ```
36+
37+ </TabItem>
38+ <TabItem value="openssl">
39+
40+ ```shell
41+ openssl rand -base64 32 | tr -- '+/' '-_'
42+ ```
43+
44+ </TabItem>
45+ <TabItem value="powershell">
46+
47+ ```shell
48+ # Add System.Web assembly to session, just in case
49+ Add-Type -AssemblyName System.Web
50+ [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Web.Security.Membership]::GeneratePassword(32,4))).Replace("+","-").Replace("/","_")
51+ ```
52+
53+ </TabItem>
54+ <TabItem value="terraform">
55+
56+ ```shell
57+ # Valid 32 Byte Base64 URL encoding set that will decode to 24 []byte AES-192 secret
58+ resource "random_password" "cookie_secret" {
59+ length = 32
60+ override_special = "-_"
61+ }
62+ ```
63+
64+ </TabItem>
65+</Tabs>
1166
1267### Config File
1368
docs/versioned_docs/version-7.0.x/configuration/overview.md+56−1
@@ -7,7 +7,62 @@ title: Overview
77
88### Generating a Cookie Secret
99
10−To generate a strong cookie secret use `python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(16)).decode())'`
10+To generate a strong cookie secret use one of the below commands:
11+
12+import Tabs from '@theme/Tabs';
13+import TabItem from '@theme/TabItem';
14+
15+<Tabs
16+ defaultValue="python"
17+ values={[
18+ {label: 'Python', value: 'python'},
19+ {label: 'Bash', value: 'bash'},
20+ {label: 'OpenSSL', value: 'openssl'},
21+ {label: 'PowerShell', value: 'powershell'},
22+ {label: 'Terraform', value: 'terraform'},
23+ ]}>
24+ <TabItem value="python">
25+
26+ ```shell
27+ python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())'
28+ ```
29+
30+ </TabItem>
31+ <TabItem value="bash">
32+
33+ ```shell
34+ cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 | base64
35+ ```
36+
37+ </TabItem>
38+ <TabItem value="openssl">
39+
40+ ```shell
41+ openssl rand -base64 32 | tr -- '+/' '-_'
42+ ```
43+
44+ </TabItem>
45+ <TabItem value="powershell">
46+
47+ ```shell
48+ # Add System.Web assembly to session, just in case
49+ Add-Type -AssemblyName System.Web
50+ [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Web.Security.Membership]::GeneratePassword(32,4))).Replace("+","-").Replace("/","_")
51+ ```
52+
53+ </TabItem>
54+ <TabItem value="terraform">
55+
56+ ```shell
57+ # Valid 32 Byte Base64 URL encoding set that will decode to 24 []byte AES-192 secret
58+ resource "random_password" "cookie_secret" {
59+ length = 32
60+ override_special = "-_"
61+ }
62+ ```
63+
64+ </TabItem>
65+</Tabs>
1166
1267### Config File
1368