diff --git a/DSCResources/Helper.psm1 b/DSCResources/Helper.psm1 index 6e3d0f7c6..a21a51e63 100644 --- a/DSCResources/Helper.psm1 +++ b/DSCResources/Helper.psm1 @@ -46,14 +46,17 @@ function New-TerminatingError [CmdletBinding()] param ( - [Parameter(Mandatory)] - [String] $ErrorId, + [Parameter(Mandatory = $true)] + [String] + $ErrorId, - [Parameter(Mandatory)] - [String] $ErrorMessage, + [Parameter(Mandatory = $true)] + [String] + $ErrorMessage, - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory] $ErrorCategory + [Parameter(Mandatory = $true)] + [System.Management.Automation.ErrorCategory] + $ErrorCategory ) $exception = New-Object System.InvalidOperationException $ErrorMessage @@ -74,7 +77,9 @@ function Assert-Module [CmdletBinding()] param ( - [String]$ModuleName = 'WebAdministration' + [Parameter()] + [String] + $ModuleName = 'WebAdministration' ) if(-not(Get-Module -Name $ModuleName -ListAvailable)) @@ -421,13 +426,17 @@ function Get-AuthenticationInfo param ( [Parameter(Mandatory = $true)] - [String] $Site, + [String] + $Site, - [String] $Application, + [Parameter()] + [String] + $Application, [Parameter(Mandatory = $true)] [ValidateSet('Website','Application','Ftp')] - [String] $IisType + [String] + $IisType ) $authAvailable = Get-DefaultAuthenticationInfo -IisType $IisType @@ -460,7 +469,8 @@ function Get-DefaultAuthenticationInfo ( [Parameter(Mandatory = $true)] [ValidateSet('Website','Application','Ftp')] - [String] $IisType + [String] + $IisType ) $cimNamespace = 'root/microsoft/Windows/DesiredStateConfiguration' @@ -482,7 +492,7 @@ function Get-DefaultAuthenticationInfo Ftp { - New-CimInstance -ClassName MSFT_xFTPAuthenticationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthenticationInformation ` -ClientOnly -Namespace $cimNamespace ` -Property @{Anonymous=$false;Basic=$false} } @@ -517,19 +527,26 @@ function Set-Authentication param ( [Parameter(Mandatory = $true)] - [String] $Site, + [String] + $Site, - [String] $Application, + [Parameter()] + [String] + $Application, [Parameter(Mandatory = $true)] [ValidateSet('Website','Application','Ftp')] - [String] $IisType, + [String] + $IisType, [Parameter(Mandatory = $true)] [ValidateSet('Anonymous','Basic','Digest','Windows')] - [String] $Type, + [String] + $Type, - [System.Boolean] $Enabled + [Parameter()] + [System.Boolean] + $Enabled ) $Location = "${Site}" @@ -578,17 +595,22 @@ function Set-AuthenticationInfo param ( [Parameter(Mandatory = $true)] - [String] $Site, + [String] + $Site, - [String] $Application, + [Parameter()] + [String] + $Application, [Parameter(Mandatory = $true)] [ValidateSet('Website','Application','Ftp')] - [String ]$IisType, + [String] + $IisType, [Parameter()] [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance] $AuthenticationInfo + [Microsoft.Management.Infrastructure.CimInstance] + $AuthenticationInfo ) $Properties = ($AuthenticationInfo.CimInstanceProperties | Where-Object {$null -ne $_.Value}).Name | Sort-Object @@ -627,17 +649,22 @@ function Test-AuthenticationEnabled param ( [Parameter(Mandatory = $true)] - [String] $Site, + [String] + $Site, - [String] $Application, + [Parameter()] + [String] + $Application, [Parameter(Mandatory = $true)] [ValidateSet('Website','Application','Ftp')] - [String] $IisType, + [String] + $IisType, [Parameter(Mandatory = $true)] [ValidateSet('Anonymous','Basic','Digest','Windows')] - [String] $Type + [String] + $Type ) $Location = "${Site}" @@ -690,17 +717,22 @@ function Test-AuthenticationInfo param ( [Parameter(Mandatory = $true)] - [String] $Site, + [String] + $Site, - [String] $Application, + [Parameter()] + [String] + $Application, [Parameter(Mandatory = $true)] [ValidateSet('Website','Application','Ftp')] - [String] $IisType, + [String] + $IisType, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance] $AuthenticationInfo + [Microsoft.Management.Infrastructure.CimInstance] + $AuthenticationInfo ) $Properties = ($AuthenticationInfo.CimInstanceProperties | Where-Object {$null -ne $_.Value}).Name | Sort-Object @@ -915,7 +947,7 @@ function Confirm-UniqueBinding [String] $Name, - [Parameter(Mandatory = $false)] + [Parameter()] [Switch] $ExcludeStopped ) @@ -1004,7 +1036,7 @@ function ConvertTo-CimBinding $cimClassName = switch($CimProperties.Protocol) { - 'ftp' { 'MSFT_xFTPBindingInformation' } + 'ftp' { 'MSFT_FTPBindingInformation' } default { 'MSFT_xWebBindingInformation' } } @@ -1584,7 +1616,7 @@ function Update-WebsiteBinding [String] $Name, - [Parameter(Mandatory = $false)] + [Parameter()] [Microsoft.Management.Infrastructure.CimInstance[]] $BindingInfo ) diff --git a/DSCResources/MSFT_xFTP/MSFT_xFTP.psm1 b/DSCResources/MSFT_FTP/MSFT_FTP.psm1 similarity index 79% rename from DSCResources/MSFT_xFTP/MSFT_xFTP.psm1 rename to DSCResources/MSFT_FTP/MSFT_FTP.psm1 index 8c292a4b5..2b78273d6 100644 --- a/DSCResources/MSFT_xFTP/MSFT_xFTP.psm1 +++ b/DSCResources/MSFT_FTP/MSFT_FTP.psm1 @@ -1,78 +1,10 @@ # Load the Helper Module Import-Module -Name "$PSScriptRoot\..\Helper.psm1" -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - ErrorftpSiteDiscoveryFailure = Failure to get the requested ftpSite "{0}" information from the target machine. - ErrorftpSiteCreationFailure = Failure to successfully create the ftpSite "{0}". Error: "{1}". - ErrorftpSiteRemovalFailure = Failure to successfully remove the ftpSite "{0}". Error: "{1}". - ErrorftpSiteStateFailure = Failure to successfully set the state of the website "{0}". Error: "{1}". - ErrorServerCertHashFailure = No such cert with the hash of "{0}" exists under store "{1}". - VerboseGetTargetAbsent = No ftpSite exists with this name. - VerboseGetTargetPresent = A single ftpSite exists with this name. - VerboseSetTargetftpSiteCreated = Successfully created ftpSite "{0}". - VerboseSetTargetftpSiteRemoved = Successfully removed ftpSite "{0}". - VerboseSetTargetAuthenticationInfoUpdated = Successfully updated AuthenticationInfo on ftpSite "{0}". - VerboseSetTargetAuthorizationInfoUpdated = Successfully updated AuthorizationInfo on ftpSite "{0}". - VerboseSetTargetUpdateAllowLocalDetailedErrors = Successfully updated AllowLocalDetailedErrors on ftpSite "{0}". - VerboseSetTargetUpdateBannerMessage = Successfully updated Banner message on ftpSite "{0}". - VerboseSetTargetUpdatedApplicationPool = Successfully updated ApplicationPool on ftpSite "{0}". - VerboseSetTargetUpdatedBindingInfo = Successfully updated BindingInfo on ftpSite "{0}". - VerboseSetTargetUpdateDirectoryBrowseFlags = Successfully updated DirectoryBrowseFlags on ftpSite "{0}". - VerboseSetTargetUpdateEndingDataChannelPort = Successfully updated ending data channel port on ftpSite "{0}". - VerboseSetTargetUpdateExitMessage = Successfully updated Exit message on ftpSite "{0}". - VerboseSetTargetUpdateExpandVariablesInMessages = Successfully updated ExpandVariablesInMessages on ftpSite "{0}". - VerboseSetTargetUpdateExternalIPaddress = Successfully updated external firewall IP address on ftpSite "{0}". - VerboseSetTargetUpdateGreetingMessage = Successfully updated Greeting message on ftpSite "{0}". - VerboseSetTargetUpdateLogFlags = Successfully updated LogFlags on ftpSite "{0}". - VerboseSetTargetUpdateLoglocalTimeRollover = Successfully updated LoglocalTimeRollover on ftpSite "{0}". - VerboseSetTargetUpdateLogPath = Successfully updated LogPath on ftpSite "{0}". - VerboseSetTargetUpdateLogPeriod = Successfully updated LogPeriod on ftpSite "{0}". - VerboseSetTargetUpdateLogTruncateSize = Successfully updated TruncateSize on ftpSite "{0}". - VerboseSetTargetUpdateMaxClientsMessage = Successfully updated MaxClients message on ftpSite "{0}". - VerboseSetTargetUpdatedPhysicalPath = Successfully updated PhysicalPath on ftpSite "{0}". - VerboseSetTargetUpdatePhysicalPathCredential = Successfully updated PhysicalPathCredential on ftpSite "{0}". - VerboseSetTargetUpdatedState = Successfully updated State on ftpSite "{0}". - VerboseSetTargetUpdateSslInfo = Successfully updated SslInfo on ftpSite "{0}". - VerboseSetTargetUpdateStartingDataChannelPort = Successfully updated starting data channel port on ftpSite "{0}". - VerboseSetTargetUpdateSuppressDefaultBanner = Successfully updated SuppressDefaultBanner on ftpSite "{0}". - VerboseSetTargetUpdateUserIsolation = Successfully updated UserIsolation on ftpSite "{0}". - VerboseTestTargetFalseAllowLocalDetailedErrors = AllowLocalDetailedErrors for ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalseApplicationPool = Application Pool for ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalseAuthenticationInfo = AuthenticationInfo for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseAuthorizationInfo = AuthorizationInfo for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseBannerMessage = BannerMessage for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseBindingInfo = BindingInfo for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseDirectoryBrowseFlags = DirectoryBrowseFlags for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseEndingDataChannelPort = Ending data channel port for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseEnsure = The Ensure state for ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalseExitMessage = ExitMessage for ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalseExpandVariablesInMessages = ExpandVariablesInMessages for ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalseExternalIPaddress = The external firewall IP address for ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalseGreetingMessage = GreetingMessage for ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalseLogFlags = LogFlags for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseLoglocalTimeRollover = LoglocalTimeRollover for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseLogPath = LogPath for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseLogPeriod = LogPeriod for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseLogTruncateSize = LogTruncateSize for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseMaxClientsMessage = MaxClientsMessage for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseSslInfo = SslInfo for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseStartingDataChannelPort = Starting data channel port for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalseState = The state of ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalseSuppressDefaultBanner = SuppressDefaultBanner for ftpSite "{0}" is not in the desired state. - VerboseTestTargetFalsePhysicalPath = Physical Path of ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalsePhysicalPathCredential = PhysicalPathCredential of ftpSite "{0}" does not match the desired state. - VerboseTestTargetFalseUserIsolation = UserIsolation for ftpSite "{0}" is not in the desired state. - VerboseTestTargetTrueResult = The target resource is already in the desired state. No action is required. - VerboseTestTargetFalseResult = The target resource is not in the desired state. - VerboseStartWebsite = Successfully started ftpSite "{0}". - VerboseStopWebsite = Successfully stopped ftpSite "{0}". - WarningLogPeriod = LogTruncateSize is specified as an input so LogPeriod input will be ignored and set to "MaxSize" on Website "{0}". -'@ -} +# Import Localization Strings +$localizedData = Get-LocalizedData ` + -ResourceName 'MSFT_FTP' ` + -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) <# .SYNOPSIS @@ -91,7 +23,8 @@ function Get-TargetResource ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [String] $Name + [String] + $Name ) Assert-Module @@ -167,81 +100,224 @@ function Get-TargetResource .SYNOPSIS The Set-TargetResource cmdlet is used to create, delete or configure a ftpSite on the target machine. + + .PARAMETER Name + Specifies the name of the FTP Site. + + .PARAMETER Ensure + Specifies whether the FTP site should be present. + + .PARAMETER PhysicalPath + Specifies physical folder location for FTP site. + + .PARAMETER PhysicalPathCredential + Specifies credential object for physical path access. + + .PARAMETER State + Specifies state of the FTP site whether it should be Started or Stopped. + + .PARAMETER ApplicationPool + Specifies name of the application pool to use. + + .PARAMETER AuthenticationInfo + Specifies the authentication settings for FTP site in the form of embedded instance of + the MSFT_FTPAuthenticationInformation CIM class. Possible properties are: Anonymous, Basic. + + .PARAMETER AuthorizationInfo + Specifies the authorization settings for FTP site in the form of array of embedded instances of + the MSFT_FTPAuthorizationInformation CIM class. Possible properties are: AccessType, Roles, + Permissions, Users. + + .PARAMETER SslInfo + Specifies the FTP over Secure Sockets Layer (SSL) settings for the FTP service in the + form of embedded instance of the MSFT_FTPSslInformation CIM class. Possible properties + are: ControlChannelPolicy, DataChannelPolicy, RequireSsl128, CertificateThumbprint, + CertificateStoreName. + + .PARAMETER BindingInfo + Specifies binding information for the FTP site in the form of embedded instance of the + MSFT_FTPBindingInformation CIM class. Possible properties are: Protocol, BindingInformation, + IPAddress, Port, HostName. + + .PARAMETER FirewallIPAddress + Specifies the external firewall IP address used for passive connections. + + .PARAMETER StartingDataChannelPort + Specifies starting port number in port range used for data connections in passive mode. + + .PARAMETER EndingDataChannelPort + Specifies ending port number in port range used for data connections in passive mode. + + .PARAMETER GreetingMessage + Specifies message the FTP server displays when FTP clients have logged in to the FTP server. + + .PARAMETER ExitMessage + Specifies message the FTP server displays when FTP clients log off the FTP server. + + .PARAMETER BannerMessage + Specifies message the FTP server displays when FTP clients first connect to the FTP server. + + .PARAMETER MaxClientsMessage + Specifies message when clients cannot connect because the FTP service has reached the maximum number of client connections allowed. + + .PARAMETER SuppressDefaultBanner + Specifies whether to display the default identification banner for the FTP server or not. + + .PARAMETER AllowLocalDetailedErrors + Specifies whether to display detailed error messages on the local host. + + .PARAMETER ExpandVariablesInMessages + Specifies whether to display a specific set of user variables in FTP messages. + + .PARAMETER LogFlags + Specifies the categories of information that are written to the log file. + + .PARAMETER LogPath + Specifies the directory to be used for storing logfiles. + + .PARAMETER LogPeriod + Specifies how often the FTP service creates a new log file. + + .PARAMETER LogTruncateSize + Specifies the maximum size of the log file (in bytes) after which to create a new log file. + This value is only applicable when MaxSize is chosen for the LogPeriod attribute. + + .PARAMETER LoglocalTimeRollover + Specifies whether new log file is created based on local time or UTC. + + .PARAMETER DirectoryBrowseFlags + Specifies content settings for directory browsing on FTP site. + + .PARAMETER UserIsolation + Specifies to which folder users access should be restricted on a single FTP server. #> function Set-TargetResource { [CmdletBinding()] param ( - [ValidateSet('Present', 'Absent')] - [String] $Ensure = 'Present', - [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [String] $Name, + [String] + $Name, + + [Parameter()] + [ValidateSet('Present', 'Absent')] + [String] + $Ensure = 'Present', + [Parameter()] [ValidateNotNullOrEmpty()] - [String] $PhysicalPath, + [String] + $PhysicalPath, + [Parameter()] [System.Management.Automation.CredentialAttribute()] [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] $PhysicalPathCredential, + [System.Management.Automation.PSCredential] + $PhysicalPathCredential, + [Parameter()] [ValidateSet('Started', 'Stopped')] - [String] $State = 'Started', + [String] + $State = 'Started', # The application pool name must contain between 1 and 64 characters + [Parameter()] [ValidateLength(1, 64)] - [String] $ApplicationPool, + [String] + $ApplicationPool, - [Microsoft.Management.Infrastructure.CimInstance] $AuthenticationInfo, + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance] + $AuthenticationInfo, - [Microsoft.Management.Infrastructure.CimInstance[]] $AuthorizationInfo, + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $AuthorizationInfo, - [Microsoft.Management.Infrastructure.CimInstance] $SslInfo, + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance] + $SslInfo, - [Microsoft.Management.Infrastructure.CimInstance[]] $BindingInfo, + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $BindingInfo, - [String] $FirewallIPAddress, + [Parameter()] + [String] + $FirewallIPAddress, + [Parameter()] [ValidateScript({$_ -eq 0 -or $_ -in 1025 .. 65535})] - [uint16] $StartingDataChannelPort, + [uint16] + $StartingDataChannelPort, + [Parameter()] [ValidateScript({$_ -eq 0 -or $_ -in 1025 .. 65535})] - [uint16] $EndingDataChannelPort, + [uint16] + $EndingDataChannelPort, - [String] $GreetingMessage, + [Parameter()] + [String] + $GreetingMessage, - [String] $ExitMessage, + [Parameter()] + [String] + $ExitMessage, - [String] $BannerMessage, + [Parameter()] + [String] + $BannerMessage, - [String] $MaxClientsMessage, + [Parameter()] + [String] + $MaxClientsMessage, - [Boolean] $SuppressDefaultBanner, + [Parameter()] + [Boolean] + $SuppressDefaultBanner, - [Boolean] $AllowLocalDetailedErrors, + [Parameter()] + [Boolean] + $AllowLocalDetailedErrors, - [Boolean] $ExpandVariablesInMessages, + [Parameter()] + [Boolean] + $ExpandVariablesInMessages, + [Parameter()] [ValidateSet('Date','Time','ClientIP','UserName','ServerIP','Method','UriStem','UriQuery','HttpStatus','Win32Status','TimeTaken','ServerPort','UserAgent','Referer','HttpSubStatus')] - [String[]] $LogFlags, + [String[]] + $LogFlags, - [String] $LogPath, + [Parameter()] + [String] + $LogPath, + [Parameter()] [ValidateSet('Hourly','Daily','Weekly','Monthly','MaxSize')] - [String] $LogPeriod, + [String] + $LogPeriod, + [Parameter()] [ValidateRange('1048576','4294967295')] - [String] $LogTruncateSize, + [String] + $LogTruncateSize, - [Boolean] $LoglocalTimeRollover, + [Parameter()] + [Boolean] + $LoglocalTimeRollover, + [Parameter()] [ValidateSet('StyleUnix','LongDate','DisplayAvailableBytes','DisplayVirtualDirectories')] - [String[]] $DirectoryBrowseFlags, + [String[]] + $DirectoryBrowseFlags, + [Parameter()] [ValidateSet('None','StartInUsersDirectory','IsolateAllDirectories','IsolateRootDirectoryOnly')] - [String] $UserIsolation + [String] + $UserIsolation ) Assert-Module @@ -684,6 +760,96 @@ function Set-TargetResource .SYNOPSIS The Test-TargetResource cmdlet is used to validate if the role or feature is in a state as expected in the instance document. + + .PARAMETER Name + Specifies the name of the FTP Site. + + .PARAMETER Ensure + Specifies whether the FTP site should be present. + + .PARAMETER PhysicalPath + Specifies physical folder location for FTP site. + + .PARAMETER PhysicalPathCredential + Specifies credential object for physical path access. + + .PARAMETER State + Specifies state of the FTP site whether it should be Started or Stopped. + + .PARAMETER ApplicationPool + Specifies name of the application pool to use. + + .PARAMETER AuthenticationInfo + Specifies the authentication settings for FTP site in the form of embedded instance of + the MSFT_FTPAuthenticationInformation CIM class. Possible properties are: Anonymous, Basic. + + .PARAMETER AuthorizationInfo + Specifies the authorization settings for FTP site in the form of array of embedded instances of + the MSFT_FTPAuthorizationInformation CIM class. Possible properties are: AccessType, Roles, + Permissions, Users. + + .PARAMETER SslInfo + Specifies the FTP over Secure Sockets Layer (SSL) settings for the FTP service in the + form of embedded instance of the MSFT_FTPSslInformation CIM class. Possible properties + are: ControlChannelPolicy, DataChannelPolicy, RequireSsl128, CertificateThumbprint, + CertificateStoreName. + + .PARAMETER BindingInfo + Specifies binding information for the FTP site in the form of embedded instance of the + MSFT_FTPBindingInformation CIM class. Possible properties are: Protocol, BindingInformation, + IPAddress, Port, HostName. + + .PARAMETER FirewallIPAddress + Specifies the external firewall IP address used for passive connections. + + .PARAMETER StartingDataChannelPort + Specifies starting port number in port range used for data connections in passive mode. + + .PARAMETER EndingDataChannelPort + Specifies ending port number in port range used for data connections in passive mode. + + .PARAMETER GreetingMessage + Specifies message the FTP server displays when FTP clients have logged in to the FTP server. + + .PARAMETER ExitMessage + Specifies message the FTP server displays when FTP clients log off the FTP server. + + .PARAMETER BannerMessage + Specifies message the FTP server displays when FTP clients first connect to the FTP server. + + .PARAMETER MaxClientsMessage + Specifies message when clients cannot connect because the FTP service has reached the maximum number of client connections allowed. + + .PARAMETER SuppressDefaultBanner + Specifies whether to display the default identification banner for the FTP server or not. + + .PARAMETER AllowLocalDetailedErrors + Specifies whether to display detailed error messages on the local host. + + .PARAMETER ExpandVariablesInMessages + Specifies whether to display a specific set of user variables in FTP messages. + + .PARAMETER LogFlags + Specifies the categories of information that are written to the log file. + + .PARAMETER LogPath + Specifies the directory to be used for storing logfiles. + + .PARAMETER LogPeriod + Specifies how often the FTP service creates a new log file. + + .PARAMETER LogTruncateSize + Specifies the maximum size of the log file (in bytes) after which to create a new log file. + This value is only applicable when MaxSize is chosen for the LogPeriod attribute. + + .PARAMETER LoglocalTimeRollover + Specifies whether new log file is created based on local time or UTC. + + .PARAMETER DirectoryBrowseFlags + Specifies content settings for directory browsing on FTP site. + + .PARAMETER UserIsolation + Specifies to which folder users access should be restricted on a single FTP server. #> function Test-TargetResource { @@ -691,75 +857,128 @@ function Test-TargetResource [OutputType([Boolean])] param ( - [ValidateSet('Present', 'Absent')] - [String] $Ensure = 'Present', - [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [String] $Name, + [String] + $Name, + + [Parameter()] + [ValidateSet('Present', 'Absent')] + [String] + $Ensure = 'Present', + [Parameter()] [ValidateNotNullOrEmpty()] - [String] $PhysicalPath, + [String] + $PhysicalPath, + [Parameter()] [System.Management.Automation.CredentialAttribute()] [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] $PhysicalPathCredential, + [System.Management.Automation.PSCredential] + $PhysicalPathCredential, + [Parameter()] [ValidateSet('Started', 'Stopped')] - [String] $State = 'Started', + [String] + $State = 'Started', # The application pool name must contain between 1 and 64 characters + [Parameter()] [ValidateLength(1, 64)] - [String] $ApplicationPool, + [String] + $ApplicationPool, - [Microsoft.Management.Infrastructure.CimInstance] $AuthenticationInfo, + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance] + $AuthenticationInfo, - [Microsoft.Management.Infrastructure.CimInstance[]] $AuthorizationInfo, + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $AuthorizationInfo, - [Microsoft.Management.Infrastructure.CimInstance] $SslInfo, + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance] + $SslInfo, - [Microsoft.Management.Infrastructure.CimInstance[]] $BindingInfo, + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $BindingInfo, - [String] $FirewallIPAddress, + [Parameter()] + [String] + $FirewallIPAddress, + [Parameter()] [ValidateScript({$_ -eq 0 -or $_ -in 1025 .. 65535})] - [uint16] $StartingDataChannelPort, + [uint16] + $StartingDataChannelPort, + [Parameter()] [ValidateScript({$_ -eq 0 -or $_ -in 1025 .. 65535})] - [uint16] $EndingDataChannelPort, + [uint16] + $EndingDataChannelPort, - [String] $GreetingMessage, + [Parameter()] + [String] + $GreetingMessage, - [String] $ExitMessage, + [Parameter()] + [String] + $ExitMessage, - [String] $BannerMessage, + [Parameter()] + [String] + $BannerMessage, - [String] $MaxClientsMessage, + [Parameter()] + [String] + $MaxClientsMessage, - [Boolean] $SuppressDefaultBanner, + [Parameter()] + [Boolean] + $SuppressDefaultBanner, - [Boolean] $AllowLocalDetailedErrors, + [Parameter()] + [Boolean] + $AllowLocalDetailedErrors, - [Boolean] $ExpandVariablesInMessages, + [Parameter()] + [Boolean] + $ExpandVariablesInMessages, + [Parameter()] [ValidateSet('Date','Time','ClientIP','UserName','ServerIP','Method','UriStem','UriQuery','HttpStatus','Win32Status','TimeTaken','ServerPort','UserAgent','Referer','HttpSubStatus')] - [String[]] $LogFlags, + [String[]] + $LogFlags, - [String] $LogPath, + [Parameter()] + [String] + $LogPath, + [Parameter()] [ValidateSet('Hourly','Daily','Weekly','Monthly','MaxSize')] - [String] $LogPeriod, + [String] + $LogPeriod, + [Parameter()] [ValidateRange('1048576','4294967295')] - [String] $LogTruncateSize, + [String] + $LogTruncateSize, - [Boolean] $LoglocalTimeRollover, + [Parameter()] + [Boolean] + $LoglocalTimeRollover, + [Parameter()] [ValidateSet('StyleUnix','LongDate','DisplayAvailableBytes','DisplayVirtualDirectories')] - [String[]] $DirectoryBrowseFlags, + [String[]] + $DirectoryBrowseFlags, + [Parameter()] [ValidateSet('None','StartInUsersDirectory','IsolateAllDirectories','IsolateRootDirectoryOnly')] - [String] $UserIsolation + [String] + $UserIsolation ) Assert-Module @@ -1040,11 +1259,13 @@ function Compare-DirectoryBrowseFlags ( [Parameter(Mandatory = $true)] [ValidateSet('StyleUnix','LongDate','DisplayAvailableBytes','DisplayVirtualDirectories')] - [String[]] $DirectoryBrowseflags, + [String[]] + $DirectoryBrowseflags, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [String] $Site + [String] + $Site ) @@ -1065,7 +1286,7 @@ function Compare-DirectoryBrowseFlags <# .SYNOPSIS Helper function used to validate that the Authorization is unique to current - per CimInstance of MSFT_xFTPAuthorizationInformation. + per CimInstance of MSFT_FTPAuthorizationInformation. .PARAMETER CurrentAuthorizationCollection Specifies PSCustomObject of the current Authorization collection defined on the @@ -1089,15 +1310,18 @@ function Confirm-UniqueFTPAuthorization ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [PSCustomObject[]] $CurrentAuthorizationCollection, + [PSCustomObject[]] + $CurrentAuthorizationCollection, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance] $Authorization, + [Microsoft.Management.Infrastructure.CimInstance] + $Authorization, [Parameter(Mandatory = $true)] [ValidateSet('users','roles')] - [String] $Property + [String] + $Property ) $desiredObject = New-Object -TypeName PSObject -Property @{ @@ -1155,11 +1379,13 @@ function Confirm-UniqueSslInfo param ( [Parameter(Mandatory = $true)] - [String] $Site, + [String] + $Site, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance] $SslInfo + [Microsoft.Management.Infrastructure.CimInstance] + $SslInfo ) $Store = $SslInfo.CertificateStoreName @@ -1219,7 +1445,8 @@ function Get-AuthorizationInfo param ( [Parameter(Mandatory = $true)] - [String] $Site + [String] + $Site ) $authCollections = (Get-WebConfiguration ` @@ -1236,7 +1463,7 @@ function Get-AuthorizationInfo } $authorizationInfo += New-CimInstance ` - -ClassName MSFT_xFTPAuthorizationInformation ` + -ClassName MSFT_FTPAuthorizationInformation ` -ClientOnly -Property $authorizationProperties ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' } @@ -1258,7 +1485,8 @@ function Get-SslInfo param ( [Parameter(Mandatory = $true)] - [String] $Site + [String] + $Site ) $sslProperties = @{} @@ -1283,7 +1511,7 @@ function Get-SslInfo } } - return New-CimInstance -ClassName MSFT_xFTPSslInformation ` + return New-CimInstance -ClassName MSFT_FTPSslInformation ` -ClientOnly -Property $sslProperties ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' } @@ -1304,11 +1532,13 @@ function Set-FTPAuthorization param ( [Parameter(Mandatory = $true)] - [String] $Site, + [String] + $Site, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance[]] $AuthorizationInfo + [Microsoft.Management.Infrastructure.CimInstance[]] + $AuthorizationInfo ) Clear-WebConfiguration ` @@ -1349,11 +1579,13 @@ function Set-SslInfo param ( [Parameter(Mandatory = $true)] - [String] $Site, + [String] + $Site, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance] $SslInfo + [Microsoft.Management.Infrastructure.CimInstance] + $SslInfo ) foreach ($value in ($SslInfo.CimInstanceProperties | Where-Object {$null -ne $_.Value}).Name) @@ -1391,11 +1623,13 @@ function Test-AuthorizationInfo param ( [Parameter(Mandatory = $true)] - [String] $Site, + [String] + $Site, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance[]] $AuthorizationInfo + [Microsoft.Management.Infrastructure.CimInstance[]] + $AuthorizationInfo ) $currentFtpAuthorizationInfo = (Get-WebConfiguration ` diff --git a/DSCResources/MSFT_xFTP/MSFT_xFTP.schema.mof b/DSCResources/MSFT_FTP/MSFT_FTP.schema.mof similarity index 80% rename from DSCResources/MSFT_xFTP/MSFT_xFTP.schema.mof rename to DSCResources/MSFT_FTP/MSFT_FTP.schema.mof index 67b3fea94..7b6521696 100644 --- a/DSCResources/MSFT_xFTP/MSFT_xFTP.schema.mof +++ b/DSCResources/MSFT_FTP/MSFT_FTP.schema.mof @@ -1,16 +1,16 @@ -[ClassVersion("2.0.0"), FriendlyName("xFTP")] -class MSFT_xFTP : OMI_BaseResource +[ClassVersion("2.0.0"), FriendlyName("FTP")] +class MSFT_FTP : OMI_BaseResource { [Write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure; - [Key] String Name; + [Key, Description("Specifies the name of the FTP site.")] String Name; [Write] String PhysicalPath; [Write,EmbeddedInstance("MSFT_Credential")] String PhysicalPathCredential; [Write,ValueMap{"Started","Stopped"},Values{"Started", "Stopped"}] String State; [Write] String ApplicationPool; - [Write, EmbeddedInstance("MSFT_xFTPAuthenticationInformation"), Description("Hashtable containing authentication information (Anonymous, Basic)")] String AuthenticationInfo; - [Write, EmbeddedInstance("MSFT_xFTPAuthorizationInformation"), Description("Hashtable containing authentication information (AccessType, Roles, Permissions, Users)")] String AuthorizationInfo[]; - [Write, EmbeddedInstance("MSFT_xFTPBindingInformation"), Description("Website's binding information in the form of an array of embedded instances of the MSFT_xFTPBindingInformation CIM class.")] String BindingInfo[]; - [Write, EmbeddedInstance("MSFT_xFTPSslInformation"), Description("Hashtable containing Ssl information (ControlChannelPolicy, DataChannelPolicy, RequireSsl128, CertificateThumbprint, CertificateStoreName)")] String SslInfo; + [Write, EmbeddedInstance("MSFT_FTPAuthenticationInformation"), Description("Hashtable containing authentication information (Anonymous, Basic)")] String AuthenticationInfo; + [Write, EmbeddedInstance("MSFT_FTPAuthorizationInformation"), Description("Hashtable containing authentication information (AccessType, Roles, Permissions, Users)")] String AuthorizationInfo[]; + [Write, EmbeddedInstance("MSFT_FTPBindingInformation"), Description("Website's binding information in the form of an array of embedded instances of the MSFT_FTPBindingInformation CIM class.")] String BindingInfo[]; + [Write, EmbeddedInstance("MSFT_FTPSslInformation"), Description("Hashtable containing Ssl information (ControlChannelPolicy, DataChannelPolicy, RequireSsl128, CertificateThumbprint, CertificateStoreName)")] String SslInfo; [Write, Description ("The external firewall IP address used for passive connections")] String FirewallIPAddress; [Write, Description ("The starting port number in port range used for data connections in passive mode")] UInt16 StartingDataChannelPort; [Write, Description ("The ending port number in port range used for data connections in passive mode")] UInt16 EndingDataChannelPort; @@ -31,7 +31,7 @@ class MSFT_xFTP : OMI_BaseResource }; [ClassVersion("1.0.0")] -class MSFT_xFTPSslInformation +class MSFT_FTPSslInformation { [Write,ValueMap{"SslAllow", "SslRequire", "SslRequireCredentialsOnly"},Values{"SslAllow", "SslRequire", "SslRequireCredentialsOnly"}] String ControlChannelPolicy; [Write,ValueMap{"SslAllow", "SslRequire", "SslDeny"},Values{"SslAllow", "SslRequire", "SslDeny"}] String DataChannelPolicy; @@ -41,7 +41,7 @@ class MSFT_xFTPSslInformation }; [ClassVersion("1.0.0")] -class MSFT_xFTPBindingInformation +class MSFT_FTPBindingInformation { [Required,ValueMap{"ftp"},Values{"ftp"}] String Protocol; [Write] String BindingInformation; @@ -51,7 +51,7 @@ class MSFT_xFTPBindingInformation }; [ClassVersion("1.0.0")] -class MSFT_xFTPAuthorizationInformation +class MSFT_FTPAuthorizationInformation { [Write,ValueMap{"Allow", "Deny"},Values{"Allow", "Deny"}] String AccessType; [Write] String Roles; @@ -60,7 +60,7 @@ class MSFT_xFTPAuthorizationInformation }; [ClassVersion("1.0.0")] -class MSFT_xFTPAuthenticationInformation +class MSFT_FTPAuthenticationInformation { [Write] Boolean Anonymous; [Write] Boolean Basic; diff --git a/DSCResources/MSFT_FTP/en-us/MSFT_FTP.strings.psd1 b/DSCResources/MSFT_FTP/en-us/MSFT_FTP.strings.psd1 new file mode 100644 index 000000000..ea1c53ba8 --- /dev/null +++ b/DSCResources/MSFT_FTP/en-us/MSFT_FTP.strings.psd1 @@ -0,0 +1,67 @@ +ConvertFrom-StringData @' + ErrorftpSiteDiscoveryFailure = Failure to get the requested ftpSite "{0}" information from the target machine. + ErrorftpSiteCreationFailure = Failure to successfully create the ftpSite "{0}". Error: "{1}". + ErrorftpSiteRemovalFailure = Failure to successfully remove the ftpSite "{0}". Error: "{1}". + ErrorftpSiteStateFailure = Failure to successfully set the state of the website "{0}". Error: "{1}". + ErrorServerCertHashFailure = No such cert with the hash of "{0}" exists under store "{1}". + VerboseGetTargetAbsent = No ftpSite exists with this name. + VerboseGetTargetPresent = A single ftpSite exists with this name. + VerboseSetTargetftpSiteCreated = Successfully created ftpSite "{0}". + VerboseSetTargetftpSiteRemoved = Successfully removed ftpSite "{0}". + VerboseSetTargetAuthenticationInfoUpdated = Successfully updated AuthenticationInfo on ftpSite "{0}". + VerboseSetTargetAuthorizationInfoUpdated = Successfully updated AuthorizationInfo on ftpSite "{0}". + VerboseSetTargetUpdateAllowLocalDetailedErrors = Successfully updated AllowLocalDetailedErrors on ftpSite "{0}". + VerboseSetTargetUpdateBannerMessage = Successfully updated Banner message on ftpSite "{0}". + VerboseSetTargetUpdatedApplicationPool = Successfully updated ApplicationPool on ftpSite "{0}". + VerboseSetTargetUpdatedBindingInfo = Successfully updated BindingInfo on ftpSite "{0}". + VerboseSetTargetUpdateDirectoryBrowseFlags = Successfully updated DirectoryBrowseFlags on ftpSite "{0}". + VerboseSetTargetUpdateEndingDataChannelPort = Successfully updated ending data channel port on ftpSite "{0}". + VerboseSetTargetUpdateExitMessage = Successfully updated Exit message on ftpSite "{0}". + VerboseSetTargetUpdateExpandVariablesInMessages = Successfully updated ExpandVariablesInMessages on ftpSite "{0}". + VerboseSetTargetUpdateExternalIPaddress = Successfully updated external firewall IP address on ftpSite "{0}". + VerboseSetTargetUpdateGreetingMessage = Successfully updated Greeting message on ftpSite "{0}". + VerboseSetTargetUpdateLogFlags = Successfully updated LogFlags on ftpSite "{0}". + VerboseSetTargetUpdateLoglocalTimeRollover = Successfully updated LoglocalTimeRollover on ftpSite "{0}". + VerboseSetTargetUpdateLogPath = Successfully updated LogPath on ftpSite "{0}". + VerboseSetTargetUpdateLogPeriod = Successfully updated LogPeriod on ftpSite "{0}". + VerboseSetTargetUpdateLogTruncateSize = Successfully updated TruncateSize on ftpSite "{0}". + VerboseSetTargetUpdateMaxClientsMessage = Successfully updated MaxClients message on ftpSite "{0}". + VerboseSetTargetUpdatedPhysicalPath = Successfully updated PhysicalPath on ftpSite "{0}". + VerboseSetTargetUpdatePhysicalPathCredential = Successfully updated PhysicalPathCredential on ftpSite "{0}". + VerboseSetTargetUpdatedState = Successfully updated State on ftpSite "{0}". + VerboseSetTargetUpdateSslInfo = Successfully updated SslInfo on ftpSite "{0}". + VerboseSetTargetUpdateStartingDataChannelPort = Successfully updated starting data channel port on ftpSite "{0}". + VerboseSetTargetUpdateSuppressDefaultBanner = Successfully updated SuppressDefaultBanner on ftpSite "{0}". + VerboseSetTargetUpdateUserIsolation = Successfully updated UserIsolation on ftpSite "{0}". + VerboseTestTargetFalseAllowLocalDetailedErrors = AllowLocalDetailedErrors for ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalseApplicationPool = Application Pool for ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalseAuthenticationInfo = AuthenticationInfo for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseAuthorizationInfo = AuthorizationInfo for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseBannerMessage = BannerMessage for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseBindingInfo = BindingInfo for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseDirectoryBrowseFlags = DirectoryBrowseFlags for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseEndingDataChannelPort = Ending data channel port for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseEnsure = The Ensure state for ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalseExitMessage = ExitMessage for ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalseExpandVariablesInMessages = ExpandVariablesInMessages for ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalseExternalIPaddress = The external firewall IP address for ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalseGreetingMessage = GreetingMessage for ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalseLogFlags = LogFlags for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseLoglocalTimeRollover = LoglocalTimeRollover for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseLogPath = LogPath for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseLogPeriod = LogPeriod for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseLogTruncateSize = LogTruncateSize for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseMaxClientsMessage = MaxClientsMessage for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseSslInfo = SslInfo for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseStartingDataChannelPort = Starting data channel port for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalseState = The state of ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalseSuppressDefaultBanner = SuppressDefaultBanner for ftpSite "{0}" is not in the desired state. + VerboseTestTargetFalsePhysicalPath = Physical Path of ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalsePhysicalPathCredential = PhysicalPathCredential of ftpSite "{0}" does not match the desired state. + VerboseTestTargetFalseUserIsolation = UserIsolation for ftpSite "{0}" is not in the desired state. + VerboseTestTargetTrueResult = The target resource is already in the desired state. No action is required. + VerboseTestTargetFalseResult = The target resource is not in the desired state. + VerboseStartWebsite = Successfully started ftpSite "{0}". + VerboseStopWebsite = Successfully stopped ftpSite "{0}". + WarningLogPeriod = LogTruncateSize is specified as an input so LogPeriod input will be ignored and set to "MaxSize" on Website "{0}". +'@ diff --git a/Examples/Sample_xFTP_NewFTPSite.ps1 b/Examples/Sample_xFTP_NewFTPSite.ps1 index 72af27981..2580fe047 100644 --- a/Examples/Sample_xFTP_NewFTPSite.ps1 +++ b/Examples/Sample_xFTP_NewFTPSite.ps1 @@ -1,4 +1,4 @@ -configuration Sample_xFTP_NewFTPsite +configuration Sample_FTP_NewFTPsite { param( @@ -27,7 +27,7 @@ Node $NodeName { - xFTP NewFTPSite + FTP NewFTPSite { Ensure = 'Present' Name = $Name @@ -35,7 +35,7 @@ PhysicalPath = $FTPSitePath State = 'Started' AuthorizationInfo = @( - MSFT_xFTPAuthorizationInformation + MSFT_FTPAuthorizationInformation { AccessType = 'Allow' Users = 'User1' @@ -43,14 +43,14 @@ Permissions = 'Read' }) BindingInfo = ` - MSFT_xFTPBindingInformation + MSFT_FTPBindingInformation { Protocol = 'ftp' Port = '21' HostName = 'ftp.somesite.com' } SslInfo = ` - MSFT_xFTPSslInformation + MSFT_FTPSslInformation { ControlChannelPolicy = 'SslAllow' DataChannelPolicy = 'SslAllow' diff --git a/README.md b/README.md index 370cdac2b..8aecb0c29 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # xWebAdministration -The **xWebAdministration** module contains the **xFTP**, **xIISModule**, **xIISLogging**, **xWebAppPool**, **xWebsite**, **xWebApplication**, **xWebVirtualDirectory**, **xSSLSettings**, **xWebConfigKeyValue**, **xWebConfigProperty**, **xWebConfigPropertyCollection** and **WebApplicationHandler** DSC resources for creating and configuring various IIS artifacts. +The **xWebAdministration** module contains the **FTP**, **xIISModule**, **xIISLogging**, **xWebAppPool**, **xWebsite**, **xWebApplication**, **xWebVirtualDirectory**, **xSSLSettings**, **xWebConfigKeyValue**, **xWebConfigProperty**, **xWebConfigPropertyCollection** and **WebApplicationHandler** DSC resources for creating and configuring various IIS artifacts. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. @@ -31,7 +31,7 @@ Please check out common DSC Resources [contributing guidelines](https://github.c ## Resources -### xFTP +### FTP * **Ensure**: Ensures that the FTP Site is **Present** or **Absent**. * **Name**: The desired name of the website. @@ -39,21 +39,21 @@ Please check out common DSC Resources [contributing guidelines](https://github.c * **PhysicalPathCredential**: Specific account used for connection to physical path. *Note* In case of using SMB as a physical path and target server doesn't share identity database with device/server hosting the share, local user account must be created with the same username/password used for the access, section 'More Information' [support.microsoft.com](https://support.microsoft.com/en-us/help/247099/access-denied-when-connecting-to-a-ftp-directory-that-uses-a-unc-path) * **State**: The state of the website: { Started | Stopped } * **ApplicationPool**: The FTP Site’s application pool. -* **AuthenticationInformation**: FTP Site's authentication information in the form of an embedded instance of the **MSFT_xFTPAuthenticationInformation** CIM class. **MSFT_xFTPAuthenticationInformation** take the following properties: +* **AuthenticationInformation**: FTP Site's authentication information in the form of an embedded instance of the **MSFT_FTPAuthenticationInformation** CIM class. **MSFT_FTPAuthenticationInformation** take the following properties: * **Anonymous**: The acceptable values for this property are: `$true`, `$false` * **Basic**: The acceptable values for this property are: `$true`, `$false` -* **AuthorizationInformation**: FTP Site's authorization information in the form of an array of embedded instances of the **MSFT_xFTPAuthorizationInformation** CIM class. **MSFT_xFTPAuthorizationInformation** take the following properties: +* **AuthorizationInformation**: FTP Site's authorization information in the form of an array of embedded instances of the **MSFT_FTPAuthorizationInformation** CIM class. **MSFT_FTPAuthorizationInformation** take the following properties: * **AccessType**: The acceptable values for this property are: `Allow`, `Deny` * **Users**: Users which can have desired access. *Note* If using groups pass in '' for the users. To add authorization information for 'All Users' specify `'*'` as a value and for 'All Anonymous Users' - `'?'`. * **Roles**: Groups which can have desired access. *Note* If using users pass in '' for the group. * **Permissions**: The acceptable values for this property are: `Read`, `Write`, `Read,Write` -* **BindingInfo**: Website's binding information in the form of an array of embedded instances of the **MSFT_xFTPBindingInformation** CIM class that implements the following properties: +* **BindingInfo**: Website's binding information in the form of an array of embedded instances of the **MSFT_FTPBindingInformation** CIM class that implements the following properties: * **Protocol**: The protocol of the binding. This property is required. The acceptable values for this property are: `ftp`. * **BindingInformation**: The binding information in the form a colon-delimited string that includes the IP address, port, and host name of the binding. This property is ignored for `http` and `https` bindings if at least one of the following properties is specified: **IPAddress**, **Port**, **HostName**. * **IPAddress**: The IP address of the binding. This property is only applicable for `http` and `https` bindings. The default value is `*`. * **Port**: The port of the binding. The value must be a positive integer between `1` and `65535`. This property is only applicable for `http` (the default value is `80`) and `https` (the default value is `443`) bindings. * **HostName**: The host name of the binding. This property is only applicable for `http` and `https` bindings. -* **SslInfo**: FTP Site's ssl information in the form of an embedded instance of the **MSFT_xFTPSslInformation** CIM class. **MSFT_xFTPSslInformation** takes the following properties: +* **SslInfo**: FTP Site's ssl information in the form of an embedded instance of the **MSFT_FTPSslInformation** CIM class. **MSFT_FTPSslInformation** takes the following properties: * **ControlChannelPolicy**: The acceptable values for this property are: `SslAllow`, `SslRequire`, `SslRequireCredentialsOnly`},Values{`SslAllow`, `SslRequire`, `SslRequireCredentialsOnly` * **DataChannelPolicy**: The acceptable values for this property are: `SslAllow`, `SslRequire`, `SslDeny` * **RequireSsl128**: `$true`, `$false` @@ -366,7 +366,7 @@ This resource manages the IIS configuration section locking (overrideMode) to co ### Unreleased -* Added **xFTP** resource for managing FTP sites [#81](https://github.com/PowerShell/xWebAdministration/issues/81) +* Added **FTP** resource for managing FTP sites [#81](https://github.com/PowerShell/xWebAdministration/issues/81) * BEHAVIOR CHANGED: For **xWebsite** and **xWebApplcation** if AuthenticationInformation was not specified Default($false) is assumed. ### 2.6.0.0 diff --git a/Tests/Integration/MSFT_xFTP.Integration.Tests.ps1 b/Tests/Integration/MSFT_FTP.Integration.Tests.ps1 similarity index 99% rename from Tests/Integration/MSFT_xFTP.Integration.Tests.ps1 rename to Tests/Integration/MSFT_FTP.Integration.Tests.ps1 index 39564590a..3cb6ba6b1 100644 --- a/Tests/Integration/MSFT_xFTP.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_FTP.Integration.Tests.ps1 @@ -1,5 +1,5 @@ $script:DSCModuleName = 'xWebAdministration' -$script:DSCResourceName = 'MSFT_xFTP' +$script:DSCResourceName = 'MSFT_FTP' #region HEADER [String] $moduleRoot = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)) diff --git a/Tests/Integration/MSFT_xFTP.config.ps1 b/Tests/Integration/MSFT_FTP.config.ps1 similarity index 86% rename from Tests/Integration/MSFT_xFTP.config.ps1 rename to Tests/Integration/MSFT_FTP.config.ps1 index 01e0073bb..20bcb3794 100644 --- a/Tests/Integration/MSFT_xFTP.config.ps1 +++ b/Tests/Integration/MSFT_FTP.config.ps1 @@ -1,6 +1,6 @@ #requires -Version 4 -configuration MSFT_xFTP_Present +configuration MSFT_FTP_Present { param( @@ -13,51 +13,51 @@ configuration MSFT_xFTP_Present Node $AllNodes.NodeName { - xFTP FTP + FTP FTPSite { Ensure = 'Present' Name = $Node.Name ApplicationPool = $Node.ApplicationPool PhysicalPath = $Node.PhysicalPath - PhysicalPathCredential = New-Object System.Management.Automation.PSCredential ($Node.PhysicalPathUserName, ` + PhysicalPathCredential = New-Object System.Management.Automation.PSCredential ($Node.PhysicalPathUserName, ` (ConvertTo-SecureString -String $Node.PhysicalPathPassword -AsPlainText -Force)) State = $Node.State AuthenticationInfo = ` - MSFT_xFTPAuthenticationInformation + MSFT_FTPAuthenticationInformation { Anonymous = $Node.AuthenticationInfoAnonymous Basic = $Node.AuthenticationInfoBasic } AuthorizationInfo = @( - MSFT_xFTPAuthorizationInformation + MSFT_FTPAuthorizationInformation { AccessType = $Node.AuthorizationInfoAccessType1 Users = $Node.AuthorizationInfoUsers1 Roles = '' Permissions = $Node.AuthorizationInfoPermissions1 }; - MSFT_xFTPAuthorizationInformation + MSFT_FTPAuthorizationInformation { AccessType = $Node.AuthorizationInfoAccessType1 Users = $Node.AuthorizationInfoUsers2 Roles = '' Permissions = $Node.AuthorizationInfoPermissions3 }; - MSFT_xFTPAuthorizationInformation + MSFT_FTPAuthorizationInformation { AccessType = $Node.AuthorizationInfoAccessType2 Users = $Node.AuthorizationInfoUsers3 Roles = '' Permissions = $Node.AuthorizationInfoPermissions1 }; - MSFT_xFTPAuthorizationInformation + MSFT_FTPAuthorizationInformation { AccessType = $Node.AuthorizationInfoAccessType1 Users = '' Roles = $Node.AuthorizationInfoRoles Permissions = $Node.AuthorizationInfoPermissions1 }; - MSFT_xFTPAuthorizationInformation + MSFT_FTPAuthorizationInformation { AccessType = $Node.AuthorizationInfoAccessType2 Users = '' @@ -65,14 +65,14 @@ configuration MSFT_xFTP_Present Permissions = $Node.AuthorizationInfoPermissions2 }) BindingInfo = ` - MSFT_xFTPBindingInformation + MSFT_FTPBindingInformation { Protocol = $Node.BindingInfoProtocol Port = $Node.BindingInfoPort HostName = $Node.BindingInfoHostName } SslInfo = ` - MSFT_xFTPSslInformation + MSFT_FTPSslInformation { ControlChannelPolicy = $Node.SslInfoControlChannelPolicy DataChannelPolicy = $Node.SslInfoDataChannelPolicy @@ -100,17 +100,17 @@ configuration MSFT_xFTP_Present } } -configuration MSFT_xFTP_Absent +configuration MSFT_FTP_Absent { Import-DscResource -ModuleName xWebAdministration Node $AllNodes.NodeName { - xFTP FTP + FTP FTPSite { Ensure = 'Absent' - Name = $Node.Name + Name = $Node.Name } } diff --git a/Tests/Integration/MSFT_xFTP.config.psd1 b/Tests/Integration/MSFT_FTP.config.psd1 similarity index 100% rename from Tests/Integration/MSFT_xFTP.config.psd1 rename to Tests/Integration/MSFT_FTP.config.psd1 diff --git a/Tests/Unit/Helper.Tests.ps1 b/Tests/Unit/Helper.Tests.ps1 index 0748546f0..f51fae144 100644 --- a/Tests/Unit/Helper.Tests.ps1 +++ b/Tests/Unit/Helper.Tests.ps1 @@ -1369,7 +1369,7 @@ try Site = 'MockName' IisType = 'Ftp' AuthenticationInfo = ( - New-CimInstance -ClassName MSFT_xFTPAuthenticationInformation -ClientOnly ` + New-CimInstance -ClassName MSFT_FTPAuthenticationInformation -ClientOnly ` -Property @{Anonymous=$false;Basic=$true} ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ) @@ -1400,7 +1400,7 @@ try Site = 'MockName' IisType = 'Ftp' AuthenticationInfo = ( - New-CimInstance -ClassName MSFT_xFTPAuthenticationInformation -ClientOnly ` + New-CimInstance -ClassName MSFT_FTPAuthenticationInformation -ClientOnly ` -Property @{Anonymous=$true;Basic=$true} ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ) @@ -1501,7 +1501,7 @@ try -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' $ftpAuthenticationInfo = New-CimInstance ` - -ClassName MSFT_xFTPAuthenticationInformation ` + -ClassName MSFT_FTPAuthenticationInformation ` -ClientOnly -Property @{Anonymous=$true;Basic=$false} ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' @@ -1726,7 +1726,7 @@ try } @{ protocol = 'ftp' - className = 'MSFT_xFTPBindingInformation' + className = 'MSFT_FTPBindingInformation' } ) @@ -1809,7 +1809,7 @@ try Context 'Expected behaviour for FTP' { $MockBindingInfo = @( - New-CimInstance -ClassName MSFT_xFTPBindingInformation ` + New-CimInstance -ClassName MSFT_FTPBindingInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -2206,7 +2206,7 @@ try } @{ MockBindingInfo = @( - New-CimInstance -ClassName MSFT_xFTPBindingInformation ` + New-CimInstance -ClassName MSFT_FTPBindingInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -2382,7 +2382,7 @@ try } } BindingInfo = @( - New-CimInstance -ClassName MSFT_xFTPBindingInformation ` + New-CimInstance -ClassName MSFT_FTPBindingInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -2660,7 +2660,7 @@ try Describe "$DSCResourceName\Test-BindingInfo" { $ftpMockBindingInfo = New-CimInstance ` - -ClassName MSFT_xFTPBindingInformation ` + -ClassName MSFT_FTPBindingInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ diff --git a/Tests/Unit/MSFT_xFTP.tests.ps1 b/Tests/Unit/MSFT_FTP.tests.ps1 similarity index 97% rename from Tests/Unit/MSFT_xFTP.tests.ps1 rename to Tests/Unit/MSFT_FTP.tests.ps1 index a8bb42294..2d5e8ce5a 100644 --- a/Tests/Unit/MSFT_xFTP.tests.ps1 +++ b/Tests/Unit/MSFT_FTP.tests.ps1 @@ -1,5 +1,5 @@ $script:DSCModuleName = 'xWebAdministration' -$script:DSCResourceName = 'MSFT_xFTP' +$script:DSCResourceName = 'MSFT_FTP' $script:DSCHelperModuleName = 'Helper' #region HEADER @@ -21,7 +21,7 @@ try { #region Pester Tests InModuleScope -ModuleName $script:DSCResourceName -ScriptBlock { - $script:DSCResourceName = 'MSFT_xFTP' + $script:DSCResourceName = 'MSFT_FTP' $script:DSCHelperModuleName = 'Helper' Describe "how $DSCResourceName\Get-TargetResource responds" { @@ -35,7 +35,7 @@ try } $MockAuthenticationInfo = @( - New-CimInstance -ClassName MSFT_xFTPAuthenticationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthenticationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -45,7 +45,7 @@ try ) $MockAuthorizationInfo = @( - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -64,7 +64,7 @@ try ) $MockSslInfo = @( - New-CimInstance -ClassName MSFT_xFTPSslInformation ` + New-CimInstance -ClassName MSFT_FTPSslInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -337,7 +337,7 @@ try Describe "how $DSCResourceName\Test-TargetResource responds to Ensure = 'Present'" { $MockAuthenticationInfo = New-CimInstance ` - -ClassName MSFT_xFTPAuthenticationInformation ` + -ClassName MSFT_FTPAuthenticationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -346,7 +346,7 @@ try } $MockAuthorizationInfo = @( - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -358,7 +358,7 @@ try ) $MockBindingInfo = @( - New-CimInstance -ClassName MSFT_xFTPBindingInformation ` + New-CimInstance -ClassName MSFT_FTPBindingInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -369,7 +369,7 @@ try ) $MockSslInfo = New-CimInstance ` - -ClassName MSFT_xFTPSslInformation ` + -ClassName MSFT_FTPSslInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -942,7 +942,7 @@ try Describe "how $DSCResourceName\Set-TargetResource responds to Ensure = 'Present'" { $MockAuthenticationInfo = New-CimInstance ` - -ClassName MSFT_xFTPAuthenticationInformation ` + -ClassName MSFT_FTPAuthenticationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -951,7 +951,7 @@ try } $MockAuthorizationInfo = @( - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -963,7 +963,7 @@ try ) $MockBindingInfo = @( - New-CimInstance -ClassName MSFT_xFTPBindingInformation ` + New-CimInstance -ClassName MSFT_FTPBindingInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -974,7 +974,7 @@ try ) $MockSslInfo = New-CimInstance ` - -ClassName MSFT_xFTPSslInformation ` + -ClassName MSFT_FTPSslInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1026,7 +1026,7 @@ try } $DifferentMockAuthenticationInfo = New-CimInstance ` - -ClassName MSFT_xFTPAuthenticationInformation ` + -ClassName MSFT_FTPAuthenticationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1035,7 +1035,7 @@ try } $DifferentMockAuthorizationInfo = @( - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1047,7 +1047,7 @@ try ) $DifferentMockBindingInfo = @( - New-CimInstance -ClassName MSFT_xFTPBindingInformation ` + New-CimInstance -ClassName MSFT_FTPBindingInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1058,7 +1058,7 @@ try ) $DifferentMockSslInfo = New-CimInstance ` - -ClassName MSFT_xFTPSslInformation ` + -ClassName MSFT_FTPSslInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1392,7 +1392,7 @@ try ) $MockUserAuthorizationInfo = New-CimInstance ` - -ClassName MSFT_xFTPAuthorizationInformation ` + -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1403,7 +1403,7 @@ try } $MockGroupAuthorizationInfo = New-CimInstance ` - -ClassName MSFT_xFTPAuthorizationInformation ` + -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1467,7 +1467,7 @@ try Describe "how $DSCResourceName\Confirm-UniqueSslInfo responds" { $MockSslInfo = New-CimInstance ` - -ClassName MSFT_xFTPSslInformation ` + -ClassName MSFT_FTPSslInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1479,7 +1479,7 @@ try } $MockSslInfoSingle = New-CimInstance ` - -ClassName MSFT_xFTPSslInformation ` + -ClassName MSFT_FTPSslInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1790,7 +1790,7 @@ try Describe "how $DSCResourceName\Set-SslInfo responds" { $MockSslInfo = New-CimInstance ` - -ClassName MSFT_xFTPSslInformation ` + -ClassName MSFT_FTPSslInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1802,7 +1802,7 @@ try } $MockSslInfoSingle = New-CimInstance ` - -ClassName MSFT_xFTPSslInformation ` + -ClassName MSFT_FTPSslInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1840,7 +1840,7 @@ try $MockFtpSiteName = 'FTP' $MockAuthorizationInfo = @( - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1849,7 +1849,7 @@ try roles = 'Group1' permissions = 'Read' } - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1882,7 +1882,7 @@ try $MockFtpSiteName = 'FTP' $MockAuthorizationInfo = @( - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1891,7 +1891,7 @@ try roles = '' permissions = 'Read' } - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1900,7 +1900,7 @@ try roles = '' permissions = 'Write' } - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{ @@ -1909,7 +1909,7 @@ try roles = 'Group2' permissions = 'Read' } - New-CimInstance -ClassName MSFT_xFTPAuthorizationInformation ` + New-CimInstance -ClassName MSFT_FTPAuthorizationInformation ` -Namespace 'root/microsoft/Windows/DesiredStateConfiguration' ` -ClientOnly ` -Property @{