🔐 5. Bảo mật & phân quyền trong mô hình Domain (10 phút)

5.1. Mục tiêu của bảo mật & phân quyền (1 phút)

  • Đảm bảo người đúng được quyền đúng trên tài nguyên đúng

  • Hạn chế truy cập trái phép vào hệ thống, thư mục, dịch vụ

  • Tăng cường kiểm soát theo vai trò, phòng ban, nhóm


5.2. Cơ chế phân quyền trên Domain (2 phút)

Có 3 cấp phân quyền:

Cấp độ Mô tả
User/Group Xác định đối tượng nào được quyền
Tài nguyên Thư mục, máy in, ứng dụng, v.v.
Quyền (Permissions) Full, Read, Write, Modify, No access

📌 Luôn ưu tiên dùng Group để phân quyền, không phân quyền trực tiếp từng user!


5.3. Ví dụ thực tế phân quyền thư mục theo phòng ban (3 phút)

🧾 Bài toán:

  • Phòng Kế Toán chỉ được đọc và chỉnh sửa thư mục \\SRV\KeToanShare

  • Phòng IT được toàn quyền thư mục \\SRV\ITShare

📁 Thực hiện:

  1. Tạo thư mục chia sẻ:

    • D:\Shared\KeToanShare

    • D:\Shared\ITShare

  2. Chia sẻ thư mục (Properties → Sharing → Advanced Sharing)

    • Share name: KeToanShare, ITShare

    • Permissions: Everyone → Remove → Add Group tương ứng

  3. NTFS Permissions (bảo mật nội bộ):

    • Chuột phải → Properties → Security:

      • Gán KeToan_Group: Modify

      • Gán IT_Admins: Full Control

📌 Quan trọng: Phải cấu hình cả Share permission và NTFS permission → hiệu lực là mức giới hạn nhất trong 2 cái.


5.4. GPO tăng cường bảo mật hệ thống (2 phút)

Ví dụ chính sách:

  • Tự động khóa máy sau 5 phút không hoạt động:

    User Configuration → Policies → Administrative Templates → 
    Control Panel → Personalization → 
    Enable screen saver = Enabled
    Screen saver timeout = 300
    Password protect screen saver = Enabled
    
  • Chặn chạy USB / EXE lạ (như đã nêu ở phần 4):

    Computer Configuration → Administrative Templates → System →
    Removable Storage Access → Deny all access
    

5.5. Giám sát & Audit sự kiện (2 phút)

Mục tiêu: Theo dõi ai đăng nhập, ai sửa file, ai cố truy cập trái phép

  • Enable Auditing:

    • GPO: Audit Logon Events, Audit Object Access

    • Logs: Event Viewer → Security Logs

Công cụ hỗ trợ thêm:

  • Windows Event Forwarding

  • SIEM / Syslog (cho doanh nghiệp lớn)


📌 Tóm tắt nhanh phần 5

Nội dung Thao tác chính
Phân quyền thư mục NTFS + Share Permissions
Áp dụng theo nhóm Group-based ACL
GPO bảo mật Chặn USB, auto lock, hạn chế app
Audit giám sát GPO + Event Viewer

Dưới đây là một số GPO mẫuPowerShell Script giúp cấu hình bảo mật nhanh trên Domain Controller hoặc thông qua Group Policy Management:


🔒 1. GPO mẫu: Chặn USB (Removable Storage)

Đường dẫn GPO:

Computer Configuration → Policies → Administrative Templates → 
System → Removable Storage Access

Thiết lập:

  • All Removable Storage classes: Deny all access → Enabled

📌 PowerShell Script (tạo GPO và áp dụng):

# Tạo GPO mới
New-GPO -Name "GPO_Block_USB" | New-GPLink -Target "OU=KeToan,DC=company,DC=local"

# Cấu hình GPO chặn USB
Set-GPRegistryValue -Name "GPO_Block_USB" `
 -Key "HKLM\Software\Policies\Microsoft\Windows\RemovableStorageDevices" `
 -ValueName "Deny_All" -Type DWord -Value 1

⏲️ 2. GPO mẫu: Tự động khóa màn hình sau 5 phút không dùng

Đường dẫn GPO:

User Configuration → Policies → Administrative Templates → 
Control Panel → Personalization

Thiết lập:

  • Enable screen saver: Enabled

  • Screen saver timeout: 300 (giây)

  • Password protect screen saver: Enabled

📌 PowerShell Script:

New-GPO -Name "GPO_Auto_Lock_5p" | New-GPLink -Target "OU=IT,DC=company,DC=local"

Set-GPRegistryValue -Name "GPO_Auto_Lock_5p" `
 -Key "HKCU\Software\Policies\Microsoft\Windows\Control Panel\Desktop" `
 -ValueName "ScreenSaveActive" -Type String -Value "1"

Set-GPRegistryValue -Name "GPO_Auto_Lock_5p" `
 -Key "HKCU\Software\Policies\Microsoft\Windows\Control Panel\Desktop" `
 -ValueName "ScreenSaverIsSecure" -Type String -Value "1"

Set-GPRegistryValue -Name "GPO_Auto_Lock_5p" `
 -Key "HKCU\Software\Policies\Microsoft\Windows\Control Panel\Desktop" `
 -ValueName "ScreenSaveTimeOut" -Type String -Value "300"

🔍 3. GPO mẫu: Audit sự kiện đăng nhập

Đường dẫn GPO:

Computer Configuration → Policies → Windows Settings → Security Settings → 
Advanced Audit Policy Configuration → Audit Policies → Logon/Logoff

Thiết lập:

  • Audit Logon: Success, Failure

📌 PowerShell Script:

New-GPO -Name "GPO_Audit_Logon" | New-GPLink -Target "OU=Servers,DC=company,DC=local"

# Enable Audit Logon Success & Failure
Set-GPRegistryValue -Name "GPO_Audit_Logon" `
 -Key "HKLM\Software\Policies\Microsoft\Windows\EventLog\Application" `
 -ValueName "AuditLogon" -Type DWord -Value 3

⚙️ 4. GPO mẫu: Chặn Task Manager và Command Prompt (EXE)

Đường dẫn GPO:

User Configuration → Policies → Administrative Templates → System

Thiết lập:

  • Don’t run specified Windows applications → Enabled

  • Danh sách chặn: taskmgr.exe, cmd.exe, regedit.exe

📌 PowerShell Script:

New-GPO -Name "GPO_Block_Apps" | New-GPLink -Target "OU=UserRestricted,DC=company,DC=local"

Set-GPRegistryValue -Name "GPO_Block_Apps" `
 -Key "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" `
 -ValueName "DisallowRun" -Type DWord -Value 1

New-GPRegistryValue -Name "GPO_Block_Apps" `
 -Key "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" `
 -ValueName "1" -Type String -Value "cmd.exe"

New-GPRegistryValue -Name "GPO_Block_Apps" `
 -Key "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" `
 -ValueName "2" -Type String -Value "taskmgr.exe"

📌 Hướng dẫn thêm:

  • Để thực hiện, cần chạy các lệnh trong PowerShell (Admin) trên máy có cài:

    • GPMC (Group Policy Management Console)

    • RSAT (nếu thao tác từ client)


📥 Tải file GPO_BaoMat_Domain.ps1


Hướng dẫn sử dụng:

  1. Mở PowerShell Run as Administrator trên Domain Controller

  2. Chạy lệnh:

    Set-ExecutionPolicy RemoteSigned
    .\GPO_BaoMat_Domain.ps1
    
  3. Kiểm tra trong Group Policy Management Console → xem các GPO mới được tạo và liên kết

[ Made by AI ] // Built with neural networks 🧠⚙️

Nhận xét

Bài đăng phổ biến từ blog này

🌈 Tự Động Highlight Code Trong Blogger

🧭CRUD CHUẨN LARAVEL

🚀01 giờ học cách sử dụng Developer Console