SIEM/Log Management Cấu hình LDAP cho Opensearch

Mục lục
I. Giới thiệu
1. LDAP
2. Mục đích triển khai
II. Các bước triển khai

I. Giới thiệu
1. LDAP

Lightweight Directory Access Protocol (LDAP) là một giao thức dùng để truy cập và quản lý thông tin dạng thư mục (directory service) trong mạng máy tính. Nó thường được dùng để quản lý tập trung tài khoản người dùng, máy tính, nhóm quyền và xác thực đăng nhập trong doanh nghiệp.
Một LDAP server hoạt động như “danh bạ trung tâm” của hệ thống:
  • Lưu user/password
  • Quản lý group, role
  • Xác thực đăng nhập (authentication)
  • Phân quyền truy cập (authorization)
  • Cho phép nhiều hệ thống dùng chung tài khoản
2. Mục đích triển khai
Việc cấu hình LDAP cho OpenSearch nhằm mục đích quản lý người dùng và phân quyền tập trung, cho phép user đăng nhập bằng tài khoản LDAP/Active Directory thay vì tạo tài khoản thủ công trên OpenSearch. Hệ thống có thể tự động ánh xạ group LDAP thành role để cấp quyền phù hợp, giúp dễ quản lý nhiều người dùng, tăng bảo mật, hỗ trợ audit và thuận tiện khi tích hợp với các hệ thống như Wazuh, VPN, GitLab hoặc Jenkins.

II. Các bước triển khai
Dùng lệnh ldapsearch để kiểm tra cấu hình LDAP
ldapsearch -x \ -H ldap://**.***.***.***:389 \ -D "CN=administrator,OU=Servives-user,OU=Company-User,DC=securityzone,DC=vn" \ -w "PASSWORD" \ -b "DC=securityzone,DC=vn" \ "(sAMAccountName=administrator)"
Trên node manager, chỉnh sửa /etc/opensearch/opensearch-security/config.yml
authc:
basic_internal_auth_domain:
description: "Authenticate via HTTP Basic against internal users database"
http_enabled: true
transport_enabled: true
order: 4
http_authenticator:
type: basic
challenge: true
authentication_backend:
type: intern
ldap:
description: "Authenticate via LDAP or Active Directory"
http_enabled: true
transport_enabled: true
order: 1
http_authenticator:
type: basic
challenge: false
authentication_backend:
# LDAP authentication backend (authenticate users against a LDAP or Active Directory)
type: ldap
config:
# enable ldaps
enable_ssl: false
# enable start tls, enable_ssl should be false
enable_start_tls: false
# send client certificate
enable_ssl_client_auth: false
# verify ldap hostname
verify_hostnames: false
hosts:
- **.***.***.***:389 # IP máy AD
bind_dn: "CN=administrator,CN=Users,DC=securityzone,DC=vn"
password: "************" # mật khẩu tài khoản administrator của AD
userbase: "DC=securityzone,DC=vn"
# Filter to search for users (currently in the whole subtree beneath userbase)
# {0} is substituted with the username
usersearch: "(sAMAccountName={0})"
# Use this attribute from the user as username (if not set then DN is used)
username_attribute: "sAMAccountName"
connect_timeout: 5000
response_timeout: 0
authz:
roles_from_myldap:
description: "Authorize via LDAP or Active Directory"
http_enabled: true
transport_enabled: true
authorization_backend:
# LDAP authorization backend (gather roles from a LDAP or Active Directory, you have to configure the above LDAP authentication backend settings too)
type: ldap
config:
# enable ldaps
enable_ssl: false
# enable start tls, enable_ssl should be false
enable_start_tls: false
# send client certificate
enable_ssl_client_auth: false
# verify ldap hostname
verify_hostnames: true
hosts:
- **.***.***.***:389 # IP máy AD
bind_dn: "CN=administrator,CN=Users,DC=securityzone,DC=vn"
password: "************" # mật khẩu tài khoản administrator của AD
rolebase: "DC=securityzone,DC=vn"
# Filter to search for roles (currently in the whole subtree beneath rolebase)
# {0} is substituted with the DN of the user
# {1} is substituted with the username
# {2} is substituted with an attribute value from user's directory entry, of the authenticated user. Use userroleattribute to specify the name of the attribute
rolesearch: '(member={0})'
# Specify the name of the attribute which value should be substituted with {2} above
userroleattribute: null
# Roles as an attribute of the user entry
userrolename: disabled
#userrolename: memberOf
# The attribute in a role entry containing the name of that role, Default is "name".
# Can also be "dn" to use the full DN as rolename.
rolename: "cn"
# Resolve nested roles transitive (roles which are members of other roles and so on ...)
resolve_nested_roles: true
userbase: 'DC=securityzone,DC=vn'
# Filter to search for users (currently in the whole subtree beneath userbase)
# {0} is substituted with the username
usersearch: "(sAMAccountName={0})"
# Skip users matching a user name, a wildcard or a regex pattern
#skip_users:
# - 'cn=Michael Jackson,ou*people,o=TEST'
# - '/\S*/'
Sau đó tiến hành apply config để opensearch nhận LDAP
/usr/share/opensearch/plugins/opensearch-security/tools/securityadmin.sh \ -cd /etc/opensearch/opensearch-security/ \ -icl -nhnv \ -cacert /etc/opensearch/certs/root-ca.pem \ -cert /etc/opensearch/certs/root-ca.pem \ -key /etc/opensearch/certs/root-ca.key \ -h localhost \ -p 9200
 
Back
Top