gpo: Apply Group Policy Login Prompt Message
authorDavid Mulder <dmulder@suse.com>
Wed, 8 Jul 2020 21:30:25 +0000 (15:30 -0600)
committerDavid Mulder <dmulder@samba.org>
Thu, 27 Aug 2020 15:59:34 +0000 (15:59 +0000)
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
libgpo/admx/en-US/samba.adml
libgpo/admx/samba.admx
python/samba/gp_msgs_ext.py
selftest/knownfail

index fc0ec31c3ccdcea9855f609735108b799da9a7b6..965af175e24b8f76effaa969918a80f9b4fae3db 100755 (executable)
@@ -3087,6 +3087,46 @@ Example: 192.9.200.1 192.168.2.61</string>
       <string id="CAT_9DEF582D_447A_47E9_A1F5_363558D03FA9">Messages</string>\r
       <string id="POL_38DA04F0_3FD6_4425_8924_1CEEA685FD07">Message of the day</string>\r
       <string id="POL_38DA04F0_3FD6_4425_8924_1CEEA685FD07_Help">       The contents of /etc/motd are displayed after a successful login but just before it executes the login shell.</string>\r
+      <string id="POL_68E9155C_CB49_428E_AFE0_B89316FFD948">Login Prompt Message</string>\r
+      <string id="POL_68E9155C_CB49_428E_AFE0_B89316FFD948_Help">       The issue file may contain certain escape codes to display the system name, date, time etc. All  escape codes consist of a backslash (\) immediately followed by one of the characters listed below.\r
+\r
+       4 or 4{interface}\r
+              Insert the IPv4 address of the specified network interface (for example: \4{eth0}).  If the interface argument is not specified, then select the first fully configured (UP, non-LOCALBACK, RUNNING) interface. If not any configured interface is found, fall back to the IP address of the machine's hostname.\r
+\r
+       6 or 6{interface}\r
+              The same as \4 but for IPv6.\r
+\r
+       b      Insert the baudrate of the current line.\r
+\r
+       d      Insert the current date.\r
+\r
+       e or e{name}\r
+              Translate the human-readable name to an escape sequence and  insert  it  (for  example:  \e{red}Alert text.\e{reset}). If  the name argument is not specified, then insert \033.  The currently supported names are: black, blink, blue, bold, brown,  cyan,  darkgray,  gray,  green,  halfbright,  lightblue, lightcyan,  lightgray, lightgreen, lightmagenta, lightred, magenta, red, reset, reverse, and yellow. All unknown names are silently ignored.\r
+\r
+       s      Insert the system name (the name of the operating system).  Same as 'uname -s'.  See also the \S  escape code.\r
+\r
+       S or S{VARIABLE}\r
+              Insert  the  VARIABLE  data  from  /etc/os-release.   If  this  file does not exist then fall back to /usr/lib/os-release.  If the VARIABLE argument is not specified, then use PRETTY_NAME from  the  file or the system name (see \s).  This escape code allows to keep /etc/issue distribution and release independent.  Note that \S{ANSI_COLOR} is converted to the real terminal escape sequence.\r
+\r
+       l      Insert the name of the current tty line.\r
+\r
+       m      Insert the architecture identifier of the machine.  Same as 'uname -m'.\r
+\r
+       n      Insert the nodename of the machine, also known as the hostname.  Same as 'uname -n'.\r
+\r
+       o      Insert the NIS domainname of the machine.  Same as 'hostname -d'.\r
+\r
+       O      Insert the DNS domainname of the machine.\r
+\r
+       r      Insert the release number of the OS.  Same as 'uname -r'.\r
+\r
+       t      Insert the current time.\r
+\r
+       u      Insert the number of current users logged in.\r
+\r
+       U      Insert the string "1 user" or "&lt;n&gt; users" where &lt;n&gt; is the number of current users logged in.\r
+\r
+       v      Insert the version of the OS, that is, the build-date and such.</string>\r
     </stringTable>\r
     <presentationTable>\r
       <presentation id="POL_9320E11F_AC80_4A7D_A5C8_1C0F3F727061">\r
@@ -4599,6 +4639,12 @@ Example: 192.9.200.1 192.168.2.61</string>
           <label>Message of the day</label>\r
         </textBox>\r
       </presentation>\r
+      <presentation id="POL_68E9155C_CB49_428E_AFE0_B89316FFD948">\r
+        <textBox refId="TXT_8075D9EA_6E15_4B2A_833A_B918EE90856F">\r
+          <label>Login Prompt Message</label>\r
+          <defaultValue>Welcome to \s \r \l</defaultValue>\r
+        </textBox>\r
+      </presentation>\r
     </presentationTable>\r
   </resources>\r
 </policyDefinitionResources>\r
index f63c250d1c236734489355138ccb327419ac52dc..ee2816c2b318594138e61e3a0800cbd990b84c20 100755 (executable)
         <text id="TXT_609C208A_3B4D_48F1_8A15_C0DF08EAD4D6" key="Software\Policies\Samba\Unix Settings\Messages" valueName="motd" />\r
       </elements>\r
     </policy>\r
+    <policy name="POL_68E9155C_CB49_428E_AFE0_B89316FFD948" class="Machine" displayName="$(string.POL_68E9155C_CB49_428E_AFE0_B89316FFD948)" explainText="$(string.POL_68E9155C_CB49_428E_AFE0_B89316FFD948_Help)" presentation="$(presentation.POL_68E9155C_CB49_428E_AFE0_B89316FFD948)" key="Software\Policies\Samba\Unix Settings\Messages">\r
+      <parentCategory ref="CAT_9DEF582D_447A_47E9_A1F5_363558D03FA9" />\r
+      <supportedOn ref="windows:SUPPORTED_WindowsVista" />\r
+      <elements>\r
+        <text id="TXT_8075D9EA_6E15_4B2A_833A_B918EE90856F" key="Software\Policies\Samba\Unix Settings\Messages" valueName="issue" />\r
+      </elements>\r
+    </policy>\r
   </policies>\r
 </policyDefinitions>\r
index aa03cc35dbcad7df8f2f5e2c6f574361fb6c4a37..5d8064072c2a85bc97ec9fe02bdf2968ce6b8219 100644 (file)
@@ -29,6 +29,8 @@ class gp_msgs_ext(gp_pol_ext):
                 for attribute, msg in settings[str(self)].items():
                     if attribute == 'motd':
                         mfile = os.path.join(cdir, 'motd')
+                    elif attribute == 'issue':
+                        mfile = os.path.join(cdir, 'issue')
                     else:
                         continue
                     with open(mfile, 'w') as w:
@@ -52,6 +54,8 @@ class gp_msgs_ext(gp_pol_ext):
                     if e.keyname == section_name and e.data.strip():
                         if e.valuename == 'motd':
                             mfile = os.path.join(cdir, 'motd')
+                        elif e.valuename == 'issue':
+                            mfile = os.path.join(cdir, 'issue')
                         else:
                             continue
                         if os.path.exists(mfile):
index 81299f63cd628c165b7fc1b17ab8ce274bcc3388..6c005d1f4deb7afc6db6269b44e5d59870d5710a 100644 (file)
 ^samba.tests.ntlmdisabled.python\(ktest\).python2.ntlmdisabled.NtlmDisabledTests.test_samr_change_password\(ktest\)
 ^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).python3.ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\)
 ^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).python2.ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\)
-^samba.tests.gpo.samba.tests.gpo.GPOTests.test_gp_motd