1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

gpo: Apply Group Policy Login Prompt Message

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
David Mulder 2020-07-08 15:30:25 -06:00 committed by David Mulder
parent b76d55cc90
commit 1544929fee
4 changed files with 57 additions and 1 deletions

View File

@ -3087,6 +3087,46 @@ Example: 192.9.200.1 192.168.2.61</string>
<string id="CAT_9DEF582D_447A_47E9_A1F5_363558D03FA9">Messages</string>
<string id="POL_38DA04F0_3FD6_4425_8924_1CEEA685FD07">Message of the day</string>
<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>
<string id="POL_68E9155C_CB49_428E_AFE0_B89316FFD948">Login Prompt Message</string>
<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.
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 "&lt;n&gt; users" where &lt;n&gt; is the number of current users logged in.
v Insert the version of the OS, that is, the build-date and such.</string>
</stringTable>
<presentationTable>
<presentation id="POL_9320E11F_AC80_4A7D_A5C8_1C0F3F727061">
@ -4599,6 +4639,12 @@ Example: 192.9.200.1 192.168.2.61</string>
<label>Message of the day</label>
</textBox>
</presentation>
<presentation id="POL_68E9155C_CB49_428E_AFE0_B89316FFD948">
<textBox refId="TXT_8075D9EA_6E15_4B2A_833A_B918EE90856F">
<label>Login Prompt Message</label>
<defaultValue>Welcome to \s \r \l</defaultValue>
</textBox>
</presentation>
</presentationTable>
</resources>
</policyDefinitionResources>

View File

@ -2521,5 +2521,12 @@
<text id="TXT_609C208A_3B4D_48F1_8A15_C0DF08EAD4D6" key="Software\Policies\Samba\Unix Settings\Messages" valueName="motd" />
</elements>
</policy>
<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">
<parentCategory ref="CAT_9DEF582D_447A_47E9_A1F5_363558D03FA9" />
<supportedOn ref="windows:SUPPORTED_WindowsVista" />
<elements>
<text id="TXT_8075D9EA_6E15_4B2A_833A_B918EE90856F" key="Software\Policies\Samba\Unix Settings\Messages" valueName="issue" />
</elements>
</policy>
</policies>
</policyDefinitions>

View 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):

View File

@ -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