-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: conditional tls setup for prod/nonprod (#12)
- Loading branch information
Showing
12 changed files
with
125 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
creation_rules: | ||
- azure_kv: | ||
vault_url: https://elyclover-kv.vault.azure.net | ||
name: sops-key | ||
version: 06473759a48f4ed39ef5343909e2e436 | ||
- azure_keyvault: https://elyclover-kv.vault.azure.net/keys/sops-key/06473759a48f4ed39ef5343909e2e436 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# elyclover.com-infra | ||
|
||
# targets to handle SOPS encryption/decryption using Azure keyvault | ||
decrypt: | ||
@./scripts/sops.sh $@ | ||
encrypt: | ||
@./scripts/sops.sh $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# pfx storage | ||
|
||
This directory is for storing pfx certificates that have been encrypted at-rest with SOPS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package main | ||
|
||
import ( | ||
//legacykeyvault "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/keyvault" | ||
"github.com/pulumi/pulumi-azure-native-sdk/keyvault/v2" | ||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi" | ||
) | ||
|
||
func getSecretByName(ctx *pulumi.Context, kv string, rg string, name string) (secret *keyvault.LookupSecretResult, err error) { | ||
secret, err = keyvault.LookupSecret(ctx, &keyvault.LookupSecretArgs{ | ||
VaultName: kv, | ||
SecretName: name, | ||
ResourceGroupName: rg, | ||
}) | ||
if err != nil { | ||
return secret, err | ||
} | ||
|
||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
TLS_FILE_LOCATION=./assets/tls | ||
FILES=("$TLS_FILE_LOCATION"/*) | ||
|
||
if [ -z "$1" ]; then | ||
echo "requires either 'encrypt or 'decrypt' argument e.g.: ./sops.sh encrypt" | ||
fi | ||
|
||
if [ "$1" == "encrypt" ]; then | ||
for f in "${FILES[@]}" | ||
do | ||
echo encrypting "$f" | ||
sops --encrypt --in-place "$f" | ||
done | ||
elif [ "$1" == "decrypt" ]; then | ||
for f in "${FILES[@]}" | ||
do | ||
echo decrypting "$f" | ||
sops --decrypt --in-place "$f" | ||
done | ||
else | ||
echo "FATAL: unknown argument: $1" | ||
fi |