Skip to content

Commit

Permalink
generate pfx and update firewall policy tests accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
gro1m committed Aug 25, 2021
1 parent f1b50ca commit e1062f5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 75 deletions.
27 changes: 3 additions & 24 deletions internal/services/firewall/firewall_policy_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ resource "azurerm_key_vault_certificate" "test" {
key_vault_id = azurerm_key_vault.test.id
certificate {
contents = filebase64("testdata/cert_key.pem")
contents = filebase64("testdata/certificate.pfx")
}
certificate_policy {
Expand All @@ -482,32 +482,11 @@ resource "azurerm_key_vault_certificate" "test" {
exportable = true
key_size = 2048
key_type = "RSA"
reuse_key = true
reuse_key = false
}
secret_properties {
content_type = "application/x-pem-file"
}
x509_certificate_properties {
# Server Authentication = 1.3.6.1.5.5.7.3.1
# Client Authentication = 1.3.6.1.5.5.7.3.2
extended_key_usage = ["1.3.6.1.5.5.7.3.1"]
key_usage = [
"cRLSign",
"dataEncipherment",
"digitalSignature",
"keyAgreement",
"keyCertSign",
"keyEncipherment",
]
subject_alternative_names {
dns_names = ["api.pluginsdk.io"]
}
subject = "CN=api.pluginsdk.io"
validity_in_months = 1
content_type = "application/x-pkcs12"
}
}
Expand Down
9 changes: 8 additions & 1 deletion internal/services/firewall/testdata/HOWTO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# How Key and Certificate was generated
# How Certificates were generated

## How Key and Certificate was generated
```bash
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
```

## How PFX was generated from above Key and Certificate
```bash
openssl pkcs12 -export -out certificate.pfx -inkey key.pem -in cert.pem
```
50 changes: 0 additions & 50 deletions internal/services/firewall/testdata/cert_key.pem

This file was deleted.

Binary file not shown.

0 comments on commit e1062f5

Please sign in to comment.