From 1544929feecd4062b5f684226717a639a74cdd52 Mon Sep 17 00:00:00 2001 From: David Mulder Date: Wed, 8 Jul 2020 15:30:25 -0600 Subject: [PATCH] gpo: Apply Group Policy Login Prompt Message Signed-off-by: David Mulder Reviewed-by: Douglas Bagnall --- libgpo/admx/en-US/samba.adml | 46 ++++++++++++++++++++++++++++++++++++ libgpo/admx/samba.admx | 7 ++++++ python/samba/gp_msgs_ext.py | 4 ++++ selftest/knownfail | 1 - 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/libgpo/admx/en-US/samba.adml b/libgpo/admx/en-US/samba.adml index fc0ec31c3cc..965af175e24 100755 --- a/libgpo/admx/en-US/samba.adml +++ b/libgpo/admx/en-US/samba.adml @@ -3087,6 +3087,46 @@ Example: 192.9.200.1 192.168.2.61 Messages Message of the day The contents of /etc/motd are displayed after a successful login but just before it executes the login shell. + Login Prompt Message + 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. + + 4 or 4{interface} + 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. + + 6 or 6{interface} + The same as \4 but for IPv6. + + b Insert the baudrate of the current line. + + d Insert the current date. + + e or e{name} + 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. + + s Insert the system name (the name of the operating system). Same as 'uname -s'. See also the \S escape code. + + S or S{VARIABLE} + 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. + + l Insert the name of the current tty line. + + m Insert the architecture identifier of the machine. Same as 'uname -m'. + + n Insert the nodename of the machine, also known as the hostname. Same as 'uname -n'. + + o Insert the NIS domainname of the machine. Same as 'hostname -d'. + + O Insert the DNS domainname of the machine. + + r Insert the release number of the OS. Same as 'uname -r'. + + t Insert the current time. + + u Insert the number of current users logged in. + + U Insert the string "1 user" or "<n> users" where <n> is the number of current users logged in. + + v Insert the version of the OS, that is, the build-date and such. @@ -4599,6 +4639,12 @@ Example: 192.9.200.1 192.168.2.61 + + + + Welcome to \s \r \l + + diff --git a/libgpo/admx/samba.admx b/libgpo/admx/samba.admx index f63c250d1c2..ee2816c2b31 100755 --- a/libgpo/admx/samba.admx +++ b/libgpo/admx/samba.admx @@ -2521,5 +2521,12 @@ + + + + + + + diff --git a/python/samba/gp_msgs_ext.py b/python/samba/gp_msgs_ext.py index aa03cc35dbc..5d8064072c2 100644 --- a/python/samba/gp_msgs_ext.py +++ b/python/samba/gp_msgs_ext.py @@ -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): diff --git a/selftest/knownfail b/selftest/knownfail index 81299f63cd6..6c005d1f4de 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -396,4 +396,3 @@ ^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