Skip to content

[Storage] Support secure SMB and NFSV3 #15209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,14 @@ public void TestStorageBlobInventory()
{
TestRunner.RunTestScript("Test-StorageBlobInventory");
}


[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewAzureStorageAccountEnableNfsV3()
{
TestRunner.RunTestScript("Test-NewAzureStorageAccountEnableNfsV3");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ function Test-NewSetAzureStorageAccountAllowSharedKeyAccess
Assert-AreEqual $stotype $sto.Sku.Name;
Assert-AreEqual $loc.ToLower().Replace(" ", "") $sto.Location;
Assert-AreEqual $kind $sto.Kind;
#Assert-AreEqual $false $sto.AllowSharedKeyAccess
Assert-AreEqual $false $sto.AllowSharedKeyAccess

Set-AzStorageAccount -ResourceGroupName $rgname -Name $stoname -AllowSharedKeyAccess $true -EnableHttpsTrafficOnly $true

Expand All @@ -1417,7 +1417,7 @@ function Test-NewSetAzureStorageAccountAllowSharedKeyAccess
Assert-AreEqual $stotype $sto.Sku.Name;
Assert-AreEqual $loc.ToLower().Replace(" ", "") $sto.Location;
Assert-AreEqual $kind $sto.Kind;
#Assert-AreEqual $true $sto.AllowSharedKeyAccess
Assert-AreEqual $true $sto.AllowSharedKeyAccess

Remove-AzStorageAccount -Force -ResourceGroupName $rgname -Name $stoname;
}
Expand Down Expand Up @@ -1946,4 +1946,57 @@ function Test-StorageBlobInventory
# Cleanup
Clean-ResourceGroup $rgname
}
}


<#
.SYNOPSIS
Test Test-NewAzureStorageAccountEnableNfsV3
.DESCRIPTION
SmokeTest
#>
function Test-NewAzureStorageAccountEnableNfsV3
{
# Setup
$rgname = Get-StorageManagementTestResourceName;

try
{
# Test
$stoname = 'sto' + $rgname;
$stotype = 'Standard_LRS';
$loc = Get-ProviderLocation_Canary ResourceManagement;
$kind = 'StorageV2'

$rg = New-AzResourceGroup -Name $rgname -Location $loc;
Write-Output ("Resource Group created")

## Create a vnet and subnet in same location, then get the subnet resource id
# New-AzVirtualNetwork -ResourceGroupName $rgname -Location $loc -AddressPrefix 10.0.0.0/24 -Name "vnet1"
# $subnet = Get-AzVirtualNetwork -ResourceGroupName $rgname -Name "vnet1" | Add-AzVirtualNetworkSubnetConfig -Name "subnet1" -AddressPrefix "10.0.0.0/28" -ServiceEndpoint "Microsoft.Storage" | Set-AzVirtualNetwork
# $vnet1 = $subnet.Id
$vnet1 = "$($rg.ResourceId)/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"

New-AzStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -SkuName $stotype `
-EnableNfsV3 $true `
-EnableHierarchicalNamespace $true `
-EnableHttpsTrafficOnly $false `
-NetworkRuleSet (@{bypass="Logging,Metrics";defaultAction="allow";virtualNetworkRules=(@{VirtualNetworkResourceId="$vnet1";Action="allow"})})

Retry-IfException { $global:sto = Get-AzStorageAccount -ResourceGroupName $rgname -Name $stoname; }
Assert-AreEqual $stoname $sto.StorageAccountName;
Assert-AreEqual $stotype $sto.Sku.Name;
Assert-AreEqual $loc.ToLower().Replace(" ", "") $sto.Location;
Assert-AreEqual $kind $sto.Kind;
Assert-AreEqual $true $sto.EnableHierarchicalNamespace
Assert-AreEqual $false $sto.EnableHttpsTrafficOnly
Assert-AreEqual $true $sto.EnableNfsV3

Remove-AzStorageAccount -Force -ResourceGroupName $rgname -Name $stoname;
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,43 @@ function Test-FileServiceProperties
$stos = Get-AzStorageAccount -ResourceGroupName $rgname;

# Enable MC, and set smb setting
Update-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname -EnableSmbMultichannel $true
Update-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname -EnableSmbMultichannel $true `
-SMBProtocolVersion SMB2.1,SMB3.0,SMB3.1.1 `
-SMBAuthenticationMethod Kerberos,NTLMv2 `
-SMBKerberosTicketEncryption RC4-HMAC,AES-256 `
-SMBChannelEncryption AES-128-CCM,AES-128-GCM,AES-256-GCM
$servicePropertie = Get-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname
Assert-AreEqual 3 $servicePropertie.ProtocolSettings.Smb.Versions.Count
Assert-AreEqual 2 $servicePropertie.ProtocolSettings.Smb.AuthenticationMethods.Count
Assert-AreEqual 2 $servicePropertie.ProtocolSettings.Smb.KerberosTicketEncryption.Count
Assert-AreEqual 3 $servicePropertie.ProtocolSettings.Smb.ChannelEncryption.Count
Assert-AreEqual $true $servicePropertie.ProtocolSettings.Smb.Multichannel.Enabled

# Disable MC, update smb setting
Update-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname -EnableSmbMultichannel $false
Update-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname -EnableSmbMultichannel $false `
-SMBProtocolVersion SMB3.1.1 `
-SMBAuthenticationMethod Kerberos `
-SMBKerberosTicketEncryption AES-256 `
-SMBChannelEncryption AES-128-CCM
$servicePropertie = Get-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname
Assert-AreEqual "SMB3.1.1" $servicePropertie.ProtocolSettings.Smb.Versions[0]
Assert-AreEqual "Kerberos" $servicePropertie.ProtocolSettings.Smb.AuthenticationMethods[0]
Assert-AreEqual "AES-256" $servicePropertie.ProtocolSettings.Smb.KerberosTicketEncryption[0]
Assert-AreEqual "AES-128-CCM" $servicePropertie.ProtocolSettings.Smb.ChannelEncryption[0]
Assert-AreEqual $false $servicePropertie.ProtocolSettings.Smb.Multichannel.Enabled

# remove smb setting
Update-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname `
-SMBProtocolVersion @() `
-SMBAuthenticationMethod @()`
-SMBKerberosTicketEncryption @() `
-SMBChannelEncryption @()
$servicePropertie = Get-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname
Assert-AreEqual $null $servicePropertie.ProtocolSettings.Smb.Versions
Assert-AreEqual $null $servicePropertie.ProtocolSettings.Smb.AuthenticationMethods
Assert-AreEqual $null $servicePropertie.ProtocolSettings.Smb.KerberosTicketEncryption
Assert-AreEqual $null $servicePropertie.ProtocolSettings.Smb.ChannelEncryption

Remove-AzStorageAccount -Force -ResourceGroupName $rgname -Name $stoname;
}
finally
Expand Down
Loading