Group Policy: Difference between revisions

From SambaWiki
(Add section on the Resultant Set of Policy)
(One intermediate revision by one other user not shown)
Line 46: Line 46:


= Policies =
= Policies =

== smb.conf Policies ==

smb.conf policies are found in Computer Configuration > Policies > Administrative Templates > Samba > smb.conf. These policies distribute smb.conf global options to the client. This policy is unable to apply idmap policies.


== Password and Kerberos Policies ==
== Password and Kerberos Policies ==
Line 158: Line 162:
-----------------------------------------------------------
-----------------------------------------------------------
================================================================================================
================================================================================================

----
[[Category:Active Directory]]

Revision as of 16:35, 15 May 2021

Introduction

This document describes how to manage winbind clients using Group Policy.

About Group Policy

Group Policy provides centralized management and configuration of operating system, application, and user settings. Policies are delivered to clients by listing them in LDAP, under groupPolicyContainer objects. These objects provide the gPCFileSysPath attribute, which points to policy information stored on the domains SYSVOL share.

Policies are enforced by winbind at a random interval between 90 and 120 seconds. Policies can be manually enforced using the samba-gpupdate --force command.

Configuring Group Policy

Enabling Group Policy in Winbind

To enable Group Policy application in winbind, set the global option apply group policies to yes.

apply group policies = yes

Installing Samba ADMX Templates for the Group Policy Management Console

In order to configure Samba Group Policies, you must first install the ADMX templates provided by Samba.

samba-tool gpo admxload -UAdministrator

The samba-tool gpo admxload command copies the Samba ADMX templates to the <domain>/Policies/PolicyDefinitions directory on the SYSVOL share.

Setting Samba Group Policy in the Group Policy Management Console

To set Samba Group Policy settings, open the Group Policy Management Console and either create a new Group Policy Object, or edit an existing one.

Creating a Group Policy Object

To create the Group Policy Object, highlight the domain or container where you want the object linked, then open the Action menu and select "Create a GPO in this domain, and Link it here".

Create gpo1 1.png

Enter the name of the new Group Policy in the dialog that appears, then click ok.

Create gpo2.png

Editing a Group Policy Object

Highlight a policy, and select Edit from the Action menu to open the policy for editing.

Samba policies can be found in the Group Policy Management Editor within User or Computer Configuration > Policies > Administrative Templates > Samba. For Samba Domain Controllers, the Password and Kerberos settings are also applied, which are found in Computer Configuration > Policies > OS Settings > Security Settings > Account Policy.

Policies

smb.conf Policies

smb.conf policies are found in Computer Configuration > Policies > Administrative Templates > Samba > smb.conf. These policies distribute smb.conf global options to the client. This policy is unable to apply idmap policies.

Password and Kerberos Policies

Password and Kerberos policies, found in Computer Configuration > Policies > OS Settings > Security Settings > Account Policy, are only applicable to Samba Domain Controllers.

The following password policies are applicable:

  • Minimum password age
  • Maximum password age
  • Minimum password length
  • Password must meet complexity requirements

And Kerberos policies:

  • Maximum ticket age (Maximum lifetime for user ticket)
  • Maximum service age (Maximum lifetime for service ticket)
  • Maximum renew age (Maximum lifetime for user ticket renewal)

Script Policies

Script policies create cron jobs on client machines which execute the specified commands. Script policies are found in Computer Configuration > Policies > Administrative Templates > Samba > Unix Settings > Scripts.

To add a script policy, open the policy, enable it, and click Show. In the dialog that appears, add the command to execute on the client. Click OK, then Apply to save the policy.

Scripts gpo1.png

Script policies are applied as cron jobs on the winbind client.

 linux-h7xz:~ # /usr/sbin/samba-gpupdate --force
 linux-h7xz:~ # cat /etc/cron.daily/tmp6l0m809i 
 #!/bin/sh
 whoami > /daily.log

Sudoers Policies

Sudoers policies add sudo rules to client machines. Sudoers policies are found in Computer Configuration > Policies > Administrative Templates > Samba > Unix Settings > Sudo Rights.

To add a sudo policy, open the policy, enable it, and click Show. In the dialog that appears, add the sudo rules to the list. Click OK, then Apply to save the policy.

 linux-h7xz:~ # /usr/sbin/samba-gpupdate --force
 linux-h7xz:~ # cat /etc/sudoers.d/gp_eockoryg
 
 ### autogenerated by samba
 #
 # This file is generated by the gp_sudoers_ext Group Policy
 # Client Side Extension. To modify the contents of this file,
 # modify the appropriate Group Policy objects which apply
 # to this machine. DO NOT MODIFY THIS FILE DIRECTLY.
 #
 
 tux ALL=(ALL) NOPASSWD: ALL

Message Policies

Message policies set the contents of the /etc/motd and /etc/issue files on client machines. Message policies are found in Computer Configuration > Policies > Administrative Templates > Samba > Unix Settings > Messages.

To add a message of the day policy, for example, open the policy and enable it. In the text box provided, enter the message you'd like displayed after a successful login.

 linux-h7xz:~ # samba-gpupdate
 linux-h7xz:~ # cat /etc/motd
 This message is distributed by Samba!

To add a login prompt policy, open the 'Logon Prompt Message' policy and enable it. In the text box provided, enter the message you'd like displayed before the login prompt. You can use escape sequences supported by the client /etc/issue file.

 linux-h7xz:~ # samba-gpupdate
 linux-h7xz:~ # cat /etc/issue
 Samba Group Policy \s \r \l

Resultant Set of Policy

The Resultant Set of Policy is a report indicating what policies have been, or what will be, applied to the local system. To display the Resultant Set of Policy, use the `samba-gpupdate --rsop` command:

 linux-h7xz:~ # samba-gpupdate --rsop
 Resultant Set of Policy
 Computer Policy
 
 GPO: Default Domain Policy
 ================================================================================================
   CSE: gp_sec_ext
   -----------------------------------------------------------
   -----------------------------------------------------------
   CSE: gp_sec_ext
   -----------------------------------------------------------
   -----------------------------------------------------------
   CSE: gp_scripts_ext
   -----------------------------------------------------------
   -----------------------------------------------------------
   CSE: gp_sudoers_ext
   -----------------------------------------------------------
     Policy Type: Sudo Rights
     -----------------------------------------------------------
     [ tux ALL=(ALL) NOPASSWD: ALL ]
     -----------------------------------------------------------
   -----------------------------------------------------------
   CSE: gp_smb_conf_ext
   -----------------------------------------------------------
     Policy Type: smb.conf
     -----------------------------------------------------------
     [ apply group policies ] = 1
     [ client max protocol ] = SMB2_02
     -----------------------------------------------------------
   -----------------------------------------------------------
   CSE: gp_msgs_ext
   -----------------------------------------------------------
     Policy Type: /etc/motd
     -----------------------------------------------------------
 This message is distributed by Samba!
     -----------------------------------------------------------
     Policy Type: /etc/issue
     -----------------------------------------------------------
 Samba Group Policy \s \r \l
     -----------------------------------------------------------
   -----------------------------------------------------------
 ================================================================================================