Book Image

Windows Server Security Essentials

Book Image

Windows Server Security Essentials

Overview of this book

Table of Contents (16 chapters)
Getting Started with Windows Server Security
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Baseline and security


According to its definition, baseline is something you can measure all the time and compare it to identify the difference between the current state and the starting point. In general, the business and technical requirements reflect the core of a baseline policy. It can also be a combination of your business requirements and industry-best practices. As a security administrator, your job is to translate these polices into a technical policy that you can apply in your IT environment.

Different companies and industries follow different standards and policies to secure their IT infrastructure. The following are some of the popular standards that are widely used in the industry:

The details of these agencies and their recommendations can be reviewed on their websites.

Out of the box, Windows Server 2012 and higher provides a few security tools that can be used as a starting point for your Windows Server security configuration. We will start this journey with a built-in security tool called Microsoft Security Configuration Wizard (SCW). This is a very powerful role-based tool that is included with Windows Server 2012 or higher. You can easily translate your business security policies into a technical policy using this tool. As a first step, you need to define your business security requirements or policies. Once you have that documented, you can use Microsoft SCW to create a policy template for different types of servers. In general, these business security requirements can be achieved by disabling unwanted services, blocking unused ports, modifying registry settings, and restricting network and server access. In other words, Microsoft SCW will help you to identify minimum functionality requirements for a server-based on an installed role or service on that particular server. Then this policy can be applied to a server or set of servers using Microsoft SCW, or any other mechanisms like Group Policy Objects (GPOs).

The following is a five-step process to get you to implement the policy in an efficient manner:

  1. Define your business security policy.

  2. Translate it into a technical policy.

  3. Create a policy template using a tool.

  4. Policy review and validation.

  5. Policy implementation.

Security Configuration Wizard

The Microsoft Security Configuration Wizard tool has four major sections: Role-Based Service Configuration, Network Security, Registry Settings, and Auditing Policy. Each of these sections has sub-categories to address specific service requests, based on the top level category. The following table provides a high-level explanation of the available options inside Microsoft SCW:

Role-Based Service Configuration

Server role

This section provides an option to select or deselect appropriate roles based on your requirements. SCW will automatically detect installed roles on the server. All the dependent roles will also be selected automatically.

Client features

In this section, you can select client features that are specific for the role you have chosen in the previous step.

Administration option

Provides an option to select different administration tools and options.

Additional services

By default, SCW will select all required service-based roles, features, and administrative options. This section will give you an option to review these configurations and to make changes if needed.

Handling unwanted services

In this section, you will have an option to select unidentified services. SCW will not display services if they are not present in the local system.

Network Security

Network security rules

In this section, you can select firewall rules, traffic types, ports, and so on.

Registry Settings

SMB security setting

Provides an option to enable or disable SMB security signing.

LDAP Signing requirement

If the Domain Controller role is selected, you will see an option to configure LDAP signing.

Outbound Authentication methods

This section provides an option to configure remote computer authentication methods. You will have an option to select either domain account or local account.

Auditing Policy

System Audit Policy

This section provides an option to enable or disable auditing on a selected server.

Since creating a business security policy is beyond the scope of this book, my assumption would be that you have a business security policy already defined and in place. So we will be starting with the Translating your policy into a technical policy section.

Translating your policy into a technical policy

In this stage, as a security administrator, your job is to convert the existing business security policy into a technical policy. Since we are planning to use Microsoft SCW for this exercise, we can map our policy directly into an SCW policy.

I always use a worksheet to map these policies so as to make sure they align with existing options in the tool. The following is a sample worksheet. It helps an administrator identify the policies that are available in SCW and map them accordingly. On the left side of the worksheet, we have Business Security Policy. They directly come from the business or service owners. On the center of the worksheet, we have Technical Policy; in this case, I have included all available SCW roles and services in this section. The right column, Comments, is for mentioning any additional steps or comments required to complete the task.

As an example, you can see a sample internal portal server policy in the following worksheet where I have mapped a Business Security Policy to a Technical Policy:

Business Security Policy

 

Technical Policy

Comments

 

Role-Based Service Configuration (SCW)

It must be a dedicated server for the proposed application. All other non-dependent services must be disabled.

 

Server role

Review #4 and #5 as well.

Required client features must be running on the server to support the application.

 

Client features

 

Administrators must be able to remotely administer the server, IIS task scheduler, WMI, and log files.

 

Administration option

 

Custom monitoring service (InfraMon) must be enabled and running on all servers.

 

Additional services

 

All unwanted and non-dependent services must be disabled.

 

Handling unwanted services

 
 

Network Security (SCW)

Only HTTP port 80 and 443 allowed to this server. All other non-dependent ports and services must be disabled.

 

Network security rules

 
 

Registry Settings (SCW)

Client computers must be running Windows 7 or higher to access this application.

 

SMB security setting

 
  

LDAP Signing requirement

 

Only domain users can access this application.

 

Outbound Authentication methods

 
 

Auditing Policy (SCW)

Successful and failed login attempts must be audited and saved.

 

System Audit Policy

 
 

Testing (SCW)

Solution must be tested and evaluated in the lab before implementing in production.

  

Test the security policy in the lab using SCW.

 

Implementation (GPO)

Solution must be deployed using an automated mechanism. It must be transparent to the application developers and owners.

  

Export security policy and GPO and implement it in the correct OU.

 

Rollback Plan (GPO)

Must be able to roll back to previous state if/as needed.

  

Use GPO.

In the preceding exercise, we had a perfect one-to-one matching between Security Business Policy and SCW options, but in the real world, it may be different. So you may need to modify the policy worksheet based on your requirements. If the options are not available in SCW, you may need to configure it manually using GPO or other mechanisms.

Creating a policy template

In order to generate a policy template, you must be a local administrator on the server. SCW can be run from a local server or from a remote server. If you are running SCW from a remote server, you need to make sure that the required ports and firewall rules are enabled on this remote server. By default, SCW tries to establish an admin$ share connection to the remote server. Perform the following steps:

  1. Open Server Manager. You can open Server Manager from the status bar, or by typing Server Manager in the Windows Start screen.

  2. From the Tools menu, select the Security Configuration Wizard option.

    Selecting the Security Configuration Wizard option

  3. Click on Next on the Welcome to the Security Configuration Wizard page.

  4. Select the Create a new security policy option on the Configuration Action page. Click on Next.

  5. On the Select Server page, enter the server name in the Server textbox, or click on the Browse button to search for a server from the Active Directory. This server will be used to create a baseline policy based on the roles and features installed on this server.

  6. If you specify a remote server, and the current logged-in user does not have local administrative permissions on the remote server, you can specify an alternate account using the Specify User Account… option. Click on Next.

  7. SCW analyzes the remote server and updates the configuration database based on the installed role and features on the selected server. You can see the details by selecting the View Configuration Database option from the Processing Security Configuration Database page:

    • The View Configuration Database option opens the SCW Viewer window to display the configuration database.

    • If you see Windows Security Warning for the ActiveX control, select Yes to continue the operation.

    • The Security Configuration Database option has five different sections—Server Roles, Client Features, Administration and Other Options, Services, and Windows Firewall. You will be evaluating and modifying these settings based on your business security policy requirement.

    • You can safely close the SCW Viewer window without interrupting any other tasks.

    • Click on Next to continue.

  8. Click on Next on the Role-Based Service Configuration page.

  9. In the Select Server Roles window:

    • From the View drop-down box, you can select All roles, Installed Roles, Uninstalled Roles, or Select Roles. Since we are creating a baseline policy based on an install role, we will select Installed Roles.

      Note

      If the required roles are not installed on the server, you can add these roles from Server Manager by selecting the Add roles and features option. All required roles must be installed prior to creating a baseline policy.

    • You will notice that some of the roles are selected by default. These are some of the required or dependent components for successful creation, implementation, and rollback of these policies.

    • Select the appropriate roles here. As an example, I am selecting the Web Server role here.

    • Click on Next to continue.

  10. On the Select Client Features page, select the appropriate client features based on your security requirements. Click on Next.

  11. On the Select Administrative and Other Options page, select the appropriate options based on your security policy requirement. Click on Next.

  12. As an example, in this exercise, I will be selecting the following administrative options:

    • Remote Windows Administration.

    • Also, you will see a few new options based on the selected roles and features on the previous page.

    • Select Web Server options from the View drop-down menu.

    • Here, I am using my worksheet as an example. Based on the requirement, we need to have remote administration enabled. So, I will be selecting the Remote Administration for Web Server (IIS) option.

    • Click on Next.

  13. On the Select Additional Services page, select the additional services based on your requirement. According to my security policy requirement, "A custom monitoring service (InfraMon) must be enabled and running on all servers." As shown in the following screenshot, you will have an option to select or deselect additional services from this window. Click on Next.

  14. On the Handling Unspecified Service page, select the appropriate option based on your security policy requirement. Unspecified services are services that are not part of the default configuration database. Since they are unknown to the SCW application, and may be a security threat, you will be presented with the following two options:

    • Do not change the startup mode of the service: This will leave the existing startup mode (Automatic, Manual, and so on) of the services intact.

    • Disable the service: If you are not sure about the listed service, you can use the Disable the service option to disable these types of services at operating system startup.

    • Once you complete the configuration, you can click on Next to proceed to the next step in the process.

  15. You can confirm these settings on the Confirm Service Changes window. Click on Next.

  16. Click on Next to continue with network security configuration, from the Network Security window. If you do not have a network security requirement, you can skip this configuration using the Skip this section option.

  17. In the Network Security Rules window, select the appropriate firewall rules. For example, if you need to modify the HTTP traffic rule, you can:

    • Select the World Wide Web Services (HTTP Traffic-In) rule.

    • Select Edit to edit an existing policy or Add to add a custom policy.

  18. On the Add or Edit rule window, you have the following tabs:

    • Program and Services: Enable or disable services and programs

    • Protocols and Ports: Enable or disable ports and protocols

    • Scope: Restrict IP address traffic based on selected IP address range

    • Click on Next.

  19. Click on Next to continue with registry security configuration, from the Registry Security window.

  20. If you don't have a registry security requirement, you can skip this configuration using the Skip this section option.

  21. On the Require SMB Security Signatures page, select the appropriate options based on your security policy requirement.

  22. Click on Next

  23. On the Outbound Authentication Methods page, select the appropriate options. Click on Next.

  24. On the Outbound Authentication using Domain Account page, select the appropriate options based on your security requirement. The following are the available options:

    • Windows NT 4.0 Service Pack 6a or later operating system

    • Clock that is synchronized with the select server's clock

  25. Click on Next.

  26. On the Registry Setting Summary page, review the selected settings and click on Next to continue.

  27. Select Next to continue with audit policy configuration from the Audit Policy window:

    • If you don't have auditing requirements, you can skip this configuration using the Skip this section option, or you can configure the auditing by selecting the options from the System Audit Policy page. As an example, I will be selecting the Audit successful and unsuccessful activities option.

    • Click on Next.

  28. On the Audit Policy Summary page, review the selected settings and click on Next to continue.

  29. Click on Next on the Save Security Policy page.

  30. On the Security Policy File Name page, enter the Name and Description values for the policy. Click on Next.

  31. Select the Apply Later option on the Apply Security Policy page.

  32. Click on Finish on the Completing the Security Configuration Wizard page.

    Note

    By default, all the polices will be saved in the %Systemroot%\Security\MSSCW\Policies folder.

Policy review and validation

At this point, you have created a baseline security template based on your business security requirement. As always, it is a best practice to evaluate these configurations in an isolated lab environment before it is implemented in the production environment.

Microsoft SCW creates an XML file as an output policy file, which can be reviewed by using any XML reader. Microsoft has provided a command-line supplement SCW tool called SCWCMD to accomplish this. SCWCMD is a powerful tool that can support the following actions:

  • SCWCMD analyze: Analyzes the computer based on your security policy

  • SCWCMD configure: Applies SCW security to a computer

  • SCWCMD register: This updates the SCW database based on your custom roles and features

  • SCWCMD rollback: This will roll back the policies from the previously applied computer

  • SCWCMD transform: This converts an SCW-generated policy to a GPO-based policy

  • SCWCMD view: This views the existing SCW policy

We will be using the SCWCMD tool with view option for our policy review and validation process:

  • From the command prompt, enter the following command:

    SCWCMD view /x:WebServerBaseLineV1.0.xml
    
  • It will open SCW Viewer. Click on Yes to access Windows Security Warning. You should be able to review the policy settings from SCW Viewer.

Once you have verified the settings, you can apply it to one server to evaluate the result. We will be using Security Configuration Wizard (SCW) to achieve this:

  1. Open Security Configuration Wizard (SCW) from Server Manager.

  2. Click on Next in the Welcome window.

  3. In the Configuration Action window, select the Apply an existing security policy option.

  4. In the Existing security policy file window, select the previously created policy file.

  5. Click on Next.

  6. In the Select Server window, select the correct destination server. Click on Next.

  7. You can view the policy detail in the Apply Security Policy window. Click on Next to continue.

At this point, as an administrator, your job is to validate and verify the result. Once you are satisfied with the result, you can move to the production implementation.

Policy implementation

Applying a policy using Microsoft SCW is suitable for a small environment or testing purposes. However, in an enterprise environment, it may not be sufficient. Some type of automated mechanism should be in place. Since Microsoft Group Policy Object (GPO) is a commonly used tool in any environment, we can use GPO to deploy these security configurations into the designated servers. Since Microsoft SCW and Microsoft GPO are not directly connected, the first step in the process is to export output of the SCW XML file into the GPO format, and then import this into Active Directory.

In our scenario, we will be using the SCWCMD Transform command with the syntax scwcmd transform /p:<SCWPolicy.xml> /g:<GPOName>:

  1. Open the command line from your Windows Server 2012 server.

  2. Type scwcmd transform /p:WebServerBaseLineV1.0.XML /g:WebServerBaselineV1.0 and press Enter.

  3. This will convert and export the policy into Active Directory.

  4. Open Group Policy Manager Console. You can open it from Server Manager or type Group Policy Manager on the start screen.

  5. Expand your Domain, Domain Name, and then Group Policy Objects nodes. The exported policy will be in the Group Policy Objects node.

  6. The GPO configuration can be verified by evaluating the policies in the Settings tab.

  7. Once you are satisfied with the policy, it can be deployed (linked) to an existing Organizational Unit (OU). In this scenario, we will be linking it to an OU called InternalWebServers.

    Note

    Keep in mind that the SCWCMD Trasnform command will only export the polices into Active Directory. You need to manually link these GPO, using Group Policy Administration console.

  8. Locate the correct OU by expanding the top level OU. In this scenario, I will be selecting the InternalWebServers OU.

  9. Right-click on the InternalWebServers OU and select the Link an Existing GPO option.

  10. Select the WebServerBaseLiveV1.0 GPO from the Select GPO window. Click on OK.

  11. This will link the existing GPO to this OU and all severs inside this OU will automatically receive the policy.

Note

The GPO will get updated on to these computers during the default GPO interval. However, you can force the update manually by using the GPUpdate/Force command, or by selecting the Group Policy Update option from the GPMC console.

Analyzing the result and troubleshooting

The SCWCMD tool provides an option to troubleshoot the computers so as to ensure that these computers are in compliance with your security policy. We will be using the SCWCMD Analyze option to analyze a computer's existing policy against an implemented policy. We can use this command against any computer regardless of whether you have used SCW or GPO to implement these policies. The result will be saved in an XML file in the working directory, unless you have specified a different path. These files can be viewed using the SCWCMD View option.

Here, I am running the SCWCMD Analyze command against a non-hardening server to demonstrate the result:

  1. From the command prompt, enter the SCWCMD Analyze /m:Server02 /p:WebServerBaseLineV1.0.XML command.

  2. The output will be saved in the same directory and the default filename will be the server name. In this scenario, it will be called Server02.XML.

  3. The SCWCMD view command can be used to view this file. This command will open the result file in SCW Viewer.

  4. From the command prompt, enter SCWCMD View /x:Server02.XML.

  5. If you receive an Active X Windows Security Warning, click on Yes to continue.

  6. Depending on the policy and configuration of the server, you will see different listings such as Misconfigured Services, Rules are not on the system, and the like on the Security Configuration Wizard Analysis Results window.

A backup or rollback plan

A backup or rollback plan is important for any business. Microsoft SCW provides an easy method to revert the changes to its previous state. During the policy implementation, SCW will create the rollback files on the local server with the current configuration. These are XML files and are located in %systemdir%\security\msscw\rollbackfiles folder.

Note

Rollback files are located on the local server itself.

If the rollback files are not available in the default folder, you will receive the following error message during the server selection:

Once you perform the rollback operation, the XML files get deleted from the rollbackfiles folder. So, if you want to keep a record of these policies and settings, you will need to back up these files before performing the rollback operation.

Note

Microsoft SCW can only roll back the changes that have been applied by the SCW tool. If you use any other mechanisms like GPO, SCW won't be able to revert these changes.

If you use GPO to implement the policy, you can move these servers to a different OU to avoid applying these policies. Keep in mind that some policies are tattooed into the system. In that case, you need to create another GPO to revert these changes.

The following instructions provide the details of a rollback method using SCW"

  1. Open Security Configuration Wizard from Server Manager.

  2. Click on Next in the Welcome window.

  3. From the Configuration Action window, select the Rollback the last applied security policy option. Click on Next.

  4. In the Select Server window, select the appropriate server name. Click on Next.

  5. In the Rollback Security Configuration window, you can click on View Rollback File to verify the rollback details. It will open SCW Viewer. Click on Next to continue with the rollback operation.

  6. You will see the status and progress in the next screen. Click on Next.

  7. Click on Finish on the Completing the Security Configuration Wizard screen to complete the rollback operation.