Skip to content

Commit 73c0131

Browse files
Support to enable client certificate revocation check using PS (#19515)
* support enable client certificate revocation check via PS * update test case for create/update clientauthconfig * update PS test case, add sessionrecord of testing run * move the changelog to upcoming release * when set without VerifyClientRevocation, assign None explicitly * add test case to verify the property via get Co-authored-by: Yunchi Wang <[email protected]>
1 parent bcbc250 commit 73c0131

File tree

8 files changed

+1498
-1038
lines changed

8 files changed

+1498
-1038
lines changed

src/Network/Network.Test/ScenarioTests/ApplicationGatewayTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ public void TestApplicationGatewayCRUDWithMutualAuthentication()
221221
TestRunner.RunTestScript(string.Format("Test-ApplicationGatewayCRUDWithMutualAuthentication -baseDir '{0}'", AppDomain.CurrentDomain.BaseDirectory));
222222
}
223223

224-
225-
226224
[Fact]
227225
[Trait(Category.AcceptanceType, Category.CheckIn)]
228226
[Trait(Category.Owner, NrpTeamAlias.nvadev_subset1)]

src/Network/Network.Test/ScenarioTests/ApplicationGatewayTests.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4055,9 +4055,14 @@ function Test-ApplicationGatewayCRUDWithMutualAuthentication
40554055
$clientCertFilePath = $basedir + "/ScenarioTests/Data/TrustedClientCertificate.cer"
40564056
$trustedClient01 = New-AzApplicationGatewayTrustedClientCertificate -Name $trustedClientCert01Name -CertificateFile $clientCertFilePath
40574057
$sslPolicy = New-AzApplicationGatewaySslPolicy -PolicyType Custom -MinProtocolVersion TLSv1_0 -CipherSuite "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_GCM_SHA256"
4058-
$clientAuthConfig = New-AzApplicationGatewayClientAuthConfiguration -VerifyClientCertIssuerDN
4058+
4059+
$clientAuthConfig = New-AzApplicationGatewayClientAuthConfiguration -VerifyClientCertIssuerDN -VerifyClientRevocation OCSP
4060+
Assert-AreEqual $True $clientAuthConfig.VerifyClientCertIssuerDN
4061+
Assert-AreEqual "OCSP" $clientAuthConfig.VerifyClientRevocation
4062+
40594063
$sslProfile01 = New-AzApplicationGatewaySslProfile -Name $sslProfile01Name -SslPolicy $sslPolicy -ClientAuthConfiguration $clientAuthConfig -TrustedClientCertificates $trustedClient01
4060-
4064+
Assert-AreEqual "OCSP" $sslProfile01.ClientAuthConfiguration.VerifyClientRevocation
4065+
40614066
$listener = New-AzApplicationGatewayHttpListener -Name $listenerName -Protocol Https -SslCertificate $sslCert -FrontendIPConfiguration $fipconfig -FrontendPort $port -SslProfile $sslProfile01
40624067

40634068
# backend part
@@ -4094,6 +4099,7 @@ function Test-ApplicationGatewayCRUDWithMutualAuthentication
40944099
$clientAuthConfig = Get-AzApplicationGatewayClientAuthConfiguration -SslProfile $sslProfile01
40954100
Assert-NotNull $clientAuthConfig
40964101
Assert-AreEqual $True $clientAuthConfig.VerifyClientCertIssuerDN
4102+
Assert-AreEqual "OCSP" $clientAuthConfig.VerifyClientRevocation
40974103

40984104
$getpolicy = Get-AzApplicationGatewaySslProfilePolicy -SslProfile $sslProfile01
40994105
Assert-AreEqual $sslPolicy.MinProtocolVersion $getpolicy.MinProtocolVersion
@@ -4109,6 +4115,8 @@ function Test-ApplicationGatewayCRUDWithMutualAuthentication
41094115
$trustedClient02 = Get-AzApplicationGatewayTrustedClientCertificate -Name $trustedClientCert02Name -ApplicationGateway $getgw
41104116
$getgw = Add-AzApplicationGatewaySslProfile -Name $sslProfile02Name -ApplicationGateway $getgw -TrustedClientCertificates $trustedClient01,$trustedClient02
41114117
$sslProfile01 = Set-AzApplicationGatewayClientAuthConfiguration -SslProfile $sslProfile01
4118+
Assert-AreEqual "None" $sslProfile01.ClientAuthConfiguration.VerifyClientRevocation
4119+
41124120
$sslProfile01 = Set-AzApplicationGatewaySslProfilePolicy -SslProfile $sslProfile01 -PolicyType Custom -MinProtocolVersion TLSv1_1 -CipherSuite "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_GCM_SHA256"
41134121
$sslPolicy02 = New-AzApplicationGatewaySslPolicy -PolicyType Custom -MinProtocolVersion TLSv1_1 -CipherSuite "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_GCM_SHA256"
41144122
$getgw = Set-AzApplicationGatewaySslProfile -Name $sslProfile02Name -ApplicationGateway $getgw -SslPolicy $sslPolicy02 -TrustedClientCertificates $trustedClient01,$trustedClient02 -ClientAuthConfiguration $clientAuthConfig
@@ -4134,7 +4142,8 @@ function Test-ApplicationGatewayCRUDWithMutualAuthentication
41344142

41354143
$clientAuthConfig = Get-AzApplicationGatewayClientAuthConfiguration -SslProfile $getgw.SslProfiles[0]
41364144
Assert-AreEqual $False $clientAuthConfig.VerifyClientCertIssuerDN
4137-
4145+
Assert-AreEqual "None" $clientAuthConfig.VerifyClientRevocation
4146+
41384147
# Remove operations.
41394148
$sslProfile02 = Remove-AzApplicationGatewaySslProfilePolicy -SslProfile $sslProfile02
41404149
$getpolicy = Get-AzApplicationGatewaySslProfilePolicy -SslProfile $sslProfile02

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayCRUDWithMutualAuthentication.json

Lines changed: 1431 additions & 1029 deletions
Large diffs are not rendered by default.

src/Network/Network/ApplicationGateway/ClientAuthConfiguration/AzureApplicationGatewayClientAuthConfigurationBase.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ public class AzureApplicationGatewayClientAuthConfigurationBase : NetworkBaseCmd
2424
HelpMessage = "Verify client certificate issuer name.")]
2525
public SwitchParameter VerifyClientCertIssuerDN { get; set; }
2626

27+
[Parameter(
28+
Mandatory = false,
29+
HelpMessage = "Verify client certificate revocation status.")]
30+
[ValidateSet("None", "OCSP", IgnoreCase = true)]
31+
public string VerifyClientRevocation { get; set; }
32+
2733
public override void ExecuteCmdlet()
2834
{
2935
base.ExecuteCmdlet();
@@ -38,6 +44,15 @@ public PSApplicationGatewayClientAuthConfiguration NewObject()
3844
config.VerifyClientCertIssuerDN = true;
3945
}
4046

47+
if (!string.IsNullOrEmpty(this.VerifyClientRevocation))
48+
{
49+
config.VerifyClientRevocation = this.VerifyClientRevocation;
50+
}
51+
else
52+
{
53+
config.VerifyClientRevocation = "None";
54+
}
55+
4156
return config;
4257
}
4358
}

src/Network/Network/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
* Updated commandlets to support specifying an ASN on VPN Gateway
3030
- `NewAzureRmVpnGatewayCommand.cs`
3131
- `UpdateAzureRmVpnGatewayCommand.cs`
32+
* Updated cmdlets to enable verification on client certificate revocation by using a new property VerifyClientRevocation in ApplicationGatewayClientAuthConfiguration
33+
- `New-AzApplicationGatewayClientAuthConfiguration`
34+
- `Set-AzApplicationGatewayClientAuthConfiguration`
3235
* Added Uppercase Transform in New-AzApplicationGatewayFirewallCondition
3336
* Updated commandlet to support specifying an action for a managed rule override in Application Gateway WAF Policy.
3437
- `New-AzApplicationGatewayFirewallPolicyManagedRuleOverride`

src/Network/Network/Models/PSApplicationGatewayClientAuthConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ namespace Microsoft.Azure.Commands.Network.Models
1818
public class PSApplicationGatewayClientAuthConfiguration
1919
{
2020
public bool? VerifyClientCertIssuerDN { get; set; }
21+
public string VerifyClientRevocation { get; set; }
2122
}
2223
}

src/Network/Network/help/New-AzApplicationGatewayClientAuthConfiguration.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Creates a new client authentication configuration for SSL profile.
1313
## SYNTAX
1414

1515
```
16-
New-AzApplicationGatewayClientAuthConfiguration [-VerifyClientCertIssuerDN]
16+
New-AzApplicationGatewayClientAuthConfiguration [-VerifyClientCertIssuerDN] [-VerifyClientRevocation <String>]
1717
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
1818
```
1919

@@ -24,7 +24,7 @@ The **New-AzApplicationGatewayClientAuthConfiguration** cmdlet creates a new cli
2424

2525
### Example 1
2626
```powershell
27-
$clientAuthConfig = New-AzApplicationGatewayClientAuthConfiguration -VerifyClientCertIssuerDN
27+
$clientAuthConfig = New-AzApplicationGatewayClientAuthConfiguration -VerifyClientCertIssuerDN -VerifyClientRevocation OCSP
2828
```
2929

3030
The command create a new client auth configuration and stores it in $clientAuthConfig variable to be used in a SSL profile.
@@ -61,6 +61,22 @@ Accept pipeline input: False
6161
Accept wildcard characters: False
6262
```
6363
64+
### -VerifyClientRevocation
65+
Verify client certificate revocation status.
66+
67+
```yaml
68+
Type: System.String
69+
Parameter Sets: (All)
70+
Aliases:
71+
Accepted values: None, OCSP
72+
73+
Required: False
74+
Position: Named
75+
Default value: None
76+
Accept pipeline input: False
77+
Accept wildcard characters: False
78+
```
79+
6480
### CommonParameters
6581
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
6682

src/Network/Network/help/Set-AzApplicationGatewayClientAuthConfiguration.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Modifies the client auth configuration of a ssl profile object.
1414

1515
```
1616
Set-AzApplicationGatewayClientAuthConfiguration -SslProfile <PSApplicationGatewaySslProfile>
17-
[-VerifyClientCertIssuerDN] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
17+
[-VerifyClientCertIssuerDN] [-VerifyClientRevocation <String>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -26,7 +26,7 @@ The **Set-AzApplicationGatewayClientAuthConfiguration** cmdlet modifies the clie
2626
```powershell
2727
$AppGw = Get-AzApplicationGateway -Name "ApplicationGateway01" -ResourceGroupName "ResourceGroup01"
2828
$profile = Get-AzApplicationGatewaySslProfile -Name "SslProfile01" -ApplicationGateway $AppGw
29-
Set-AzApplicationGatewayClientAuthConfiguration -SslProfile $profile -VerifyClientCertIssuerDN
29+
Set-AzApplicationGatewayClientAuthConfiguration -SslProfile $profile -VerifyClientCertIssuerDN -VerifyClientRevocation OCSP
3030
```
3131

3232
The first command gets the application gateway named ApplicationGateway01 in the resource group named ResourceGroup01 and stores it in the $AppGw variable. The second command gets the ssl profile named SslProfile01 for $AppGw and stores the settings in the $profile variable. The last command modifies the client auth configuration of the ssl profile object stored in $profile.
@@ -64,6 +64,22 @@ Accept wildcard characters: False
6464
```
6565
6666
### -VerifyClientCertIssuerDN
67+
Verify client certificate revocation status.
68+
69+
```yaml
70+
Type: System.String
71+
Parameter Sets: (All)
72+
Aliases:
73+
Accepted values: None, OCSP
74+
75+
Required: False
76+
Position: Named
77+
Default value: None
78+
Accept pipeline input: False
79+
Accept wildcard characters: False
80+
```
81+
82+
### -VerifyClientRevocation
6783
Verify client certificate issuer name.
6884
6985
```yaml

0 commit comments

Comments
 (0)