- Notifications
You must be signed in to change notification settings - Fork269
Development repository for Chef Cookbook windows
License
chef-boneyard/windows
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Provides a set of Windows-specific resources to aid in the creation of cookbooks/recipes targeting the Windows platform.
This cookbook is no longer required for managing Windows nodes with Chef Infra. The necessary resources and helpers are now built into Chef Infra Client itself. These built-in resources are more feature rich and execute faster.
- Windows 7 (EOL)
- Windows Server 2008 R2 (EOL)
- Windows 8, 8.1
- Windows Server 2012 (R1, R2)
- Windows Server 2016
- Chef 14.7+
Binds a certificate to an HTTP port to enable TLS communication.
:create
- creates or updates a binding.:delete
- deletes a binding.
cert_name
- name attribute. The thumbprint(hash) or subject that identifies the certificate to be bound.name_kind
- indicates the type of cert_name. One of :subject (default) or :hash.address
- the address to bind against. Default is 0.0.0.0 (all IP addresses). One of:- IP v4 address
1.2.3.4
- IP v6 address
[::1]
- Host name
www.foo.com
- IP v4 address
port
- the port to bind against. Default is 443.app_id
- the GUID that defines the application that owns the binding. Default is the values used by IIS.store_name
- the store to locate the certificate in. One of:- MY (Personal)
- CA (Intermediate Certification Authorities)
- ROOT (Trusted Root Certification Authorities)
- TRUSTEDPUBLISHER (Trusted Publishers)
- CLIENTAUTHISSUER (Client Authentication Issuers)
- REMOTE DESKTOP (Remote Desktop)
- TRUSTEDDEVICES (Trusted Devices)
- WEBHOSTING (Web Hosting)
- AUTHROOT (Third-Party Root Certification Authorities)
- TRUSTEDPEOPLE (Trusted People)
- SMARTCARDROOT (Smart Card Trusted Roots)
- TRUST (Enterprise Trust)
# Bind the first certificate matching the subject to the default TLS portwindows_certificate_binding"me.acme.com"doend
# Bind a cert from the CA store with the given hash to port 4334windows_certificate_binding"me.acme.com"docert_name"d234567890a23f567c901e345bc8901d34567890"name_kind:hashstore_name"CA"port4334end
Note
: This resource is now included in Chef 15 and later. If you are using newer versions ofwindows then should use the coreresource instead of windows_dns.
Configures A and CNAME records in Windows DNS. This requires the DNSCMD to be installed, which is done by adding the DNS role to the server or installing the Remote Server Admin Tools.
- :create: creates/updates the DNS entry
- :delete: deletes the DNS entry
- host_name: name attribute. FQDN of the entry to act on.
- dns_server: the DNS server to update. Default is local machine (.)
- record_type: the type of record to create. One of A (default) or CNAME
- target: for A records an array of IP addresses to associate with the host; for CNAME records the FQDN of the host to alias
- ttl: if > 0 then set the time to live of the record
# Create A record linked to 2 addresses with a 10 minute ttlwindows_dns"m1.chef.test"dotarget['10.9.8.7','1.2.3.4']ttl600end
# Delete records. target is mandatory although not usedwindows_dns"m1.chef.test"doaction:deletetarget[]end
# Set an alias against the node in a rolenodes=search(:node,"role:my_service")windows_dns"myservice.chef.test"dorecord_type'CNAME'targetnodes[0]['fqdn']end
Sets the Access Control List for an http URL to grant non-admin accounts permission to open HTTP endpoints.
:create
- creates or updates the ACL for a URL.:delete
- deletes the ACL from a URL.
url
- the name of the url to be created/deleted.sddl
- the DACL string configuring all permissions to URL. Mandatory for create if user is not provided. Can't be use withuser
.user
- the name (domain\user) of the user or group to be granted permission to the URL. Mandatory for create if sddl is not provided. Can't be use withsddl
. Only one user or group can be granted permission so this replaces any previously defined entry. If you receive a parameter error your user may not exist.
windows_http_acl'http://+:50051/'douser'pc\\fred'end
# Grant access to users "NT SERVICE\WinRM" and "NT SERVICE\Wecsvc" via sddlwindows_http_acl'http://+:5985/'dosddl'D:(A;;GX;;;S-1-5-80-569256582-2953403351-2909559716-1301513147-412116970)(A;;GX;;;S-1-5-80-4059739203-877974739-1245631912-527174227-2996563517)'end
windows_http_acl'http://+:50051/'doaction:deleteend
Used to configure the schannel security settings in windows, this is used by dotnet apps and PowerShell to be able to speak to tls 1.2 endpoints
configure
: Configures the setting
property | type | default | description |
---|---|---|---|
use_strong_crypto | True, False | true | Enables or disables the setting |
Adds theprincipal
(User/Group) to the specified privileges (such asLogon as a batch job
orLogon as a Service
).
:add
- add the specified privileges to theprincipal
:remove
- remove the specified privilege of theprincipal
principal
- Name attribute, Required, String. The user or group to be granted privileges.privilege
- Required, String/Array. The privilege(s) to be granted.
Grant the Administrator user theLogon as a batch job
andLogon as a service
privilege.
windows_user_privilege'Administrator'doprivilege%w(SeBatchLogonRightSeServiceLogonRight)end
RemoveLogon as a batch job
privilege of Administrator.
windows_user_privilege'Administrator'doprivilege%w(SeBatchLogonRight)action:removeend
SeTrustedCredManAccessPrivilege Access Credential Manager as a trusted callerSeNetworkLogonRight Access this computer from the networkSeTcbPrivilege Act as part of the operating systemSeMachineAccountPrivilege Add workstations to domainSeIncreaseQuotaPrivilege Adjust memory quotas for a processSeInteractiveLogonRight Allow log on locallySeRemoteInteractiveLogonRight Allow log on through Remote Desktop ServicesSeBackupPrivilege Back up files and directoriesSeChangeNotifyPrivilege Bypass traverse checkingSeSystemtimePrivilege Change the system timeSeTimeZonePrivilege Change the time zoneSeCreatePagefilePrivilege Create a pagefileSeCreateTokenPrivilege Create a token objectSeCreateGlobalPrivilege Create global objectsSeCreatePermanentPrivilege Create permanent shared objectsSeCreateSymbolicLinkPrivilege Create symbolic linksSeDebugPrivilege Debug programsSeDenyNetworkLogonRight Deny access this computer from the networkSeDenyBatchLogonRight Deny log on as a batch jobSeDenyServiceLogonRight Deny log on as a serviceSeDenyInteractiveLogonRight Deny log on locallySeDenyRemoteInteractiveLogonRight Deny log on through Remote Desktop ServicesSeEnableDelegationPrivilege Enable computer and user accounts to be trusted for delegationSeRemoteShutdownPrivilege Force shutdown from a remote systemSeAuditPrivilege Generate security auditsSeImpersonatePrivilege Impersonate a client after authenticationSeIncreaseWorkingSetPrivilege Increase a process working setSeIncreaseBasePriorityPrivilege Increase scheduling prioritySeLoadDriverPrivilege Load and unload device driversSeLockMemoryPrivilege Lock pages in memorySeBatchLogonRight Log on as a batch jobSeServiceLogonRight Log on as a serviceSeSecurityPrivilege Manage auditing and security logSeRelabelPrivilege Modify an object labelSeSystemEnvironmentPrivilege Modify firmware environment valuesSeManageVolumePrivilege Perform volume maintenance tasksSeProfileSingleProcessPrivilege Profile single processSeSystemProfilePrivilege Profile system performanceSeUnsolicitedInputPrivilege "Read unsolicited input from a terminal device"SeUndockPrivilege Remove computer from docking stationSeAssignPrimaryTokenPrivilege Replace a process level tokenSeRestorePrivilege Restore files and directoriesSeShutdownPrivilege Shut down the systemSeSyncAgentPrivilege Synchronize directory service dataSeTakeOwnershipPrivilege Take ownership of files or other objects
Note
: This resource has been deprecated as Chef Infra Client 15.0 shipped with a new archive_file resource, which natively handles multiple archive formats. Please update any cookbooks using this resource to instead use thearchive_file
resource:https://docs.chef.io/resource_archive_file.html
Most versions of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use thenot_if
oronly_if
meta parameters to guard the resource for idempotence or action will be taken every Chef run.
:unzip
- unzip a compressed file:zip
- zip a directory (recursively)
path
- name attribute. The path where files will be (un)zipped to.source
- source of the zip file (either a URI or local path) for :unzip, or directory to be zipped for :zip.overwrite
- force an overwrite of the files if they already exist.checksum
- for :unzip, useful if source is remote, if the local file matches the SHA-256 checksum, Chef will not download it.
Unzip a remote zip file locally
windows_zipfile'c:/bin'dosource'http://download.sysinternals.com/Files/SysinternalsSuite.zip'action:unzipnot_if{::File.exists?('c:/bin/PsExec.exe')}end
Unzip a local zipfile
windows_zipfile'c:/the_codez'dosource'c:/foo/baz/the_codez.zip'action:unzipend
Create a local zipfile
windows_zipfile'c:/foo/baz/the_codez.zip'dosource'c:/the_codez'action:zipend
Helper that allows you to use helpful functions in windows
Returns a hash of all DisplayNames installed
# usage in a recipe::Chef::DSL::Recipe.send(:include,Windows::Helper)hash_of_installed_packages=installed_packages
package_name
- The name of the package you want to query to see if it is installedreturns
- true if the package is installed, false if it the package is not installed
Download a file if a package isn't installed
# usage in a recipe to not download a file if package is already installed::Chef::DSL::Recipe.send(:include,Windows::Helper)is_win_sdk_installed=is_package_installed?('Windows Software Development Kit')remote_file'C:\windows\temp\windows_sdk.zip'dosource'http://url_to_download/windows_sdk.zip'action:create_if_missingnot_if{is_win_sdk_installed}end
Do something if a package is installed
# usage in a providerincludeWindows::Helperifis_package_installed?('Windows Software Development Kit')# do something if package is installedend
Helper that allows you to get information on the windows version running on your node. It leverages windows ohai from kernel.os_info, easy to mock and to use even on Linux.
Determines whether the given node is running on a Windows Core.
if ::Windows::VersionHelper.core_version?nodefail'Windows Core is not supported'end
Determines whether the given node is a windows workstation version (XP, Vista, 7, 8, 8.1, 10)
if ::Windows::VersionHelper.workstation_version?nodefail'Only server version of windows are supported'end
Determines whether the given node is a windows server version (Server 2003, Server 2008, Server 2012, Server 2016)
if ::Windows::VersionHelper.server_version?nodeputs'Server version of windows are cool'end
Determines NT version of the given node
case ::Windows::VersionHelper.nt_versionnodewhen'6.0'then'Windows vista or Server 2008'when'6.1'then'Windows 7 or Server 2008R2'when'6.2'then'Windows 8 or Server 2012'when'6.3'then'Windows 8.1 or Server 2012R2'when'10.0'then'Windows 10'end
Place an explicit dependency on this cookbook (using depends in the cookbook's metadata.rb) from any cookbook where you would like to use the Windows-specific resources/providers that ship with this cookbook.
depends'windows'
- Author:: Seth Chisamore (schisamo@chef.io)
- Author:: Doug MacEachern (dougm@vmware.com)
- Author:: Paul Morton (pmorton@biaprotect.com)
- Author:: Doug Ireton (doug.ireton@nordstrom.com)
Copyright 2011-2018, Chef Software, Inc.Copyright 2010, VMware, Inc.Copyright 2011, Business Intelligence Associates, IncCopyright 2012, Nordstrom, Inc.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.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.
About
Development repository for Chef Cookbook windows
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.