Skip to content
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

Ejm5204#602 Added SPWebAppGeneralSettings rule #630

Closed
wants to merge 8 commits into from
Closed
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
17 changes: 17 additions & 0 deletions DSCResources/Resources/Sharepoint.SPWebAppGeneralSettings.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

$rules = $stig.RuleList | Select-Rule -Type SharePoint_SPWebAppGeneralSettingsRule

foreach ($rule in $rules)
{
SharePoint_SPWebAppGeneralSettings (Get-ResourceTitle -Rule $rule)
{
Name = $rule.Name
Ensure = $rule.Ensure
WebAppUrl = $rule.WebAppUrl
BrowserFileHandling = $rule.BrowserFileHandling
SecurityValidationTimeOutMinutes = $rule.SecurityValidationTimeOutMinutes
AllowOnlineWebPartCatalog = $rule.AllowOnlineWebPartCatalog
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

@{

# Script module or binary module file associated with this manifest.
RootModule = 'SharePoint_SPWebAppGeneralSettings.schema.psm1'

# Version number of this module.
ModuleVersion = '4.0.0.0'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90'

# Author of this module
Author = 'Microsoft Corporation'

# Company or vendor of this module
CompanyName = 'Microsoft Corporation'

# Copyright statement for this module
Copyright = '(c) 2019 Microsoft Corporation. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Module for managing the SharePoint 2013 DISA STIGs'

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @('SharePoint_SPWebAppGeneralSettings')

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{
} # End of PSData hashtable

} # End of PrivateData hashtable

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

using module ..\helper.psm1
using module ..\..\PowerStig.psm1

<#
.SYNOPSIS
A composite DSC resource to manage the SharePoint STIG settings.
.PARAMETER SharePointVersion
The version of SharePoint being used E.g. 'Server2012'
.PARAMETER SharePointRole
There are two STIGs that cover the scope of SharePoint_ SharePoint Instance covers each instance of SharePoint on a server
SharePoint Database covers each Database within an Instance.
.PARAMETER StigVersion
The version of the SharePoint STIG to apply and/or monitor
.PARAMETER Exception
A hashtable of StigId=Value key pairs that are injected into the STIG data and applied to
the target node. The title of STIG settings are tagged with the text ‘Exception’ to identify
the exceptions to policy across the data center when you centralize DSC log collection.
.PARAMETER OrgSettings
The path to the xml file that contains the local organizations preferred settings for STIG
items that have allowable ranges. The OrgSettings parameter also accepts a hashtable for
values that need to be modified. When a hashtable is used, the specified values take
presidence over the values defined in the org.default.xml file.
.PARAMETER SkipRule
The SkipRule Node is injected into the STIG data and applied to the taget node. The title
of STIG settings are tagged with the text 'Skip' to identify the skips to policy across the
data center when you centralize DSC log collection.
.PARAMETER SkipRuleType
All STIG rule IDs of the specified type are collected in an array and passed to the Skip-Rule
function. Each rule follows the same process as the SkipRule parameter.
#>

configuration SharePoint_SPWebAppGeneralSettings
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[string]
$SharePointVersion,

[Parameter()]
[ValidateNotNullOrEmpty()]
[version]
$StigVersion,

[Parameter()]
[ValidateNotNullOrEmpty()]
[hashtable]
$Exception,

[Parameter()]
[ValidateNotNullOrEmpty()]
[object]
$OrgSettings,

[Parameter()]
[ValidateNotNullOrEmpty()]
[string[]]
$SkipRule,

[Parameter()]
[ValidateNotNullOrEmpty()]
[string[]]
$SkipRuleType
)

##### BEGIN DO NOT MODIFY #####
$stig = [STIG]::New('SharePoint_SPWebAppGeneralSettings', $SharePointVersion, $SharePointRole, $StigVersion)
$stig.LoadRules($OrgSettings, $Exception, $SkipRule, $SkipRuleType)
##### END DO NOT MODIFY #####

Import-DscResource -ModuleName SharePointDsc -ModuleVersion 4.0.0.0
. "$resourcePath\SharePointDsc.ps1"

}
81 changes: 81 additions & 0 deletions Module/Rule.SharePoint_SPWebAppGeneralSettings/Convert/Methods.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#region Method Functions

function Get-SharePoint_SPWebAppGeneralSettingsGetScript
{
[CmdletBinding()]
[OutputType([string])]
[CmdletBinding()]
param
(
[Parameter(Mandatory = $false)]
[AllowEmptyString()]
$CheckContent,

[Parameter(Mandatory = $false)]
[AllowEmptyString()]
$OrgSettings,

[Parameter(Mandatory = $false)]
[SecureString] $PSDscRunAsCredential
)



return
}

function Get-SharePoint_SPWebAppGeneralSettingsTestScript
{
[CmdletBinding()]
[OutputType([string])]
[CmdletBinding()]
param
(
[Parameter(Mandatory = $false)]
[AllowEmptyString()]
$CheckContent
)

return

}

function Get-SharePoint_SPWebAppGeneralSettingsSetScript
{
[CmdletBinding()]
[OutputType([string])]
[CmdletBinding()]
param
(
[Parameter()]
[AllowEmptyString()]
[string[]]
$FixText,

[Parameter(Mandatory = $false)]
[AllowEmptyString()]
$CheckContent
)

return
}

function Test-VariableRequired
{
[CmdletBinding()]
[OutputType([string])]
param
(
[Parameter(Mandatory = $true)]
[string]
$Rule
)

$requiresVariableList = @(
''
)

return ($Rule -in $requiresVariableList)
}
Loading