-
Notifications
You must be signed in to change notification settings - Fork 24
/
samba-check-SePrivileges.sh
47 lines (41 loc) · 1.82 KB
/
samba-check-SePrivileges.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# This script does not modify anything, it shows the output of the SEPRIVILEGE members.
# Version 1.1
# Released : 7 Sept 2017
# Updated : 20 May 2022, Thanks for Testing Rowland Penny. ;-)
# Info: https://technet.microsoft.com/en-us/library/dn579255(v=ws.11).aspx#BKMK_PrintOperators
#
# Assigning Delegated Print Administrator and Printer Permission Settings in Windows Server 2008 R2
# https://technet.microsoft.com/en-us/library/ee524015(v=ws.10).aspx
# check samba verions since some paramater changes.
FULL_VERSION="$(smbd -V|cut -d" " -f2 | sed 's/-Debian//g')"
MAIN_VERSION="$(echo "$FULL_VERSION" | cut -d"." -f1)"
MINOR_VERSION="$(echo "$FULL_VERSION" | cut -d"." -f2)"
SUB_VERSION="$(echo "$FULL_VERSION" | cut -d"." -f3)"
# Last check known SePrivilege
SEPRIVILEGE="SeMachineAccountPrivilege \
SeTakeOwnershipPrivilege SeBackupPrivilege SeRestorePrivilege \
SeRemoteShutdownPrivilege SePrintOperatorPrivilege SeAddUsersPrivilege \
SeDiskOperatorPrivilege SeSecurityPrivilege SeSystemtimePrivilege \
SeShutdownPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege \
SeSystemProfilePrivilege SeProfileSingleProcessPrivilege \
SeIncreaseBasePriorityPrivilege SeLoadDriverPrivilege \
SeCreatePagefilePrivilege SeIncreaseQuotaPrivilege SeChangeNotifyPrivilege \
SeUndockPrivilege SeManageVolumePrivilege SeImpersonatePrivilege SeCreateGlobalPrivilege \
SeEnableDelegationPrivilege"
echo "Version check for Samba : $MAIN_VERSION.$MINOR_VERSION.$SUB_VERSION"
kinit Administrator
if [ "${MINOR_VERSION}" -lt 15 ]
then
for sepriv in $SEPRIVILEGE
do
net rpc rights list privileges "$sepriv" -S "$(hostname -f)" --kerberos
done
elif [ "${MINOR_VERSION}" -ge 15 ]
then
for sepriv in $SEPRIVILEGE
do
net rpc rights list privileges "$sepriv" -S "$(hostname -f)" --use-kerberos=required -N
done
fi
kdestroy