Skip to content

Commit

Permalink
various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Chubar authored and r-t-m committed May 20, 2019
1 parent a9e41c8 commit c93b1ed
Show file tree
Hide file tree
Showing 14 changed files with 6,714 additions and 6,739 deletions.
1,035 changes: 506 additions & 529 deletions DSCResources/Helper.psm1

Large diffs are not rendered by default.

1,640 changes: 882 additions & 758 deletions DSCResources/MSFT_xFTP/MSFT_xFTP.psm1

Large diffs are not rendered by default.

75 changes: 43 additions & 32 deletions DSCResources/MSFT_xFTP/MSFT_xFTP.schema.mof
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
[ClassVersion("1.0.0")]
class MSFT_xFTPAuthenticationInformation
{
[Write] Boolean Anonymous;
[Write] Boolean Basic;
};

[ClassVersion("1.0.0")]
class MSFT_xFTPAuthorizationInformation
[ClassVersion("2.0.0"), FriendlyName("xFTP")]
class MSFT_xFTP : OMI_BaseResource
{
[Write,ValueMap{"Allow", "Deny"},Values{"Allow", "Deny"}] String AccessType;
[Write] String Roles;
[Write,ValueMap{"Read", "Write", "Read,Write" },Values{"Read", "Write", "Read,Write"}] String Permissions;
[Write] String Users;
[Write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure;
[Key] 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, 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;
[Write, Description ("The message the FTP server displays when FTP clients have logged in to the FTP server")] String GreetingMessage;
[Write, Description ("The message the FTP server displays when FTP clients log off the FTP server")] String ExitMessage;
[Write, Description ("The message the FTP server displays when FTP clients first connect to the FTP server")] String BannerMessage;
[Write, Description ("The message when clients cannot connect because the FTP service has reached the maximum number of client connections allowed")] String MaxClientsMessage;
[Write, Description ("Whether to display the default identification banner for the FTP server")] Boolean SuppressDefaultBanner;
[Write, Description ("Whether to display detailed error messages on the local host")] Boolean AllowLocalDetailedErrors;
[Write, Description ("Whether to display a specific set of user variables in FTP messages")] Boolean ExpandVariablesInMessages;
[Write, Description ("The directory to be used for logfiles")] String LogPath;
[Write, Description ("The W3C logging fields"), ValueMap{"Date","Time","ClientIP","UserName","ServerIP","Method","UriStem","UriQuery","HttpStatus","Win32Status","TimeTaken","ServerPort","UserAgent","Referer","HttpSubStatus"},Values{"Date","Time","ClientIP","UserName","ServerIP","Method","UriStem","UriQuery","HttpStatus","Win32Status","TimeTaken","ServerPort","UserAgent","Referer","HttpSubStatus"}] String LogFlags[];
[Write, Description ("How often the log file should rollover"), ValueMap{"Hourly","Daily","Weekly","Monthly","MaxSize"},Values{"Hourly","Daily","Weekly","Monthly","MaxSize"}] String LogPeriod;
[Write, Description ("How large the file should be before it is truncated")] String LogTruncateSize;
[Write, Description ("Use the localtime for file naming and rollover")] Boolean LoglocalTimeRollover;
[Write, Description ("What method of Directory Browsing should be enabled"), ValueMap{"StyleUnix","LongDate","DisplayAvailableBytes","DisplayVirtualDirectories"},Values{"StyleUnix","LongDate","DisplayAvailableBytes","DisplayVirtualDirectories"}] String DirectoryBrowseFlags[];
[Write, Description ("What method of UserIsolation should be enabled"), ValueMap{"None","StartInUsersDirectory","IsolateAllDirectories","IsolateRootDirectoryOnly"},Values{"None","StartInUsersDirectory","IsolateAllDirectories","IsolateRootDirectoryOnly"}] String UserIsolation;
};

[ClassVersion("1.0.0")]
Expand All @@ -20,7 +36,7 @@ class MSFT_xFTPSslInformation
[Write,ValueMap{"SslAllow", "SslRequire", "SslRequireCredentialsOnly"},Values{"SslAllow", "SslRequire", "SslRequireCredentialsOnly"}] String ControlChannelPolicy;
[Write,ValueMap{"SslAllow", "SslRequire", "SslDeny"},Values{"SslAllow", "SslRequire", "SslDeny"}] String DataChannelPolicy;
[Write] Boolean RequireSsl128;
[Write] String CertificateHash;
[Write] String CertificateThumbprint;
[Write,ValueMap{"My", "WebHosting"},Values{"My", "WebHosting"}] String CertificateStoreName;
};

Expand All @@ -34,23 +50,18 @@ class MSFT_xFTPBindingInformation
[Write] String HostName;
};

[ClassVersion("2.0.0"), FriendlyName("xFTP")]
class MSFT_xFTP : OMI_BaseResource
[ClassVersion("1.0.0")]
class MSFT_xFTPAuthorizationInformation
{
[Write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure;
[Key] String Name;
[Write] String PhysicalPath;
[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, CertificateHash, CertificateStoreName)")] String SslInfo;
[Write, Description ("The directory to be used for logfiles")] String LogPath;
[Write, Description ("The W3C logging fields"), ValueMap{"Date","Time","ClientIP","UserName","ServerIP","Method","UriStem","UriQuery","HttpStatus","Win32Status","TimeTaken","ServerPort","UserAgent","Referer","HttpSubStatus"},Values{"Date","Time","ClientIP","UserName","ServerIP","Method","UriStem","UriQuery","HttpStatus","Win32Status","TimeTaken","ServerPort","UserAgent","Referer","HttpSubStatus"}] String LogFlags[];
[Write, Description ("How often the log file should rollover"), ValueMap{"Hourly","Daily","Weekly","Monthly","MaxSize"},Values{"Hourly","Daily","Weekly","Monthly","MaxSize"}] String LogPeriod;
[Write, Description ("How large the file should be before it is truncated")] String LogTruncateSize;
[Write, Description ("Use the localtime for file naming and rollover")] Boolean LoglocalTimeRollover;
[Write, Description ("What method of Directory Browsing should be enabled"), ValueMap{"StyleUnix","LongDate","DisplayAvailableBytes","DisplayVirtualDirectories"},Values{"StyleUnix","LongDate","DisplayAvailableBytes","DisplayVirtualDirectories"}] String DirectoryBrowseFlags[];
[Write, Description ("What method of UserIsolation should be enabled"), ValueMap{"None","StartInUsersDirectory","IsolateAllDirectories","IsolateRootDirectoryOnly"},Values{"None","StartInUsersDirectory","IsolateAllDirectories","IsolateRootDirectoryOnly"}] String UserIsolation;
[Write,ValueMap{"Allow", "Deny"},Values{"Allow", "Deny"}] String AccessType;
[Write] String Roles;
[Write,ValueMap{"Read", "Write", "Read,Write" },Values{"Read", "Write", "Read,Write"}] String Permissions;
[Write] String Users;
};

[ClassVersion("1.0.0")]
class MSFT_xFTPAuthenticationInformation
{
[Write] Boolean Anonymous;
[Write] Boolean Basic;
};
42 changes: 10 additions & 32 deletions DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ data LocalizedData
{
# culture="en-US"
ConvertFrom-StringData -StringData @'
ErrorWebApplicationTestAutoStartProviderFailure = Desired AutoStartProvider is not valid due to a conflicting Global Property. Ensure that the serviceAutoStartProvider is a unique key.
VerboseGetTargetResource = Get-TargetResource has been run.
VerboseSetTargetAbsent = Removing existing Web Application "{0}".
VerboseSetTargetPresent = Creating new Web application "{0}".
Expand All @@ -27,7 +26,6 @@ data LocalizedData
VerboseTestTargetFalseAuthenticationInfo = AuthenticationInfo for web application "{0}" is not in the desired state.
VerboseTestTargetFalsePreload = Preload for web application "{0}" is not in the desired state.
VerboseTestTargetFalseAutostart = Autostart for web application "{0}" is not in the desired state.
VerboseTestTargetFalseAutoStartProviders = AutoStartProviders for web application "{0}" are not in the desired state.
VerboseTestTargetFalseIISAutoStartProviders = AutoStartProviders for IIS are not in the desired state.
VerboseTestTargetFalseWebApplicationAutoStartProviders = AutoStartProviders for web application "{0}" are not in the desired state.
VerboseTestTargetFalseEnabledProtocols = EnabledProtocols for web application "{0}" are not in the desired state.
Expand Down Expand Up @@ -61,7 +59,7 @@ function Get-TargetResource

$name = Get-WebApplicationNameFixed -Name $Name
$webApplication = Get-WebApplication -Site $Website -Name $name
$CimAuthentication = Get-AuthenticationInfo -Site $Website -Application $name
$CimAuthentication = Get-AuthenticationInfo -Site $Website -Application $name -IisType 'Application'
$CurrentSslFlags = (Get-SslFlags -Location "${Website}/${name}")

$Ensure = 'Absent'
Expand Down Expand Up @@ -144,9 +142,9 @@ function Set-TargetResource
{
$webApplication = Get-WebApplication -Site $Website -Name $Name

if ($AuthenticationInfo -eq $null)
if ($null -eq $AuthenticationInfo)
{
$AuthenticationInfo = Get-DefaultAuthenticationInfo
$AuthenticationInfo = Get-DefaultAuthenticationInfo -IisType 'Application'
}

if ($webApplication.count -eq 0)
Expand Down Expand Up @@ -199,12 +197,11 @@ function Set-TargetResource
Set-WebConfigurationProperty @params
}

# Set Authentication; if not defined then pass in DefaultAuthenticationInfo
if ($PSBoundParameters.ContainsKey('AuthenticationInfo') -and `
(-not (Test-AuthenticationInfo -Site $Website `
# Set Authentication; if not defined then pass in Default AuthenticationInfo
if (-not (Test-AuthenticationInfo -Site $Website `
-Application $Name `
-IisType 'Application' `
-AuthenticationInfo $AuthenticationInfo)))
-AuthenticationInfo $AuthenticationInfo))
{
Write-Verbose -Message ($LocalizedData.VerboseSetTargetAuthenticationInfo -f $Name)
Set-AuthenticationInfo -Site $Website `
Expand All @@ -213,23 +210,6 @@ function Set-TargetResource
-AuthenticationInfo $AuthenticationInfo `
-ErrorAction Stop `
}
$DefaultAuthenticationInfo = Get-DefaultAuthenticationInfo -IisType 'Application'
if($null -eq $PSBoundParameters.ContainsKey('AuthenticationInfo') -and `
(-not (Test-AuthenticationInfo `
-Site $Website `
-Application $Name `
-IisType 'Application' `
-AuthenticationInfo $DefaultAuthenticationInfo)))
{
$AuthenticationInfo = Get-DefaultAuthenticationInfo -IisType 'Application'
Write-Verbose -Message ($LocalizedData.VerboseSetTargetAuthenticationInfo `
-f $Name)
Set-AuthenticationInfo -Site $Website `
-Application $Name `
-IisType 'Application' `
-AuthenticationInfo $DefaultAuthenticationInfo `
-ErrorAction Stop `
}

# Update Preload if required
if ($PSBoundParameters.ContainsKey('preloadEnabled') -and `
Expand Down Expand Up @@ -296,7 +276,6 @@ function Set-TargetResource
Write-Verbose -Message ($LocalizedData.VerboseSetTargetAbsent -f $Name)
Remove-WebApplication -Site $Website -Name $Name
}

}

<#
Expand Down Expand Up @@ -352,7 +331,7 @@ function Test-TargetResource

$webApplication = Get-WebApplication -Site $Website -Name $Name

if ($AuthenticationInfo -eq $null)
if ($null -eq $AuthenticationInfo)
{
$AuthenticationInfo = Get-DefaultAuthenticationInfo -IisType 'Application'
}
Expand Down Expand Up @@ -394,11 +373,10 @@ function Test-TargetResource
}

#Check AuthenticationInfo
if ($PSBoundParameters.ContainsKey('AuthenticationInfo') -and `
(-not (Test-AuthenticationInfo -Site $Website `
if (-not (Test-AuthenticationInfo -Site $Website `
-Application $Name `
-IisType 'Application' `
-AuthenticationInfo $AuthenticationInfo)))
-AuthenticationInfo $AuthenticationInfo))
{
Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseAuthenticationInfo -f $Name)
return $false
Expand Down Expand Up @@ -436,7 +414,7 @@ function Test-TargetResource
return $false
}

# Update EnabledProtocols if required
#Update EnabledProtocols if required
if ($PSBoundParameters.ContainsKey('EnabledProtocols') -and `
(-not(Confirm-UniqueEnabledProtocols `
-ExistingProtocols $webApplication.EnabledProtocols `
Expand Down
Loading

0 comments on commit c93b1ed

Please sign in to comment.