讓AD域用戶帳戶只能登錄管理員指定的客戶端計算機

讓AD域用戶帳戶只能登錄管理員指定的客戶端計算機安全

 

 

 

 

咱們都知道,在域AD環境下域用戶帳戶默認是能夠登錄到除DC外的任意計算機客戶端的,這就讓一些別有用心的員工找到漏洞了,這樣他就能夠登錄別人的計算機去得到他想要的資料了,這樣對一個企業來講是很是不安全的,那麼應該如何解決這個問題呢?OK,入正題。

這裏介紹兩種方法,不過仍是用第一種方法比較靈活,第二種方法比較複雜並且也帶有漏洞。

第一個辦法:

1
、在域賬號的屬性中設置。
打開該賬號的屬性,賬戶頁面,登陸到,以下圖所示:

而後在登陸工做站選擇下列計算機;將要登陸到的計算機名字填寫,而後肯定,便可。

3.
測試,當使用該賬號沒有登陸到指定的計算機的時候,系統會提示錯誤,以下圖所示:

到此設置完畢。

第二個辦法:

1
、準備兩個腳本。一個用於用戶登入時執行的login.vbs,另外一個是用於註銷時使用的logoff.vbs

2
、爲配合腳本,咱們須要在DC上建立一個共享文件夾,讓全部用戶擁有更改的權限!

3
、創建一條組策略

A
、準備腳本(我會在本文最後提供腳本給你們分享)
B
、建立共享文件夾Userinfo(爲避免用戶錯誤,我儘可能詳盡)

建立共享及並給用戶以變動權限

開始將咱們的login.vbs這個腳本加入到啓動指令中
在這一切設置完畢以後,爲了加速就用的時候,咱們在GPMC管理工具上將這個策略設置成強制。並重啓咱們的客戶端計算機,固然你也能夠先執行gpupdate /force 這個命令來強行的刷新組策略!
將這個策略設置成強制。
原理:
兩個腳本是用來記錄用戶所登入與登出的計算機時間,在一個用戶登入後,會當即寫下當前的記錄,若是用戶使用同一個帳戶在另外一個計算機上登陸時就會報警。如今咱們來看看用戶登錄後,在共享資料夾裏產生的文件!它的文件命名方式以用戶的登錄名爲主!
下面這個文件是MIS-04登入計算機後產生的,咱們能夠清楚的看到MIS-04這個用戶所登入的計算機及時間!經過這種方式,若是MIS-04再登入其餘的電腦的話,VBS會檢查這個檔裏面的信息,當他發現MIS-04已經登入一臺電腦了,而且沒有註銷。它就會自動退出!
login.vbs
代碼:
Dim oNet, sUser, sComputer, ServerLog
ServerLog = "\\192.168.1.1\Userinfo\ "
Set oNet = CreateObject("Wscript.Network")
sUser = oNet.UserName
sComputer = oNet.ComputerName
Set oNet = Nothing
Dim fso, f1, WshShell, argu, alllog, lastlog
Dim FileName
FileName=ServerLog & sUser & ".txt"
Set fso = CreateObject("Scripting.FileSystemObject")
If Not (fso.FileExists(FileName)) Then
  Set f1 = fso.CreateTextFile(FileName,True)
  f1.WriteLine sUser & "   " & sComputer
  f1.Close
  Set WshShell = Wscript.CreateObject("Wscript.Shell")
  argu = FileName & "/T/E/G" & sUser & ":f /R Everyone"
  WshShell.run("cacls " & argu)
  Set WshShell = Nothing
End If

Set f = fso.GetFile(Filename)
   intSizeB = f.Size
   if intsizeB=0 then
   alllog = ""
   lastlog = ""
   end if
   if intsizeB>0 then
    set f1=fso.OpenTextFile(Filename,1,True)
   alllog = f1.readall
    f1.close
    set f1=fso.OpenTextFile(Filename,1,True)
   lastlog = f1.readline
    f1.close
   end if
If Left(lastlog, 5) = "logon"  Then  
If InStr(lastlog,sComputer) < 1 Then  
        Set f1 = fso.OpenTextFile(FileName, 2, True)
        f1.WriteLine (lastlog & Chr(13) & Chr(10) & "FailLogon:" & Now() & " " & sUser & "  at  " & scomputer & Chr(13) & Chr(10) & alllog)
        f1.Close

        Set WshShell = Wscript.CreateObject("Wscript.Shell")
        Dim i,OldComputer
        i=InStr(lastlog,"at")
        OldComputer=Right(lastlog,Len(lastlog)-i-2)
        WshShell.popup "
對不起:此帳號已經在 " & OldComputer & " 上登入使用!出現此提示的可能狀況以下:1、您在其餘電腦上登錄的賬戶未及時註銷。2、您上次非法關閉計算機或者意外停電。3、若是您確認未發生上述2種狀況,那麼可能您的賬戶被盜。對於23狀況請及時上報IT支持,謝謝!!!" , 30
        Set WshShell = Nothing
        Dim os, retcode
        For Each os In GetObject("Winmgmts:{impersonationLevel=impersonate,(shutdown,remoteshutdown)}!//" + sComputer).InstancesOf("Win32_OperatingSystem")
           retcode = os.Win32ShutDown(4, 0)
        Next
        Wscript.quit
       Else
        Set f1 = fso.OpenTextFile(FileName, 2, True)
        f1.WriteLine ("logon:  " & Now() & " " & sUser & "  at " & sComputer & Chr(13) & Chr(10) & alllog)
        f1.Close
       End If
Else  
       Set f1 = fso.OpenTextFile(FileName, 2, True)
       f1.WriteLine ("logon:  " & Now() & " " & sUser & "  at " & sComputer & Chr(13) & Chr(10) & alllog)
       f1.Close
End If
Set f1 = Nothing
Set fso = Nothing
Wscript.quit
logoff.vbs
代碼
dim oNet,sUser,sComputer,ServerLog
ServerLog = "\\192.168.1.1\Userinfo\ "
set oNet=createobject("Wscript.Network")
sUser=oNet.UserName
sComputer=oNet.ComputerName
set oNet=nothing
dim fso,f1,alllog,lastlog
Dim FileName
FileName=ServerLog & sUser & ".txt"
set fso=createobject("Scripting.filesystemobject")

If Not (fso.FileExists(FileName)) Then
  Set f1 = fso.CreateTextFile(FileName,True)
  f1.WriteLine sUser & "   " & sComputer
  f1.Close
  Set WshShell = Wscript.CreateObject("Wscript.Shell")
  argu = FileName & "/T/E/G" & sUser & ":f /R Everyone"
  WshShell.run("cacls " & argu)
  Set WshShell = Nothing
End If

Set f = fso.GetFile(Filename)
   intSizeB = f.Size
   if intsizeB=0 then
   alllog = ""
   lastlog = ""
   end if
   if intsizeB>0 then
    set f1=fso.OpenTextFile(Filename,1,True)
   alllog = f1.readall
    f1.close
    set f1=fso.OpenTextFile(Filename,1,True)
   lastlog = f1.readline
    f1.close
   end if



if left(lastlog,5)="logon" Then
If InStr(lastlog,sComputer) > 0 Then  
Set f1=fso.opentextfile(FileName,2,true)
f1.writeline("logoff: " & Now() & " " & suser & "  at " & scomputer &

Chr(13) & chr(10) & alllog)
f1.close
End If
end if
set f1=nothing
set fso=nothing
wscript.quit
ide

相關文章
相關標籤/搜索