Skip to content

Instantly share code, notes, and snippets.

@djnorrisdev
Created February 8, 2023 14:28
Show Gist options
  • Select an option

  • Save djnorrisdev/062de4d1d71df69beed32c212404df85 to your computer and use it in GitHub Desktop.

Select an option

Save djnorrisdev/062de4d1d71df69beed32c212404df85 to your computer and use it in GitHub Desktop.

Revisions

  1. djnorrisdev created this gist Feb 8, 2023.
    25 changes: 25 additions & 0 deletions aws_jwt.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    Create a key pair and b64 encode them:
    ```
    ssh-keygen -t rsa -b 4096 -m PEM -f ./jwtcookie.key
    rsa_priv_key=$(openssl base64 -in jwtcookie.key -A)
    rsa_pub_key=$(openssl base64 -in jwtcookie.key.pub -A)
    ```

    Put the base-64 encoded keys into a json file like so:

    ```
    cat << EOL > jwtkeys.json
    {
    "rsa_priv_key": "$rsa_priv_key",
    "rsa_pub_key": "$rsa_pub_key"
    }
    EOL
    ```

    Create the secret in AWS, referencing the json file created above

    ```
    aws $AWSENV secretsmanager create-secret --name jwt_secret_for_tea \
    --description "RS256 keys for app JWT cookies" \
    --secret-string file://jwtkeys.json
    ```