diff --git a/CHANGELOG.md b/CHANGELOG.md index 41bf97d5..e6517f73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ## Changes since v7.1.3 +- [#1108](https://github.com/oauth2-proxy/oauth2-proxy/pull/1108) Add alternative ways to generate cookie secrets to docs (@JoelSpeed) - [#1142](https://github.com/oauth2-proxy/oauth2-proxy/pull/1142) Add pagewriter to upstream proxy (@JoelSpeed) - [#1181](https://github.com/oauth2-proxy/oauth2-proxy/pull/1181) Fix incorrect `cfg` name in show-debug-on-error flag (@iTaybb) diff --git a/docs/docs/configuration/overview.md b/docs/docs/configuration/overview.md index 4702f321..ebf7c05e 100644 --- a/docs/docs/configuration/overview.md +++ b/docs/docs/configuration/overview.md @@ -7,7 +7,62 @@ title: Overview ### Generating a Cookie Secret -To generate a strong cookie secret use `python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(16)).decode())'` +To generate a strong cookie secret use one of the below commands: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + ```shell + python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())' + ``` + + + + + ```shell + cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 | base64 + ``` + + + + + ```shell + openssl rand -base64 32 | tr -- '+/' '-_' + ``` + + + + + ```shell + # Add System.Web assembly to session, just in case + Add-Type -AssemblyName System.Web + [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Web.Security.Membership]::GeneratePassword(32,4))).Replace("+","-").Replace("/","_") + ``` + + + + + ```shell + # Valid 32 Byte Base64 URL encoding set that will decode to 24 []byte AES-192 secret + resource "random_password" "cookie_secret" { + length = 32 + override_special = "-_" + } + ``` + + + ### Config File diff --git a/docs/versioned_docs/version-6.1.x/configuration/overview.md b/docs/versioned_docs/version-6.1.x/configuration/overview.md index 575db4dd..a8e72114 100644 --- a/docs/versioned_docs/version-6.1.x/configuration/overview.md +++ b/docs/versioned_docs/version-6.1.x/configuration/overview.md @@ -7,7 +7,62 @@ title: Overview ### Generating a Cookie Secret -To generate a strong cookie secret use `python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(16)).decode())'` +To generate a strong cookie secret use one of the below commands: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + ```shell + python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())' + ``` + + + + + ```shell + cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 | base64 + ``` + + + + + ```shell + openssl rand -base64 32 | tr -- '+/' '-_' + ``` + + + + + ```shell + # Add System.Web assembly to session, just in case + Add-Type -AssemblyName System.Web + [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Web.Security.Membership]::GeneratePassword(32,4))).Replace("+","-").Replace("/","_") + ``` + + + + + ```shell + # Valid 32 Byte Base64 URL encoding set that will decode to 24 []byte AES-192 secret + resource "random_password" "cookie_secret" { + length = 32 + override_special = "-_" + } + ``` + + + ### Config File diff --git a/docs/versioned_docs/version-7.0.x/configuration/overview.md b/docs/versioned_docs/version-7.0.x/configuration/overview.md index 98adc04d..3b17339d 100644 --- a/docs/versioned_docs/version-7.0.x/configuration/overview.md +++ b/docs/versioned_docs/version-7.0.x/configuration/overview.md @@ -7,7 +7,62 @@ title: Overview ### Generating a Cookie Secret -To generate a strong cookie secret use `python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(16)).decode())'` +To generate a strong cookie secret use one of the below commands: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + ```shell + python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())' + ``` + + + + + ```shell + cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 | base64 + ``` + + + + + ```shell + openssl rand -base64 32 | tr -- '+/' '-_' + ``` + + + + + ```shell + # Add System.Web assembly to session, just in case + Add-Type -AssemblyName System.Web + [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Web.Security.Membership]::GeneratePassword(32,4))).Replace("+","-").Replace("/","_") + ``` + + + + + ```shell + # Valid 32 Byte Base64 URL encoding set that will decode to 24 []byte AES-192 secret + resource "random_password" "cookie_secret" { + length = 32 + override_special = "-_" + } + ``` + + + ### Config File