Skip to content

Commit f58371b

Browse files
authored
Add files via upload
1 parent 3d9ce96 commit f58371b

File tree

5 files changed

+137
-4
lines changed

5 files changed

+137
-4
lines changed

Build Scripts/FBManageSecurity.vbs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -962,17 +962,18 @@ End Sub
962962

963963
Sub SetSSLCert()
964964
Call DebugLog("SetSSLCert:")
965-
Dim strSSLCertPassword
965+
Dim strSSLCertPassword, strSSLFile
966966

967967
strSSLCertPassword = GetBuildfileValue("SSLCertPassword")
968+
strSSLFile = FormatFolder(GetBuildfileValue("PathAddComp")) & strSSLCertFile
969+
968970
Select Case True
969971
Case GetBuildfileValue("SetSSLSelfCert") = "YES"
970972
strCmd = "POWERSHELL New-SelfSignedCertificate -DNSName '*." & strUserDNSDomain & "' -FriendlyName '" & strSSLCert & "' -CertStoreLocation 'cert:\LocalMachine\My' -NotBefore '2001-01-01T00:00:00' -NotAfter '2999-12-31T23:59:59' "
971973
Call Util_RunExec(strCmd, "", "", -1) ' Attributes: RSA, 2048 bit; Defaults: Client Authentication, Server Authentication; Usable for: Digital Signature, Key Encipherment
972-
Case CheckFile(strSSLCertFile) = True
973-
strCmd = "POWERSHELL $Cert = Import-PfxCertificate -FilePath '" & strSSLCertFile & "' -Password '" & strSSLCertPassword & "' -CertStoreLocation 'cert:\LocalMachine\My' | $Cert.FriendlyName = '" & strSSLCert & "' "
974+
Case CheckFile(strSSLFile) = True
975+
strCmd = "POWERSHELL $Cert = Import-PfxCertificate -FilePath '" & strSSLFile & "' -Password '" & strSSLCertPassword & "' -CertStoreLocation 'cert:\LocalMachine\My' | $Cert.FriendlyName = '" & strSSLCert & "' "
974976
Call Util_RunExec(strCmd, "", "", -1)
975-
Call SetBuildMessage(strMsgError, "/SSLCertFile: is not yet supported in SQL FineBuild")
976977
Case Else
977978
Call SetBuildMessage(strMsgError, "Unable to find /SSLCertFile:" & strSSLCertFile)
978979
End Select
-8 Bytes
Binary file not shown.
16 Bytes
Binary file not shown.

Build Scripts/GenericMaintenance.cab

44 Bytes
Binary file not shown.

Build Scripts/Get-ADSPNAudit.vbs

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
2+
'
3+
' Get-ADSPNAudit.vbs
4+
' Copyright FineBuild Team © 2021. Distributed under Ms-Pl License
5+
'
6+
' Purpose: Displays SPN and AllowedToDelegateTo information for AD accounts
7+
'
8+
' Author: Ed Vassie
9+
'
10+
' Date: December 2021
11+
'
12+
' Change History
13+
' Version Author Date Description
14+
' 1.0 Ed Vassie 10 Dec 2021 Initial version
15+
'
16+
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
17+
Option Explicit
18+
On Error Goto 0
19+
20+
Dim objCommand, objConnection, objNetwork, objRecordSet, objRootDSE
21+
Dim strDomainDN
22+
23+
Call Init()
24+
Call Process()
25+
Call Terminate()
26+
27+
Sub Init()
28+
29+
Set objNetwork = CreateObject("WScript.Network")
30+
Set objRootDSE = GetObject ("LDAP://" & objNetwork.UserDomain & "/RootDSE")
31+
strDomainDN = objRootDSE.Get("DefaultNamingContext")
32+
33+
Set objConnection = CreateObject("ADODB.Connection")
34+
objConnection.Provider = "ADsDSOObject"
35+
objConnection.Open "Active Directory Provider"
36+
37+
Set objCommand = CreateObject("ADODB.Command")
38+
objCommand.ActiveConnection = objConnection
39+
objCommand.Properties("Searchscope") = 2 ' SUBTREE
40+
objCommand.Properties("Page Size") = 250
41+
objCommand.Properties("Timeout") = 30
42+
objCommand.Properties("Cache Results") = False
43+
objCommand.Properties("Sort on") = "Name"
44+
objCommand.CommandText = "SELECT ADsPath FROM 'LDAP://" & strDomainDN & "'"
45+
Set objRecordSet = objCommand.Execute
46+
47+
wscript.echo "-- SPN Audit Report --"
48+
49+
End Sub
50+
51+
52+
Sub Process()
53+
54+
On Error Resume Next
55+
56+
Do While Not objRecordSet.EOF
57+
If objRecordSet.Fields("Name") <> "" Then
58+
Call ProcessAccount(objRecordSet.Fields("ADsPath").Value)
59+
End If
60+
objRecordSet.MoveNext
61+
Loop
62+
63+
End Sub
64+
65+
66+
Sub ProcessAccount(strADsPath)
67+
Dim objAccount, objACE, objAttr, objDACL
68+
Dim strAttr, strMsg
69+
70+
On Error Resume Next
71+
72+
Set objAccount = GetObject(strADsPath)
73+
strMsg = Mid(objAccount.Name, 4)
74+
If strMsg = "" Then
75+
Exit Sub
76+
End If
77+
78+
Select Case True
79+
Case IsNull(objAccount.Get("msDS-ManagedPasswordId"))
80+
' Nothing, Account is not a gMSA
81+
Case IsNull(objAccount.Get("msDS-GroupMSAMembership"))
82+
strMsg = strMsg & vbCrLf & " WARNING: No Group details for gMSA Account"
83+
Case Else
84+
strMsg = strMsg & vbCrLf & " gMSA Group Details:"
85+
Set objAttr = objAccount.Get("msDS-GroupMSAMembership")
86+
Set objDACL = objAttr.DiscretionaryAcl
87+
For Each objACE In objDACL
88+
strMsg = strMsg & vbCRLF & " " & objACE.Trustee
89+
Next
90+
End Select
91+
92+
Select Case True
93+
Case IsNull(objAccount.Get("servicePrincipalName"))
94+
' Nothing, no SPN definitions for Account
95+
Case Else
96+
strMsg = strMsg & vbCrLf & " SPN Details:"
97+
objAttr = objAccount.Get("servicePrincipalName")
98+
For Each strAttr In objAttr
99+
strMsg = strMsg & vbCRLF & " " & strAttr
100+
Next
101+
End Select
102+
103+
Select Case True
104+
Case IsNull(objAccount.Get("msDS-AllowedToDelegateTo"))
105+
' Nothing, no SPN Usage for Account
106+
Case Else
107+
strMsg = strMsg & vbCrLf & " Delegation Details:"
108+
objAttr = objAccount.Get("msDS-AllowedToDelegateTo")
109+
For Each strAttr In objAttr
110+
strMsg = strMsg & vbCRLF & " " & strAttr
111+
Next
112+
End Select
113+
114+
If strMsg <> Mid(objAccount.Name, 4) Then
115+
Wscript.Echo " "
116+
Wscript.Echo strMsg
117+
End If
118+
119+
End Sub
120+
121+
122+
Sub Terminate()
123+
124+
objRecordset.Close
125+
objConnection.Close
126+
127+
wscript.echo vbCrLf & "-- End of Report --"
128+
129+
wscript.quit 0
130+
131+
End Sub
132+

0 commit comments

Comments
 (0)