Home

Awesome

windows-hardening (Ansible Role)

Attention: This role has been migrated to our hardening-collection:

Please open any issues and pull requests there!

Requirements

Variables

NameDefault ValueDescription
win_security_PasswordComplexity1Flag that indicates whether the operating system MUST require that passwords meet complexity requirements. Default: True
win_security_LockoutBadCount4Number of failed logon attempts after which a user account MUST be locked out. Default: 4
win_security_ResetLockoutCount15Number of minutes after a failed logon attempt that the account MUST be locked out. Default: 15 minutes
win_security_LockoutDuration15The number of minutes that a locked-out account MUST remain locked out before automatically becoming unlocked. Default: 15 minutes
win_security_SeRemoteInteractiveLogonRight*S-1-5-32-544Determines which users or groups can access the logon screen of a remote computer through a RDP connection. Default: Administrators
win_security_SeTcbPrivilege*S-1-0-0Allows a process to authenticate like a user and thus gain access to the same resources as a user. Default: Nobody
win_security_SeMachineAccountPrivilege*S-1-5-32-544Allows the user to add a computer to a specific domain. Default: Administrators
win_security_SeTrustedCredManAccessPrivilege``Access Credential Manager as a trusted caller policy setting is used by Credential Manager during backup and restore. Default: No One
win_security_SeNetworkLogonRight*S-1-0-0Required for an account to log on using the network logon type. Default: Nobody

Example Playbook

    - hosts: localhost
      roles:
        - dev-sec.windows-hardening

Local Testing

For all our tests we use test-kitchen. If you are not familiar with test-kitchen please have a look at their guide.

We create multiple hosts - one linux host where Ansible runs on and the Windows hosts.

Next install test-kitchen:

# Install dependencies
gem install bundler
bundle install

Then you can run the playbook and tests:

# create the ansible and windows hosts
bundle exec kitchen create

# run ansible playbook on windows host
bundle exec kitchen converge default-ansibleserver

# verify windows machines
bundle exec kitchen verify windows

Contributing

See contributor guideline.

License and Author

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.