여러 ID 저장소를 사용하여 애플리케이션 및 관리 인터페이스 보안
파일 시스템, 데이터베이스, LDAP(Lightweight Directory Access Protocol) 또는 사용자 정의 ID 저장소와 같은 여러 ID 저장소를 결합하여 JBoss EAP 관리 인터페이스 및 배포된 애플리케이션을 보호하는 가이드
초록
JBoss EAP 문서에 대한 피드백 제공
오류를 보고하거나 문서를 개선하기 위해 Red Hat Jira 계정에 로그인하여 문제를 제출하십시오. Red Hat Jira 계정이 없는 경우 계정을 생성하라는 메시지가 표시됩니다.
프로세스
- 티켓을 생성하려면 다음 링크를 클릭하십시오.
- 요약 에 문제에 대한 간략한 설명을 입력합니다.
- 설명에서 문제 또는 개선 사항에 대한 자세한 설명을 제공합니다. 문서에서 문제가 발생한 위치에 URL을 포함합니다.
- Submit 을 클릭하고 문제를 적절한 문서 팀으로 라우팅합니다.
보다 포괄적 수용을 위한 오픈 소스 용어 교체
Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 용어를 교체하기 위해 최선을 다하고 있습니다. 먼저 마스터(master), 슬레이브(slave), 블랙리스트(blacklist), 화이트리스트(whitelist) 등 네 가지 용어를 교체하고 있습니다. 이러한 변경 작업은 작업 범위가 크므로 향후 여러 릴리스에 걸쳐 점차 구현할 예정입니다. 자세한 내용은 CTO Chris Wright의 메시지를 참조하십시오.
1장. ID 저장소 구성
1.1. 집계 영역 생성
1.1.1. Elytron의 집계 영역
집계 영역, 집계-realm
을 사용하면 인증 및 다른 보안 영역 또는 Elytron의 승인을 위해 여러 보안 영역의 집계를 위해 하나의 보안 영역을 사용할 수 있습니다.
예를 들어, 파일 시스템
을 사용하도록 집계-realm을 구성할 수 있습니다.
-realm의 인증 및 집계
에 ldap-realm
을 사용하고 승인을 위해 ldap-realm
ID는 다음과 같이 여러 권한 부여 영역으로 구성된 집계 영역에서 생성됩니다.
- 각 권한 부여 영역의 속성 값이 로드됩니다.
- 속성이 두 개 이상의 권한 부여 영역에 정의된 경우 처음 생성된 속성 값이 사용됩니다.
다음 예제에서는 여러 권한 부여 영역에 동일한 ID 속성에 대한 정의가 포함된 경우 ID가 생성되는 방법을 보여줍니다.
집계 영역 구성의 예
/subsystem=elytron/aggregate-realm=exampleSecurityRealm:add(authentication-realm=exampleLDAPRealm,authorization-realms=[exampleLDAPRealm,exampleFileSystemRealm])
이 예제에서 구성된 aggregate-realm
은 LDAP 영역인 "exampleLDAPRealm"과 파일 시스템 영역인 "exampleFilesystemRealm"이라는 두 개의 기존 보안 영역을 참조합니다.
LDAP 영역에서 얻은 속성 값입니다.
mail: administrator@example.com telephoneNumber: 0000 0000
파일 시스템 영역에서 얻은 속성 값입니다.
mail: user@example.com website: http://www.example.com/
집계 영역에서 얻은 결과 ID:
mail: administrator@example.com telephoneNumber: 0000 0000 website: http://www.example.com/
예제 aggregate-realm
은 LDAP 영역이 파일 시스템
영역보다 먼저 참조되므로 LDAP 영역에 정의된 속성의 값을 사용합니다.
추가 리소스
1.1.2. 집계 영역에 필요한 보안 영역을 생성하는 예
다음 예제에서는 ldap-realm
및 filesystem-realm
생성을 보여줍니다. 이러한 보안 영역은 집계-
현지에서 참조할 수 있습니다.
1.1.2.1. Elytron 예제에서 ldap-realm
생성
LDAP(Lightweight Directory Access Protocol) ID 저장소에서 지원하는 Elytron 보안 영역을 생성하여 JBoss EAP 서버 인터페이스 또는 서버에 배포된 애플리케이션을 보호합니다.
이 절차의 예에서는 다음 LDAP Data Interchange Format(LDIF)이 사용됩니다.
dn: ou=Users,dc=wildfly,dc=org objectClass: organizationalUnit objectClass: top ou: Users dn: uid=user1,ou=Users,dc=wildfly,dc=org objectClass: top objectClass: person objectClass: inetOrgPerson cn: user1 sn: user1 uid: user1 userPassword: passwordUser1 mail: administrator@example.com telephoneNumber: 0000 0000 dn: ou=Roles,dc=wildfly,dc=org objectclass: top objectclass: organizationalUnit ou: Roles dn: cn=Admin,ou=Roles,dc=wildfly,dc=org objectClass: top objectClass: groupOfNames cn: Admin member: uid=user1,ou=Users,dc=wildfly,dc=org
예제에 사용되는 LDAP 연결 매개변수는 다음과 같습니다.
-
LDAP URL:
ldap://10.88.0.2
LDAP 관리자 암호:
secret
Elytron은 LDAP 서버와 연결하려면 이 작업이 필요합니다.
-
LDAP 관리자 고유 이름(DN):
(cn=admin,dc=wildfly,dc=org)
LDAP 조직:
wildfly
조직 이름을 지정하지 않으면 기본값은
Example Inc
입니다.LDAP 도메인:
wildfly.org
이는 플랫폼에 LDAP 검색 참조가 수신될 때 일치하는 이름입니다.
사전 요구 사항
- LDAP ID 저장소를 구성했습니다.
- JBoss EAP가 실행 중입니다.
프로세스
LDAP 서버에 연결하는 데 사용되는 URL과 주체를 제공하는 디렉터리 컨텍스트를 구성합니다.
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)
예제
/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"}) {"outcome" => "success"}
디렉터리 컨텍스트를 참조하는 LDAP 영역을 생성합니다. Search Base DN과 사용자 매핑 방법을 지정합니다.
구문
/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})
예제
/subsystem=elytron/ldap-realm=exampleLDAPRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"},{from="mail",to="mail"},{from="telephoneNumber",to="telephoneNumber"}]}) {"outcome" => "success"}
이제 이 영역을 사용하여 보안 도메인을 생성하거나 페일오버-realm ,
의 다른 영역과 결합할 수 있습니다.
distributed-realm
또는 aggregate-realm
1.1.2.2. Ely tron에서 파일
시스템 생성 예
파일 시스템 기반 ID 저장소에서 지원하는 Elytron 보안 영역을 생성하여 JBoss EAP 서버 인터페이스 또는 서버에 배포된 애플리케이션을 보호합니다.
사전 요구 사항
- JBoss EAP가 실행 중입니다.
프로세스
Elytron에서
filesystem-realm
을 만듭니다.구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}
사용자를 영역에 추가하고 사용자 역할을 구성합니다.
사용자를 추가합니다.
구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity(identity=user1) {"outcome" => "success"}
사용자의 역할을 설정합니다.
구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>,name=<roles_attribute_name>, value=[<role_1>,<role_N>])
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}
사용자의 속성을 설정합니다.
구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>,name=<attribute_name>, value=[<attribute_value>])
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=mail, value=["user@example.com"]) /subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=website, value=["http://www.example.com/"])
이제 이 영역을 사용하여 보안 도메인을 생성하거나 페일오버-realm ,
의 다른 영역과 결합할 수 있습니다.
distributed-realm
또는 aggregate-realm
1.1.3. Elytron에서 집계-
현지 생성
권한을 위해 여러 보안 영역
의 인증 및 집계에 하나의 보안 영역을 사용하는 Elytron에 집계를 생성합니다. aggregate-realm
을 사용하여 관리 인터페이스 및 배포된 애플리케이션에 인증 및 권한 부여를 추가하는 보안 도메인을 생성합니다.
사전 요구 사항
- JBoss EAP가 실행 중입니다.
- 집계 영역에서 참조할 영역을 생성했습니다.
프로세스
기존 보안
영역에서 집계
를 생성합니다.구문
/subsystem=elytron/aggregate-realm=<aggregate_realm_name>:add(authentication-realm=<security_realm_for_authentication>, authorization-realms=[<security_realm_for_authorization_1>,<security_realm_for_authorization_2>,...,<security_realm_for_authorization_N>])
예제
/subsystem=elytron/aggregate-realm=exampleSecurityRealm:add(authentication-realm=exampleLDAPRealm,authorization-realms=[exampleLDAPRealm,exampleFileSystemRealm]) {"outcome" => "success"}
특성을 역할에 매핑하는 역할 디코더를 생성합니다.
구문
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)
예제
/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles) {"outcome" => "success"}
aggregate-realm
및 역할 디코더를 참조하는 보안 도메인을 생성합니다.구문
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<aggregate_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<aggregate_realm_name>,role-decoder="<role_decoder_name>"}])
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder="from-roles-attribute"}]) {"outcome" => "success"}
이제 생성된 보안 도메인을 사용하여 관리 인터페이스 및 애플리케이션에 인증 및 권한 부여를 추가할 수 있습니다. 자세한 내용은 관리 인터페이스 및 애플리케이션 보안을 참조하십시오.
1.2. 캐싱 영역 생성
1.2.1. Elytron의 캐싱 영역
Elytron은 보안 영역에서 인증 정보 조회의 결과를 캐시하는 캐싱-realm
을 제공합니다. caching-realm
은 LRU 또는 Least recentlyly Used 캐싱 전략을 사용하여 PasswordCredential
자격 증명을 캐시합니다. 이 경우 가장 많이 액세스하는 항목이 최대 항목 수에 도달하면 삭제됩니다.
다음 보안 영역에서 캐싱-realm
을 사용할 수 있습니다.
-
filesystem-realm
-
jdbc-realm
-
ldap-realm
- 사용자 정의 보안 영역
JBoss EAP 외부에서 인증 정보 소스를 변경하면 이러한 변경 사항은 기본 보안 영역에서 수신 대기를 지원하는 경우에만 JBoss EAP 캐싱 영역에 전달됩니다. ldap-realm
만 청취를 지원합니다. 그러나 ldap-realm
내의 역할과
같은 필터링된 속성은 수신 대기를 지원하지 않습니다.
캐싱 영역에 사용자 데이터의 올바른 캐시가 있는지 확인하려면 다음을 확인하십시오.
-
인증 정보 소스에서 사용자 속성을 수정한 후
caching-realm
캐시를 지웁니다. - 인증 정보 소스가 아닌 캐싱 영역을 통해 사용자 속성을 수정합니다.
캐싱 영역을 통해 사용자를 변경하는 것은 기술 프리뷰로만 제공됩니다. 기술 프리뷰 기능은 Red Hat 프로덕션 서비스 수준 계약(SLA)에서 지원하지 않으며, 기능상 완전하지 않을 수 있어 프로덕션에 사용하지 않는 것이 좋습니다. 이러한 기능을 사용하면 향후 제품 기능을 조기에 이용할 수 있어 개발 과정에서 고객이 기능을 테스트하고 피드백을 제공할 수 있습니다.
기술 프리뷰 기능에 대한 지원 범위에 대한 정보는 Red Hat 고객 포털에서 기술 프리뷰 기능 지원 범위를 참조하십시오.
1.2.2. Elytron 에서 캐싱
생성
JBoss EAP 서버 인터페이스 또는 서버에 배포된 애플리케이션을 보호하기 위해 영역을 참조하는 캐싱-realm
및 보안 도메인을 만듭니다.
캐싱 영역으로 구성된 ldap-realm
은 Active Directory를 지원하지 않습니다. 자세한 내용은 Elytron .NET Framework CLI를 통해 LDAP/AD 사용자 암호 변경을 참조하십시오.
사전 요구 사항
- 캐시할 보안 영역을 구성했습니다.
프로세스
캐시할 보안
영역을 참조하는 캐싱-realm
을 만듭니다.구문
/subsystem=elytron/caching-realm=<caching_realm_name>:add(realm=<realm_to_cache>)
예제
/subsystem=elytron/caching-realm=exampleSecurityRealm:add(realm=exampleLDAPRealm)
caching-realm
을 참조하는 보안 도메인을 생성합니다.구문
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<caching_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<caching_realm_name>,role-decoder="<role_decoder_name>"}])
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}
검증
Elytron이
caching-realm
에서 참조되는 보안 영역의 데이터를caching-realm
으로 로드할 수 있는지 확인하려면 다음 명령을 사용합니다.구문
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:read-identity(name=user1) { "outcome" => "success", "result" => { "name" => "user1", "attributes" => {"Roles" => ["Admin"]}, "roles" => ["Admin"] } }
이제 생성된 보안 도메인을 사용하여 관리 인터페이스 및 애플리케이션에 인증 및 권한 부여를 추가할 수 있습니다. 자세한 내용은 관리 인터페이스 및 애플리케이션 보안을 참조하십시오.
1.2.3. caching-realm
캐시 삭제
캐싱-realm
캐시를 지우면 Elytron이 보안 영역의 최신 데이터를 사용하여 캐시를 다시 채우도록 합니다.
사전 요구 사항
-
caching-realm
이 구성되어 있습니다.
프로세스
caching-realm
캐시를 지웁니다.구문
/subsystem=elytron/caching-realm=<caching_realm_name>:clear-cache
예제
/subsystem=elytron/caching-realm=exampleSecurityRealm:clear-cache
추가 리소스
1.3. 분산 영역 생성
1.3.1. Elytron의 분산 영역
분산 영역을 사용하면 기존 보안 영역을 참조하여 다양한 ID 저장소에서 검색할 수 있습니다. 가져온 ID는 인증 및 권한 부여 모두에 사용됩니다. Elytron은 분산 영역의 보안 영역을 distributed-realm
리소스에서 정의하는 순서대로 호출합니다.
분산-realm 구성의
예
/subsystem=elytron/distributed-realm=exampleSecurityRealm:add(realms=[exampleLDAPRealm,exampleFilesystemRealm])
이 예제에서 구성된 distributed-realm
은 두 개의 기존 보안 영역인 "exampleLDAPRealm", LDAP 영역인 "exampleFilesystemRealm"과 파일 시스템 영역인 "exampleFilesystemRealm"을 참조합니다. Elytron은 참조된 보안 영역을 다음과 같이 순차적으로 검색합니다.
- Elytron은 먼저 LDAP 영역에서 일치하는 ID를 검색합니다.
- Elytron이 일치하는 항목을 찾으면 인증이 성공합니다.
- Elytron이 일치하는 항목을 찾지 못하면 파일 시스템 영역을 검색합니다.
기본적으로 ID 저장소와 일치하기 전에 ID 저장소에 대한 연결이 실패하면 예외 Cryostat UnavailableException
과 함께 인증이 실패하고 더 이상 영역을 검색하지 않습니다. ignore-unavailable-realms
속성을 true
로 설정하여 이 동작을 변경할 수 있습니다. ignore-unavailable-realms
가 true
로 설정된 경우 ID 저장소에 대한 연결이 실패하면 Elytron은 나머지 영역을 계속 검색합니다.
ignore-unavailable-realms
가 true
로 설정된 경우emit-events
는 기본적으로 true
로 설정되므로 쿼리된 영역을 사용할 수 없는 경우 SecurityEvent
가 생성됩니다. emit-events
를 false
로 설정하여 이 기능을 끌 수 있습니다.
추가 리소스
1.3.2. 분산 영역에 필요한 보안 영역을 생성하는 예
다음 예제에서는 ldap-realm
및 filesystem-realm
생성을 보여줍니다. 이러한 보안 영역은 분산-현실
에서 참조할 수 있습니다.
1.3.2.1. Elytron 예제에서 ldap-realm
생성
LDAP(Lightweight Directory Access Protocol) ID 저장소에서 지원하는 Elytron 보안 영역을 생성하여 JBoss EAP 서버 인터페이스 또는 서버에 배포된 애플리케이션을 보호합니다.
이 절차의 예에서는 다음 LDAP Data Interchange Format(LDIF)이 사용됩니다.
dn: ou=Users,dc=wildfly,dc=org objectClass: organizationalUnit objectClass: top ou: Users dn: uid=user1,ou=Users,dc=wildfly,dc=org objectClass: top objectClass: person objectClass: inetOrgPerson cn: user1 sn: user1 uid: user1 userPassword: userPassword1 dn: ou=Roles,dc=wildfly,dc=org objectclass: top objectclass: organizationalUnit ou: Roles dn: cn=Admin,ou=Roles,dc=wildfly,dc=org objectClass: top objectClass: groupOfNames cn: Admin member: uid=user1,ou=Users,dc=wildfly,dc=org
예제에 사용되는 LDAP 연결 매개변수는 다음과 같습니다.
-
LDAP URL:
ldap://10.88.0.2
LDAP 관리자 암호:
secret
Elytron은 LDAP 서버와 연결하려면 이 작업이 필요합니다.
-
LDAP 관리자 고유 이름(DN):
(cn=admin,dc=wildfly,dc=org)
LDAP 조직:
wildfly
조직 이름을 지정하지 않으면 기본값은
Example Inc
입니다.LDAP 도메인:
wildfly.org
이는 플랫폼에 LDAP 검색 참조가 수신될 때 일치하는 이름입니다.
사전 요구 사항
- LDAP ID 저장소를 구성했습니다.
- JBoss EAP가 실행 중입니다.
프로세스
LDAP 서버에 연결하는 데 사용되는 URL과 주체를 제공하는 디렉터리 컨텍스트를 구성합니다.
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)
예제
/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"}) {"outcome" => "success"}
디렉터리 컨텍스트를 참조하는 LDAP 영역을 생성합니다. Search Base DN과 사용자 매핑 방법을 지정합니다.
구문
/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})
예제
/subsystem=elytron/ldap-realm=exampleLDAPRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]}) {"outcome" => "success"}
이제 이 영역을 사용하여 보안 도메인을 생성하거나 페일오버-realm ,
의 다른 영역과 결합할 수 있습니다. distributed-realm
또는 aggregate-realm
ldap
을 구성하여 조회 결과를 캐시하고 성능을 향상시킬 수도 있습니다.
-realm
에 대해 캐싱-realm
1.3.2.2. Ely tron에서 파일
시스템 생성 예
파일 시스템 기반 ID 저장소에서 지원하는 Elytron 보안 영역을 생성하여 JBoss EAP 서버 인터페이스 또는 서버에 배포된 애플리케이션을 보호합니다.
사전 요구 사항
- JBoss EAP가 실행 중입니다.
프로세스
Elytron에서
filesystem-realm
을 만듭니다.구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}
사용자를 영역에 추가하고 사용자 역할을 구성합니다.
사용자를 추가합니다.
구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity(identity=user2) {"outcome" => "success"}
사용자의 암호를 설정합니다.
구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:set-password(identity=user2, clear={password="passwordUser2"}) {"outcome" => "success"}
사용자의 역할을 설정합니다.
구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>, name=<roles_attribute_name>, value=[<role_1>,<role_N>])
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user2, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}
이제 이 영역을 사용하여 보안 도메인을 생성하거나 페일오버-realm ,
의 다른 영역과 결합할 수 있습니다.
distributed-realm
또는 aggregate-realm
1.3.3. Elytron에서 분산-
현지 생성
ID를 검색할 기존 보안 영역을 참조하는 Elytron에 분산-realm
을 만듭니다. distributed-realm
을 사용하여 관리 인터페이스 또는 서버에 배포된 애플리케이션에 인증 및 권한 부여를 추가하는 보안 도메인을 생성합니다.
사전 요구 사항
- JBoss EAP가 실행 중입니다.
-
distributed-realm
에서 참조할 영역을 생성했습니다.
프로세스
기존 보안 영역을 참조하는
distributed-realm
을 생성합니다.구문
/subsystem=elytron/distributed-realm=<distributed_realm_name>:add(realms=[<security_realm_1>, <security_realm_2>, ..., <security_realm_N>])
예제
/subsystem=elytron/distributed-realm=exampleSecurityRealm:add(realms=[exampleLDAPRealm, exampleFileSystemRealm]) {"outcome" => "success"}
특성을 역할에 매핑하는 역할 디코더를 생성합니다.
구문
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)
예제
/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles) {"outcome" => "success"}
distributed-realm
및 역할 디코더를 참조하는 보안 도메인을 생성합니다.구문
/subsystem=elytron/security-domain=<security_domain_name>:add(realms=[{realm=<distributed_realm_name>,role-decoder=<role_decoder_name>}],default-realm=<ldap_realm_name>,permission-mapper=<permission_mapper>)
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder="from-roles-attribute"}]) {"outcome" => "success"}
이제 생성된 보안 도메인을 사용하여 관리 인터페이스 및 애플리케이션에 인증 및 권한 부여를 추가할 수 있습니다. 자세한 내용은 관리 인터페이스 및 애플리케이션 보안을 참조하십시오.
1.4. 장애 조치 영역 생성
1.4.1. Elytron의 장애 조치 영역
하나의 보안 영역이 실패하는 경우 Elytron에서는 다른 하나를 백업으로 사용하도록 Elytron에서 두 개의 기존 보안 영역을 참조하는 장애 조치( failover) 보안 영역인 페일오버-realm
을 구성할 수 있습니다.
Elytron의 페일오버
는 다음 두 가지 보안 영역을 참조합니다.
-
delegate-realm
: 사용할 기본 보안 영역입니다. -
failover-realm
: 백업으로 사용할 보안 영역입니다.
페일오버-realm
구성 예
/subsystem=elytron/failover-realm=exampleSecurityRealm:add(delegate-realm=exampleLDAPRealm,failover-realm=exampleFileSystemRealm)
예제에서 ldap-realm
인 LDAPRealm
은 delegate realm 및 exampleFileSystemRealm
으로 사용됩니다. 이 방법은 filesystem-realm
인 failover-realm
으로 사용됩니다. ldap-realm
이 실패하는 경우 Elytron은 인증 및 권한 부여를 위해 filesystem-realm
을 사용합니다.
페일오버-realm
에서는 delegate
-realm이 호출됩니다. -realm
이 실패하는 경우에만 페일오버delegate
영역은 호출되지 않습니다. 여러 보안 영역에서 ID를 검색하려면 -realm
에 대한 연결이 성공하지만 필요한 ID를 찾을 수 없는 경우 장애 조치distributed-realm
을 사용합니다.
1.4.2. 장애 조치 영역에 필요한 보안 영역을 생성하는 예
다음 예제에서는 ldap-realm
및 filesystem-realm
생성을 보여줍니다. 이러한 보안 영역은 페일오버-realm
에서 참조할 수 있습니다.
1.4.2.1. Elytron 예제에서 ldap-realm
생성
LDAP(Lightweight Directory Access Protocol) ID 저장소에서 지원하는 Elytron 보안 영역을 생성하여 JBoss EAP 서버 인터페이스 또는 서버에 배포된 애플리케이션을 보호합니다.
이 절차의 예에서는 다음 LDAP Data Interchange Format(LDIF)이 사용됩니다.
dn: ou=Users,dc=wildfly,dc=org objectClass: organizationalUnit objectClass: top ou: Users dn: uid=user1,ou=Users,dc=wildfly,dc=org objectClass: top objectClass: person objectClass: inetOrgPerson cn: user1 sn: user1 uid: user1 userPassword: userPassword1 dn: ou=Roles,dc=wildfly,dc=org objectclass: top objectclass: organizationalUnit ou: Roles dn: cn=Admin,ou=Roles,dc=wildfly,dc=org objectClass: top objectClass: groupOfNames cn: Admin member: uid=user1,ou=Users,dc=wildfly,dc=org
예제에 사용되는 LDAP 연결 매개변수는 다음과 같습니다.
-
LDAP URL:
ldap://10.88.0.2
LDAP 관리자 암호:
secret
Elytron은 LDAP 서버와 연결하려면 이 작업이 필요합니다.
-
LDAP 관리자 고유 이름(DN):
(cn=admin,dc=wildfly,dc=org)
LDAP 조직:
wildfly
조직 이름을 지정하지 않으면 기본값은
Example Inc
입니다.LDAP 도메인:
wildfly.org
이는 플랫폼에 LDAP 검색 참조가 수신될 때 일치하는 이름입니다.
사전 요구 사항
- LDAP ID 저장소를 구성했습니다.
- JBoss EAP가 실행 중입니다.
프로세스
LDAP 서버에 연결하는 데 사용되는 URL과 주체를 제공하는 디렉터리 컨텍스트를 구성합니다.
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)
예제
/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"}) {"outcome" => "success"}
디렉터리 컨텍스트를 참조하는 LDAP 영역을 생성합니다. Search Base DN과 사용자 매핑 방법을 지정합니다.
구문
/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})
예제
/subsystem=elytron/ldap-realm=exampleLDAPRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]}) {"outcome" => "success"}
이제 이 영역을 사용하여 보안 도메인을 생성하거나 페일오버-realm ,
의 다른 영역과 결합할 수 있습니다. distributed-realm
또는 aggregate-realm
ldap
을 구성하여 조회 결과를 캐시하고 성능을 향상시킬 수도 있습니다.
-realm
에 대해 캐싱-realm
1.4.2.2. Ely tron에서 파일
시스템 생성 예
파일 시스템 기반 ID 저장소에서 지원하는 Elytron 보안 영역을 생성하여 JBoss EAP 서버 인터페이스 또는 서버에 배포된 애플리케이션을 보호합니다.
사전 요구 사항
- JBoss EAP가 실행 중입니다.
프로세스
Elytron에서
filesystem-realm
을 만듭니다.구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}
사용자를 영역에 추가하고 사용자 역할을 구성합니다.
사용자를 추가합니다.
구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity(identity=user1) {"outcome" => "success"}
사용자의 암호를 설정합니다.
구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:set-password(identity=user1, clear={password="passwordUser1"}) {"outcome" => "success"}
사용자의 역할을 설정합니다.
구문
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>,name=<roles_attribute_name>, value=[<role_1>,<role_N>])
예제
/subsystem=elytron/filesystem-realm=exampleFileSystemRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}
이제 이 영역을 사용하여 보안 도메인을 생성하거나 페일오버-realm ,
의 다른 영역과 결합할 수 있습니다.
distributed-realm
또는 aggregate-realm
1.4.3. Elytron에서 장애 조치(failover)
만들기
기존 보안 영역을 위임 영역, 사용할 기본 영역 및 페일오버 영역으로 참조하는 Elytron에 장애 조치(failover) 보안 영역을 만듭니다. Elytron은 위임 영역이 실패하는 경우 구성된 장애 조치 영역을 사용합니다. 보안 영역을 사용하여 관리 인터페이스 또는 서버에 배포된 애플리케이션에 인증 및 권한 부여를 추가하는 보안 도메인을 생성합니다.
사전 요구 사항
- JBoss EAP가 실행 중입니다.
- 위임 및 페일오버 영역으로 사용할 영역을 생성했습니다.
프로세스
기존 보안 영역에서
페일오버-realm
을 만듭니다.구문
/subsystem=elytron/failover-realm=<failover_realm_name>:add(delegate-realm=<realm_to_use_by_default>,failover-realm=<realm_to_use_as_backup>)
예제
/subsystem=elytron/failover-realm=exampleSecurityRealm:add(delegate-realm=exampleLDAPRealm,failover-realm=exampleFileSystemRealm) {"outcome" => "success"}
특성을 역할에 매핑하는 역할 디코더를 생성합니다.
구문
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)
예제
/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles) {"outcome" => "success"}
failover-realm
및 역할 디코더를 참조하는 보안 도메인을 생성합니다.구문
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<failover_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<failover_realm_name>,role-decoder="<role_decoder_name>"}])
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder="from-roles-attribute"}]) {"outcome" => "success"}
이제 생성된 보안 도메인을 사용하여 관리 인터페이스 및 애플리케이션에 인증 및 권한 부여를 추가할 수 있습니다. 자세한 내용은 관리 인터페이스 및 애플리케이션 보안을 참조하십시오.
1.5. JAAS 영역 생성
1.5.1. Elytron의 JAAS 영역
JAAS(Java Authentication and Authorization Service) 영역 jaas-realm
은 사용자의 인증 정보 확인 및 사용자 역할을 할당하기 위해 elytron
하위 시스템에서 사용자 정의 로그인 모듈을 구성하는 데 사용할 수 있는 보안 영역입니다.
jaas-realm
을 사용하여 JBoss EAP 관리 인터페이스와 배포된 애플리케이션을 모두 보호할 수 있습니다.
JAAS 영역은 JAAS 구성 파일에 지정된 로그인 모듈을 사용하는 javax.security.auth.login.LoginContext
를 초기화하여 사용자 자격 증명을 확인합니다.
로그인 모듈은 javax.security.auth.login.LoginContext.LoginModule
인터페이스의 구현입니다. 이러한 구현을 서버에 JBoss EAP 모듈로 추가하고 JAAS 구성 파일에 지정합니다.
JAAS 구성 파일의 예
test { 1 loginmodules.CustomLoginModule1 optional; 2 loginmodules.CustomLoginModule2 optional myOption1=true myOption2=exampleOption; 3 };
- 1
jaas-realm
을 구성할 때 사용하는 항목의 이름입니다.- 2
- 선택적 플래그가 있는 로그인 모듈입니다. JAAS에서 정의한 모든 플래그를 사용할 수 있습니다. 자세한 내용은 Oracle Java SE 문서의 JAAS 로그인 구성 파일을 참조하십시오.
- 3
- 선택적 플래그 및 옵션이 있는 로그인 모듈입니다.
로그인 모듈의 주체 매핑 및 역할 연관의 주체
제목의 주체를 사용하여 로그인 모듈에서 가져온 ID에 속성을 추가할 수 있습니다. 주체 는 인증된 사용자이며 주체는 제목에 포함된 사용자 이름과 같은 식별자입니다.
Elytron은 다음과 같이 ID를 확보하고 매핑합니다.
-
로그인 모듈은
javax.security.auth.Subject
를 사용하여 인증되는 주체 를 나타냅니다. -
주체 는 연결된
java.security.Principal
라는 여러 인스턴스가 있을 수 있습니다. -
Elytron은
org.wildfly.security.auth.server.SecurityIdentity
를 사용하여 인증된 사용자를 나타냅니다. Elytron은SecurityIdentity
의 적용을 받습니다.
주체의 주체는 다음 규칙을 사용하여 보안 ID의 속성에 매핑됩니다.
-
특성의
키는
principal.getClass().getSimpleName()
호출에서 가져온 간단한 클래스 이름입니다. -
값은
principal.getName()
호출에서 가져온 주요 's name)입니다. - 동일한 유형의 보안 주체s의 경우 속성 키 아래에 값이 컬렉션에 추가됩니다.
1.5.2. 사용자 정의 JAAS 로그인 모듈 개발
사용자 지정 JAAS(Java Authentication and Authorization Service) 로그인 모듈을 생성하여 사용자 정의 인증 및 권한 부여 기능을 구현할 수 있습니다.
Elytron 하위 시스템에서 jaas-realm
을 통해 사용자 지정 JAAS 로그인 모듈을 사용하여 JBoss EAP 관리 인터페이스 및 배포된 애플리케이션을 보호할 수 있습니다. 로그인 모듈은 배포의 일부가 아니며 JBoss EAP 모듈로 포함됩니다.
다음 절차는 예제로만 제공됩니다. 보안하려는 애플리케이션이 이미 있는 경우 이를 건너뛰고 애플리케이션에 인증 및 권한 부여 추가로 직접 이동할 수 있습니다.
1.5.2.1. JAAS 로그인 모듈 개발을 위한 Maven 프로젝트 생성
사용자 지정 JAAS(Java Authentication and Authorization Service) 로그인 모듈을 생성하려면 필요한 종속성 및 디렉터리 구조가 포함된 Maven 프로젝트를 생성합니다.
사전 요구 사항
- Maven이 설치되어 있어야 합니다. 자세한 내용은 Apache Maven 다운로드를 참조하십시오.
프로세스
CLI에서
mvn
명령을 사용하여 Maven 프로젝트를 설정합니다. 이 명령은 프로젝트에 대한 디렉터리 구조와pom.xml
구성 파일을 생성합니다.구문
$ mvn archetype:generate \ -DgroupId=<group-to-which-your-application-belongs> \ -DartifactId=<name-of-your-application> \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-simple \ -DinteractiveMode=false
예제
$ mvn archetype:generate \ -DgroupId=com.example.loginmodule \ -DartifactId=example-custom-login-module \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-simple \ -DinteractiveMode=false
애플리케이션 루트 디렉터리로 이동합니다.
구문
$ cd <name-of-your-application>
예제
$ cd example-custom-login-module
생성된
pom.xml
파일의 내용을 다음 텍스트로 바꿉니다.<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>custom.loginmodules</groupId> <artifactId>custom-login-modules</artifactId> <version>1.0</version> <dependencies> <dependency> <groupId>org.wildfly.security</groupId> <artifactId>wildfly-elytron</artifactId> <version>1.17.2.Final</version> </dependency> <dependency> <groupId>jakarta.security.enterprise</groupId> <artifactId>jakarta.security.enterprise-api</artifactId> <version>3.0.0</version> </dependency> </dependencies> <properties> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> </project>
이 예제에 필요하지 않으므로 디렉터리
사이트
및테스트를
제거합니다.$ rm -rf src/site/ $ rm -rf src/test/
검증
애플리케이션 루트 디렉터리에 다음 명령을 입력합니다.
$ mvn install
다음과 유사한 출력이 표시됩니다.
... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.404 s [INFO] Finished at: 2022-04-28T13:55:18+05:30 [INFO] ------------------------------------------------------------------------
이제 사용자 지정 JAAS 로그인 모듈을 생성할 수 있습니다.
1.5.2.2. 사용자 정의 JAAS 로그인 모듈 생성
javax.security.auth.spi.LoginModule
인터페이스를 구현하는 클래스를 생성하여 사용자 정의 JAAS(Java Authentication and Authorization Service) 로그인 모듈을 생성합니다. 또한 사용자 정의 로그인 모듈에 대한 플래그 및 옵션을 사용하여 JAAS 구성 파일을 생성합니다.
이 절차에서 < ;application_home >은 애플리케이션의 pom.xml
구성 파일이 포함된 디렉터리를 나타냅니다.
사전 요구 사항
Maven 프로젝트를 생성했습니다.
자세한 내용은 JAAS 로그인 모듈 개발을 위한 Maven 프로젝트 생성 을 참조하십시오.
프로세스
Java 파일을 저장할 디렉터리를 만듭니다.
구문
$ mkdir -p src/main/java/<path_based_on_artifactID>
예제
$ mkdir -p src/main/java/com/example/loginmodule
소스 파일이 포함된 디렉터리로 이동합니다.
구문
$ cd src/main/java/<path_based_on_groupID>
예제
$ cd src/main/java/com/example/loginmodule
생성된
App.java
파일을 삭제합니다.$ rm App.java
사용자 정의 로그인 모듈 소스에 대한
ExampleCustomLoginModule.java
파일을 생성합니다.package com.example.loginmodule; import org.wildfly.security.auth.principal.NamePrincipal; import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.LoginException; import javax.security.auth.spi.LoginModule; import java.io.IOException; import java.security.Principal; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class ExampleCustomLoginModule implements LoginModule { private final Map<String, char[]> usersMap = new HashMap<String, char[]>(); private Principal principal; private Subject subject; private CallbackHandler handler; /** * In this example, identities are created as fixed Strings. * * The identities are: * user1 has the password passwordUser1 * user2 has the password passwordUser2 * * Use these credentials when you secure management interfaces * or applications with this login module. * * In a production login module, you would get the identities * from a data source. * */ @Override public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) { this.subject = subject; this.handler = callbackHandler; this.usersMap.put("user1", "passwordUser1".toCharArray()); this.usersMap.put("user2", "passwordUser2".toCharArray()); } @Override public boolean login() throws LoginException { // obtain the incoming username and password from the callback handler NameCallback nameCallback = new NameCallback("Username"); PasswordCallback passwordCallback = new PasswordCallback("Password", false); Callback[] callbacks = new Callback[]{nameCallback, passwordCallback}; try { this.handler.handle(callbacks); } catch (UnsupportedCallbackException | IOException e) { throw new LoginException("Error handling callback: " + e.getMessage()); } final String username = nameCallback.getName(); this.principal = new NamePrincipal(username); final char[] password = passwordCallback.getPassword(); char[] storedPassword = this.usersMap.get(username); if (!Arrays.equals(storedPassword, password)) { throw new LoginException("Invalid password"); } else { return true; } } /** * user1 is assigned the roles Admin, User and Guest. * In a production login module, you would get the identities * from a data source. * */ @Override public boolean commit() throws LoginException { if (this.principal.getName().equals("user1")) { this.subject.getPrincipals().add(new Roles("Admin")); this.subject.getPrincipals().add(new Roles("User")); this.subject.getPrincipals().add(new Roles("Guest")); } return true; } @Override public boolean abort() throws LoginException { return true; } @Override public boolean logout() throws LoginException { this.subject.getPrincipals().clear(); return true; } /** * Principal with simple classname 'Roles' will be mapped to the identity's attribute with name 'Roles'. */ private static class Roles implements Principal { private final String name; Roles(final String name) { this.name = name; } /** * @return name of the principal. This will be added as a value to the identity's attribute which has a name equal to the simple name of this class. In this example, this value will be added to the attribute with a name 'Roles'. */ public String getName() { return this.name; } } }
< ;application_home > 디렉터리에서 JAAS 구성 파일
JAAS-login-modules.conf
를 만듭니다.exampleConfiguration { com.example.loginmodule.ExampleCustomLoginModule optional; };
-
exampleConfiguration
은 Entry 이름입니다. -
com.example.loginmodule.ExampleCustomLoginModule
은 로그인 모듈입니다. -
선택
사항은 플래그입니다.
-
로그인 모듈을 컴파일합니다.
$ mvn package ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.321 s [INFO] Finished at: 2022-04-28T14:16:03+05:30 [INFO] ------------------------------------------------------------------------
이제 로그인 모듈을 사용하여 JBoss EAP 관리 인터페이스 및 배포된 애플리케이션을 보호할 수 있습니다.
1.5.3. Elytron에서 jaas-realm
만들기
JAAS(Java Authentication and Authorization Service) 호환 사용자 로그인 모듈에서 지원하는 Elytron 보안 영역을 생성하여 JBoss EAP 서버 인터페이스 또는 배포된 애플리케이션을 보호합니다. 보안 영역을 사용하여 보안 도메인을 생성합니다.
사전 요구 사항
JAR로 사용자 정의 로그인 모듈을 패키징했습니다.
로그인 모듈 예제는 사용자 정의 JAAS 로그인 모듈 개발을 참조하십시오.
- JBoss EAP가 실행 중입니다.
프로세스
관리 CLI를 사용하여 로그인 모듈 JAR을 모듈로 추가합니다.
구문
module add --name=<name_of_the_login_moudle> --resources=<path_to_the_login_module_jar> --dependencies=org.wildfly.security.elytron
예제
module add --name=exampleLoginModule --resources=<path_to_login_module>/custom-login-modules-1.0.jar --dependencies=org.wildfly.security.elytron
로그인 모듈과 JAAS 로그인 구성 파일에서
jaas-realm
을 생성합니다.구문
/subsystem=elytron/jaas-realm=<jaas_realm_name>:add(entry=<entry-name>,path=<path_to_module_config_file>,module=<name_of_the_login_module>,callback-handler=<name_of_the_optional_callback_handler>)
예제
/subsystem=elytron/jaas-realm=exampleSecurityRealm:add(entry=exampleConfiguration,path=<path_to_login_module>/JAAS-login-modules.conf,module=exampleLoginModule)
jaas-realm
을 참조하는 보안 도메인을 만듭니다.구문
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<jaas_realm_name>,realms=[{realm=<jaas_realm_name>}],permission-mapper=default-permission-mapper)
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,realms=[{realm=exampleSecurityRealm}],permission-mapper=default-permission-mapper) {"outcome" => "success"}
이제 생성된 보안 도메인을 사용하여 관리 인터페이스 및 애플리케이션에 인증 및 권한 부여를 추가할 수 있습니다. 자세한 내용은 관리 인터페이스 및 애플리케이션 보안을 참조하십시오.
2장. 관리 인터페이스 및 애플리케이션 보안
2.1. 관리 인터페이스에 인증 및 권한 부여 추가
보안 도메인을 사용하여 이를 보호하기 위해 관리 인터페이스에 대한 인증 및 권한 부여를 추가할 수 있습니다. 인증 및 권한 부여를 추가한 후 관리 인터페이스에 액세스하려면 사용자가 로그인 자격 증명을 입력해야 합니다.
다음과 같이 JBoss EAP 관리 인터페이스를 보호할 수 있습니다.
관리 CLI
sasl-authentication-factory
를 구성하여.관리 콘솔
http-authentication-factory
를 구성하여 다음을 수행합니다.
사전 요구 사항
- 보안 영역을 참조하는 보안 도메인을 생성했습니다.
- JBoss EAP가 실행 중입니다.
프로세스
http-authentication-factory
또는sasl-authentication-factory
를 만듭니다.http-authentication-factory
를 생성합니다.구문
/subsystem=elytron/http-authentication-factory=<authentication_factory_name>:add(http-server-mechanism-factory=global, security-domain=<security_domain_name>, mechanism-configurations=[{mechanism-name=<mechanism-name>, mechanism-realm-configurations=[{realm-name=<realm_name>}]}])
예제
/subsystem=elytron/http-authentication-factory=exampleAuthenticationFactory:add(http-server-mechanism-factory=global, security-domain=exampleSecurityDomain, mechanism-configurations=[{mechanism-name=BASIC, mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}
sasl-authentication-factory
를 만듭니다.구문
/subsystem=elytron/sasl-authentication-factory=<sasl_authentication_factory_name>:add(security-domain=<security_domain>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=<mechanism-name>,mechanism-realm-configurations=[{realm-name=<realm_name>}]}])
예제
/subsystem=elytron/sasl-authentication-factory=exampleSaslAuthenticationFactory:add(security-domain=exampleSecurityDomain,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=PLAIN,mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}
관리 인터페이스를 업데이트합니다.
http-authentication-factory
를 사용하여 관리 콘솔을 보호합니다.구문
/core-service=management/management-interface=http-interface:write-attribute(name=http-authentication-factory, value=<authentication_factory_name>)
예제
/core-service=management/management-interface=http-interface:write-attribute(name=http-authentication-factory, value=exampleAuthenticationFactory) { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
sasl-authentication-factory
를 사용하여 관리 CLI를 보호합니다.구문
/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_authentication_factory>})
예제
/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=exampleSaslAuthenticationFactory}) { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
서버를 다시 로드합니다.
reload
검증
관리 콘솔에 인증 및 권한 부여가 필요한지 확인하려면
http://127.0.0.1:9990/console/index.html
에서 관리 콘솔로 이동합니다.사용자 이름과 암호를 입력하라는 메시지가 표시됩니다.
관리 CLI에 인증 및 권한 부여가 필요한지 확인하려면 다음 명령을 사용하여 관리 CLI를 시작합니다.
$ bin/jboss-cli.sh --connect
사용자 이름과 암호를 입력하라는 메시지가 표시됩니다.
2.2. 보안 도메인을 사용하여 애플리케이션 사용자를 인증 및 권한 부여
보안 영역을 참조하는 보안 도메인을 사용하여 애플리케이션 사용자를 인증하고 권한을 부여합니다. 애플리케이션 개발 절차는 예제로만 제공됩니다.
2.2.1. 집계-realm을 위한 간단한 웹 애플리케이션 개발
보안 영역 구성 예제와 함께 간단한 웹 애플리케이션을 생성할 수 있습니다.
다음 절차는 예제로만 제공됩니다. 보안하려는 애플리케이션이 이미 있는 경우 이를 건너뛰고 애플리케이션에 인증 및 권한 부여 추가로 직접 이동할 수 있습니다.
2.2.1.1. 웹 애플리케이션 개발을 위한 maven 프로젝트 생성
웹 애플리케이션을 생성하려면 필수 종속성 및 디렉터리 구조가 포함된 Maven 프로젝트를 생성합니다.
사전 요구 사항
- Maven이 설치되어 있어야 합니다. 자세한 내용은 Apache Maven 다운로드를 참조하십시오.
프로세스
mvn
명령을 사용하여 Maven 프로젝트를 설정합니다. 명령은 프로젝트에 대한 디렉터리 구조와pom.xml
구성 파일을 생성합니다.구문
$ mvn archetype:generate \ -DgroupId=${group-to-which-your-application-belongs} \ -DartifactId=${name-of-your-application} \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-webapp \ -DinteractiveMode=false
예제
$ mvn archetype:generate \ -DgroupId=com.example.app \ -DartifactId=simple-webapp-example \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-webapp \ -DinteractiveMode=false
애플리케이션 루트 디렉터리로 이동합니다.
구문
$ cd <name-of-your-application>
예제
$ cd simple-webapp-example
생성된
pom.xml
파일의 내용을 다음 텍스트로 바꿉니다.<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.app</groupId> <artifactId>simple-webapp-example</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <name>simple-webapp-example Maven Webapp</name> <!-- FIXME change it to the project's website --> <url>http://www.example.com</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>jakarta.servlet</groupId> <artifactId>jakarta.servlet-api</artifactId> <version>6.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.wildfly.security</groupId> <artifactId>wildfly-elytron-auth-server</artifactId> <version>1.19.0.Final</version> </dependency> </dependencies> <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.wildfly.plugins</groupId> <artifactId>wildfly-maven-plugin</artifactId> <version>2.1.0.Final</version> </plugin> </plugins> </build> </project>
검증
애플리케이션 루트 디렉터리에 다음 명령을 입력합니다.
$ mvn install
다음과 유사한 출력이 표시됩니다.
... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.795 s [INFO] Finished at: 2022-04-28T17:39:48+05:30 [INFO] ------------------------------------------------------------------------
이제 웹 애플리케이션을 생성할 수 있습니다.
2.2.1.2. 웹 애플리케이션 생성
로그인한 사용자의 주체 및 특성에서 얻은 사용자 이름을 반환하는 서블릿이 포함된 웹 애플리케이션을 생성합니다. 로그인한 사용자가 없는 경우 서블릿은 "NO AUTHENTICATED USER" 텍스트를 반환합니다.
사전 요구 사항
- Maven 프로젝트를 생성했습니다.
- JBoss EAP가 실행 중입니다.
프로세스
Java 파일을 저장할 디렉터리를 만듭니다.
구문
$ mkdir -p src/main/java/<path_based_on_artifactID>
예제
$ mkdir -p src/main/java/com/example/app
새 디렉터리로 이동합니다.
구문
$ cd src/main/java/<path_based_on_artifactID>
예제
$ cd src/main/java/com/example/app
다음 콘텐츠를 사용하여
SecuredServlet.java
파일을 생성합니다.package com.example.app; import java.io.IOException; import java.io.PrintWriter; import java.security.Principal; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Set; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.wildfly.security.auth.server.SecurityDomain; import org.wildfly.security.auth.server.SecurityIdentity; import org.wildfly.security.authz.Attributes; import org.wildfly.security.authz.Attributes.Entry; /** * A simple secured HTTP servlet. It returns the user name and * attributes obtained from the logged-in user's Principal. If * there is no logged-in user, it returns the text * "NO AUTHENTICATED USER". */ @WebServlet("/secured") public class SecuredServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try (PrintWriter writer = resp.getWriter()) { Principal user = req.getUserPrincipal(); SecurityIdentity identity = SecurityDomain.getCurrent().getCurrentSecurityIdentity(); Attributes identityAttributes = identity.getAttributes(); Set <String> keys = identityAttributes.keySet(); String attributes = "<ul>"; for (String attr : keys) { attributes += "<li> " + attr + " : " + identityAttributes.get(attr).toString() + "</li>"; } attributes+="</ul>"; writer.println("<html>"); writer.println(" <head><title>Secured Servlet</title></head>"); writer.println(" <body>"); writer.println(" <h1>Secured Servlet</h1>"); writer.println(" <p>"); writer.print(" Current Principal '"); writer.print(user != null ? user.getName() : "NO AUTHENTICATED USER"); writer.print("'"); writer.print(user != null ? "\n" + attributes : ""); writer.println(" </p>"); writer.println(" </body>"); writer.println("</html>"); } } }
애플리케이션 루트 디렉터리에서 다음 명령을 사용하여 애플리케이션을 컴파일합니다.
$ mvn package ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.015 s [INFO] Finished at: 2022-04-28T17:48:53+05:30 [INFO] ------------------------------------------------------------------------
애플리케이션을 배포합니다.
$ mvn wildfly:deploy
검증
브라우저에서
http://localhost:8080/simple-webapp-example/secured
로 이동합니다.다음 메시지가 표시됩니다.
Secured Servlet Current Principal 'NO AUTHENTICATED USER'
인증 메커니즘이 추가되지 않으므로 애플리케이션에 액세스할 수 있습니다.
이제 인증된 사용자만 액세스할 수 있도록 보안 도메인을 사용하여 이 애플리케이션을 보호할 수 있습니다.
2.2.2. 애플리케이션에 인증 및 권한 부여 추가
보안 도메인을 사용하여 웹 애플리케이션에 인증 및 권한 부여를 추가하여 보호할 수 있습니다. 인증 및 권한 부여를 추가한 후 웹 애플리케이션에 액세스하려면 사용자가 로그인 자격 증명을 입력해야 합니다.
사전 요구 사항
- 보안 영역을 참조하는 보안 도메인을 생성했습니다.
- JBoss EAP에 애플리케이션을 배포했습니다.
- JBoss EAP가 실행 중입니다.
프로세스
undertow 하위 시스템에서
application-security-domain
을 구성합니다.구문
/subsystem=undertow/application-security-domain=<application_security_domain_name>:add(security-domain=<security_domain_name>)
예제
/subsystem=undertow/application-security-domain=exampleApplicationSecurityDomain:add(security-domain=exampleSecurityDomain) {"outcome" => "success"}
애플리케이션 리소스를 보호하도록 애플리케이션의
web.xml
을 구성합니다.구문
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <!-- Define the security constraints for the application resources. Specify the URL pattern for which a challenge is --> <security-constraint> <web-resource-collection> <web-resource-name><!-- Name of the resources to protect --></web-resource-name> <url-pattern> <!-- The URL to protect --></url-pattern> </web-resource-collection> <!-- Define the role that can access the protected resource --> <auth-constraint> <role-name> <!-- Role name as defined in the security domain --></role-name> <!-- To disable authentication you can use the wildcard * To authenticate but allow any role, use the wildcard **. --> </auth-constraint> </security-constraint> <login-config> <auth-method> <!-- The authentication method to use. Can be: BASIC CLIENT-CERT DIGEST FORM SPNEGO --> </auth-method> <realm-name><!-- The name of realm to send in the challenge --></realm-name> </login-config> </web-app>
예제
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <!-- Define the security constraints for the application resources. Specify the URL pattern for which a challenge is --> <security-constraint> <web-resource-collection> <web-resource-name>all</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <!-- Define the role that can access the protected resource --> <auth-constraint> <role-name>Admin</role-name> <!-- To disable authentication you can use the wildcard * To authenticate but allow any role, use the wildcard **. --> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>exampleSecurityRealm</realm-name> </login-config> </web-app>
참고다른
auth-method
를 사용할 수 있습니다.애플리케이션에
jboss-web.xml
파일을 생성하거나undertow
하위 시스템에서 기본 보안 도메인을 설정하여 애플리케이션을 구성하십시오.애플리케이션의 article-
INF 디렉터리에
을 참조하는application-security-domain
jboss-web.xml
파일을 만듭니다.구문
<jboss-web> <security-domain> <!-- The security domain to associate with the application --></security-domain> </jboss-web>
예제
<jboss-web> <security-domain>exampleApplicationSecurityDomain</security-domain> </jboss-web>
애플리케이션의
undertow
하위 시스템에서 기본 보안 도메인을 설정합니다.구문
/subsystem=undertow:write-attribute(name=default-security-domain,value=<application_security_domain_to_use>)
예제
/subsystem=undertow:write-attribute(name=default-security-domain,value=exampleApplicationSecurityDomain) { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
서버를 다시 로드합니다.
reload
검증
애플리케이션 루트 디렉터리에서 다음 명령을 사용하여 애플리케이션을 컴파일합니다.
$ mvn package ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.015 s [INFO] Finished at: 2022-04-28T17:48:53+05:30 [INFO] ------------------------------------------------------------------------
애플리케이션을 배포합니다.
$ mvn wildfly:deploy
-
브라우저에서
http://localhost:8080/simple-webapp-example/secured
로 이동합니다. 이제 애플리케이션에 액세스하려면 인증이 필요함을 확인하는 로그인 프롬프트가 표시됩니다.
이제 보안 도메인을 사용하여 애플리케이션이 보호되며 사용자는 인증 후만 로그인할 수 있습니다. 또한 지정된 역할이 있는 사용자만 애플리케이션에 액세스할 수 있습니다.
3장. Elytron에서 감사 로깅 구성
Elytron을 사용하여 트리거 이벤트에 대한 보안 감사를 완료할 수 있습니다. 보안 감사는 권한 부여 또는 인증 시도에 대한 응답으로 로그에 대한 쓰기와 같은 이벤트를 트리거하는 것을 나타냅니다.
이벤트에서 수행되는 보안 감사 유형은 보안 영역 구성에 따라 다릅니다.
3.1. Elytron 감사 로깅
elytron
하위 시스템을 사용하여 감사 로깅을 활성화한 후 애플리케이션 서버 내에서 Elytron 인증 및 권한 부여 이벤트를 로깅할 수 있습니다. Elytron은 감사 로그 항목을 JSON
또는 ScanSetting PLE
형식으로 저장합니다. 사람이 읽을 수 있는 텍스트 형식 또는
에 개별 이벤트를 저장하기 위해 ScanSetting JSON
PLE
을 사용합니다.
Elytron 감사 로깅은 JBoss EAP 관리 인터페이스의 감사 로깅과 같은 다른 유형의 감사 로깅과 다릅니다.
Elytron은 기본적으로 감사 로깅을 비활성화하지만 다음 로그 처리기를 구성하여 감사 로깅을 활성화할 수 있습니다. 보안 도메인에 로그 처리기를 추가할 수도 있습니다.
파일 감사 로깅
자세한 내용은 Elytron에서 파일 감사 로깅 활성화를 참조하십시오.
주기적인 파일 감사 로깅
자세한 내용은 Elytron에서 정기적인 회전 파일 감사 로깅 활성화를 참조하십시오.
파일 감사 로깅 크기 교체
자세한 내용은 Elytron에서 크기 회전 파일 감사 로깅 활성화를 참조하십시오.
syslog
감사 로깅자세한 내용은 Elytron에서 syslog 감사 로깅 활성화를 참조하십시오.
사용자 정의 감사 로깅
자세한 내용은 Elytron에서 사용자 지정 보안 이벤트 리스너 사용을 참조하십시오.
aggregate-security-event-listener 리소스
를 사용하여 로거와 같은 더 많은 대상에 보안 이벤트를 보낼 수 있습니다. aggregate-security-event-listener 리소스는
집계 리스너 정의에 지정된 모든 리스너에 모든 이벤트를 제공합니다.
3.2. Elytron에서 파일 감사 로깅 활성화
파일 감사 로깅은 감사 로그 메시지를 파일 시스템 내의 단일 파일에 저장합니다.
기본적으로 Elytron은 local-audit
를 파일 감사 로거로 지정합니다.
독립 실행형 서버의 EAP_HOME/standalone/log/audit.log
또는 관리형 도메인에 대한 EAP_HOME/domain/log/audit.log
에 Elytron 감사 로그를 쓸 수 있도록 local-audit
를 활성화해야 합니다.
사전 요구 사항
애플리케이션을 보호했습니다.
자세한 내용은 Elytron에서
집계 영역
생성 을 참조하십시오.
프로세스
파일 감사 로그를 생성합니다.
구문
/subsystem=elytron/file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<format_type>,synchronized=<whether_to_log_immediately>)
예제
/subsystem=elytron/file-audit-log=exampleFileAuditLog:add(path="file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true)
보안 도메인에 파일 감사 로그를 추가합니다.
구문
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<audit_log_name>)
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleFileAuditLog)
검증
브라우저에서 보안 애플리케이션에 로그인합니다.
예를 들어 보안 도메인을 사용하여 애플리케이션 사용자를 인증하고 권한을 부여하는 데 생성된 애플리케이션에 로그인하려면 http://localhost:8080/simple-webapp-example/secured 로 이동한 후 로그인합니다.
감사 로그를 저장하도록 구성된 디렉터리로 이동합니다. 프로세스에서 예제 명령을 사용하는 경우 디렉터리는 EAP_HOME/standalone/log입니다.
file-audit.log
파일이 생성됩니다. 애플리케이션에 로그인하여 트리거한 이벤트의 로그를 포함합니다.file-audit.log 파일 예
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}
추가 리소스
3.3. Elytron에서 주기적으로 파일 감사 로깅 활성화
elytron
하위 시스템을 사용하여 독립 실행형 서버에 대해 주기적으로 파일 감사 로깅을 활성화하거나 관리형 도메인으로 실행되는 서버를 활성화할 수 있습니다.
정기적으로 파일 감사 로깅을 순환하면 구성된 일정에 따라 감사 로그 파일이 자동으로 순환됩니다. 주기적으로 파일 감사 로깅은 기본 파일 감사 로깅과 유사하지만 주기적으로 파일 감사 로깅에는 추가 속성인 접미사
가 포함되어 있습니다.
접미사
특성의 값은 .yyyy-MM-dd
와 같은 java.time.format.DateTimeFormatter
형식을 사용하여 지정된 날짜입니다. Elytron은 접미사로 제공된 값에서 순환 기간을 자동으로 계산합니다. elytron
하위 시스템은 로그 파일 이름의 끝에 접미사를 추가합니다.
사전 요구 사항
애플리케이션을 보호했습니다.
자세한 내용은 Elytron에서
집계 영역
생성 을 참조하십시오.
프로세스
주기적인 회전 파일 감사 로그를 생성합니다.
구문
/subsystem=elytron/periodic-rotating-file-audit-log=<periodic_audit_log_name>:add(path="<periodic_audit_log_filename>",format=<record_format>,synchronized=<whether_to_log_immediately>,suffix="<suffix_in_DateTimeFormatter_format>")
예제
/subsystem=elytron/periodic-rotating-file-audit-log=examplePreiodicFileAuditLog:add(path="periodic-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,suffix="yyyy-MM-dd")
보안 도메인에 주기적으로 파일 감사 로거를 추가합니다.
구문
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<periodic_audit_log_name>)
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=examplePreiodicFileAuditLog)
검증
브라우저에서 보안 애플리케이션에 로그인합니다.
예를 들어 보안 도메인을 사용하여 애플리케이션 사용자를 인증하고 권한을 부여하는 데 생성된 애플리케이션에 로그인하려면 http://localhost:8080/simple-webapp-example/secured 로 이동한 후 로그인합니다.
감사 로그를 저장하도록 구성된 디렉터리로 이동합니다. 프로세스에서 예제 명령을 사용하는 경우 디렉터리는 EAP_HOME/standalone/log입니다.
periodic-file-audit.log
라는 파일이 생성됩니다. 애플리케이션에 로그인하여 트리거한 이벤트의 로그를 포함합니다.periodic-file-audit.log 파일의 예
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}
3.4. Elytron에서 크기 회전 파일 감사 로깅 활성화
elytron
하위 시스템을 사용하여 독립 실행형 서버의 크기 회전 파일 감사 로깅 또는 관리형 도메인으로 실행되는 서버를 활성화할 수 있습니다.
로그 파일이 구성된 파일 크기에 도달하면 감사 로그 파일을 자동으로 회전합니다. 파일 감사 로깅 크기 교체는 기본 파일 감사 로깅과 유사하지만 크기 회전 파일 감사 로깅에는 추가 속성이 포함됩니다.
로그 파일 크기가 rotate-size
특성에 정의된 제한을 초과하면 Elytron은 접미사 .1
을 현재 파일의 끝에 추가하고 새 로그 파일을 만듭니다. 기존 로그 파일마다 Elytron이 접미사를 하나씩 늘립니다. 예를 들어 Elytron은 audit_log.1
의 이름을 audit_log.2
로 변경합니다. Elytron은 로그 파일 양이 max-backup-index
로 정의된 대로 최대 로그 파일 수에 도달할 때까지 계속 증가합니다. 로그 파일이 max-backup-index
값을 초과하면 Elytron은 파일을 제거합니다. 예를 들어 max-backup-index
가 "98"를 max-backup-index
값으로 정의하는 경우 audit_log.99
파일은 제한을 초과합니다.
사전 요구 사항
애플리케이션을 보호했습니다.
자세한 내용은 Elytron에서
집계 영역
생성 을 참조하십시오.
프로세스
크기 회전 파일 감사 로그를 생성합니다.
구문
/subsystem=elytron/size-rotating-file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<record_format>,synchronized=<whether_to_log_immediately>,rotate-size="<max_file_size_before_rotation>",max-backup-index=<max_number_of_backup_files>)
예제
/subsystem=elytron/size-rotating-file-audit-log=exampleSizeFileAuditLog:add(path="size-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,rotate-size="10m",max-backup-index=10)
보안 도메인에 감사 로거 크기 교체를 추가합니다.
구문
/subsystem=elytron/security-domain=<domain_size_logger>:write-attribute(name=security-event-listener,value=<audit_log_name>)
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSizeFileAuditLog)
검증
브라우저에서 보안 애플리케이션에 로그인합니다.
예를 들어 보안 도메인을 사용하여 애플리케이션 사용자를 인증하고 권한을 부여하는 데 생성된 애플리케이션에 로그인하려면 http://localhost:8080/simple-webapp-example/secured 로 이동한 후 로그인합니다.
감사 로그를 저장하도록 구성된 디렉터리로 이동합니다. 프로세스에서 예제 명령을 사용하는 경우 디렉터리는 EAP_HOME/standalone/log입니다.
size-file-audit.log
라는 파일이 생성됩니다. 애플리케이션에 로그인하여 트리거한 이벤트의 로그를 포함합니다.size-file-audit.log 파일의 예
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}
3.5. Elytron에서 syslog 감사 로깅 활성화
elytron
하위 시스템을 사용하여 독립 실행형 서버에 대해 syslog
감사 로깅을 활성화하거나 관리형 도메인으로 실행되는 서버를 활성화할 수 있습니다. syslog
감사 로깅을 사용하는 경우 로깅 결과를 syslog
서버에 보내 로컬 파일에 로깅하는 것보다 더 많은 보안 옵션을 제공합니다.
처리기는 syslog 서버의 호스트 이름 및 syslog
syslog
서버가 수신 대기하는 포트와 같은 syslog
서버에 연결하는 데 사용되는 매개변수를 지정합니다. 여러 syslog
처리기를 정의하고 동시에 활성화할 수 있습니다.
지원되는 로그 형식에는 RFC5424
및 RFC3164
가 포함됩니다. 지원되는 전송 프로토콜에는 UDP, TCP 및 SSL을 사용하는 TCP가 포함됩니다.
첫 번째 인스턴스에 대한 syslog
를 정의할 때 로거는 다음 예와 같이 메시지를 syslog
서버로 포함하는 INFORMATIONAL
우선순위 이벤트를 보냅니다.
"Elytron audit logging enabled with RFC format: <format>"
<format
>은 감사 로깅 처리기에 대해 구성된 RFC(Request for Comments) 형식을 나타내며 기본값은 RFC5424
입니다.
사전 요구 사항
애플리케이션을 보호했습니다.
자세한 내용은 Elytron에서
집계 영역
생성 을 참조하십시오.
프로세스
syslog
처리기를 추가합니다.구문
/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(host-name=<record_host_name>,port=<syslog_server_port_number>,server-address=<syslog_server_address>,format=<record_format>, transport=<transport_layer_protocol>)
TLS를 통해
syslog
서버에 로그를 보낼 수도 있습니다.TLS를 통해 로그를 전송하기 위한
syslog
구성의 구문/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(transport=SSL_TCP,server-address=<syslog_server_address>,port=<syslog_server_port_number>,host-name=<record_host_name>,ssl-context=<client_ssl_context>)
보안 도메인에
syslog
감사 로거를 추가합니다.구문
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<syslog_audit_log_name>)
예제
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSyslog)
3.6. Elytron에서 사용자 정의 보안 이벤트 리스너 사용
Elytron을 사용하여 사용자 지정 이벤트 리스너를 정의할 수 있습니다. 사용자 정의 이벤트 리스너는 들어오는 보안 이벤트를 처리합니다. 사용자 정의 감사 로깅 목적으로 이벤트 리스너를 사용하거나 이벤트 리스너를 사용하여 내부 ID 스토리지에 대해 사용자를 인증할 수 있습니다.
모듈 관리 CLI 명령을 사용하여 모듈을 추가 및 제거하는 기능은 기술 프리뷰 기능으로만 제공됩니다.
module
명령은 관리형 도메인에서 또는 원격 관리 CLI와 연결할 때 사용하기에 적합하지 않습니다. 프로덕션 환경에서 모듈을 수동으로 추가하거나 제거해야 합니다.
기술 프리뷰 기능은 Red Hat 프로덕션 서비스 수준 계약(SLA)에서 지원되지 않으며 기능적으로 완전하지 않을 수 있으며 프로덕션에 사용하지 않는 것이 좋습니다. 이러한 기능을 사용하면 향후 제품 기능을 조기에 이용할 수 있어 개발 과정에서 고객이 기능을 테스트하고 피드백을 제공할 수 있습니다.
기술 프리뷰 기능에 대한 지원 범위에 대한 정보는 Red Hat 고객 포털에서 기술 프리뷰 기능 지원 범위를 참조하십시오.
사전 요구 사항
애플리케이션을 보호했습니다.
자세한 내용은 Elytron에서
집계 영역
생성 을 참조하십시오.
프로세스
java.util.function.Consumer<org.wildfly.security.auth.event.SecurityEvent
> 인터페이스를 구현하는 클래스를 생성합니다.지정된 인터페이스를 사용하는 Java 클래스를 생성하는 예:
public class MySecurityEventListener implements Consumer<SecurityEvent> { public void accept(SecurityEvent securityEvent) { if (securityEvent instanceof SecurityAuthenticationSuccessfulEvent) { System.err.printf("Authenticated user \"%s\"\n", securityEvent.getSecurityIdentity().getPrincipal()); } else if (securityEvent instanceof SecurityAuthenticationFailedEvent) { System.err.printf("Failed authentication as user \"%s\"\n", ((SecurityAuthenticationFailedEvent)securityEvent).getPrincipal()); } } }
예제의 Java 클래스는 사용자가 인증에 성공하거나 실패할 때마다 메시지를 출력합니다.
사용자 지정 이벤트 리스너를 JBoss EAP에 모듈로 제공하는 JAR 파일을 추가합니다.
다음은 사용자 정의 이벤트 리스너를 Elytron에 모듈로 추가하는 관리 CLI 명령의 예입니다.
모듈
명령을 사용하여 사용자 지정 이벤트 리스너를 Elytron에 모듈로 추가하는 예제입니다./subsystem=elytron/custom-security-event-listener=<listener_name>:add(module=<module_name>, class-name=<class_name>)
보안 도메인의 사용자 지정 이벤트 리스너를 참조합니다.
ApplicationDomain
에서 사용자 지정 이벤트 리스너를 참조하는 예:/subsystem=elytron/security-domain=<domain_name>:write-attribute(name=security-event-listener, value=<listener_name>)
서버를 다시 시작합니다.
$ reload
이벤트 리스너는 지정된 보안 도메인에서 보안 이벤트를 수신합니다.
4장. reference
4.1. aggregate-realm
속성
해당 속성을 설정하여 aggregate-realm
을 구성할 수 있습니다.
표 4.1. aggregate-realm sttributes
속성 | 설명 |
---|---|
authentication-realm | 인증 단계에 사용할 보안 영역에 대한 참조입니다. 이는 자격 증명을 가져오거나 검증하는 데 사용됩니다. |
authorization-realm | 권한 부여 단계를 위해 ID를 로드하는 데 사용할 보안 영역에 대한 참조입니다. |
authorization-realms | 권한 부여 단계를 위해 ID를 로드하기 위해 집계할 보안 영역에 대한 참조입니다. 속성이 두 개 이상의 권한 부여 영역에 정의된 경우 처음 생성된 속성 값이 사용됩니다. |
principal-transformer | 인증을 위해 ID를 로드하고 권한 부여를 위해 ID를 로드하는 사이에 적용되는 주요 변환기에 대한 참조입니다. |
authorization-realm
및 authorization-realms
속성은 함께 사용할 수 없습니다. 영역에 두 속성 중 하나만 정의합니다.
4.2. caching-realm
속성
속성을 설정하여 caching-realm
을 구성할 수 있습니다.
표 4.2. caching-realm 속성
속성 | 설명 |
---|---|
maximum-age |
항목이 캐시에 남아 있을 수 있는 시간(밀리초)입니다. 값 |
maximum-entries |
캐시에 저장할 최대 항목 수입니다. 기본값은 |
realm |
|
4.3. distributed-realm
속성
속성을 설정하여 distributed-realm
을 구성할 수 있습니다.
표 4.3. distributed-realm 속성
속성 | 설명 |
---|---|
emit-events |
|
ignore-unavailable-realms |
ID 저장소에 대한 연결이 실패하면 후속 영역을 확인해야 하는지 여부입니다. 값을
값을 |
realms | 검색할 보안 영역 목록입니다. 보안 영역은 이 속성에서 제공되는 순서대로 순차적으로 호출됩니다. |
4.4. failover-realm
속성
특성을 설정하여 페일오버-realm
을 구성할 수 있습니다.
표 4.4. failover-realm 속성
속성 | 설명 |
---|---|
delegate-realm | 기본적으로 사용할 보안 영역입니다. |
emit-events |
|
failover-realm |
|
4.5. file-audit-log
속성
표 4.5. file-audit-log 속성
속성 | 설명 |
---|---|
|
모든 감사 이벤트 이후 출력 스트림에 플러시가 필요한지 여부를 지정합니다. 특성을 정의하지 않으면 |
|
감사 파일 인코딩을 지정합니다. 기본값은
|
|
기본값은 ScanSetting |
| 로그 파일의 위치를 정의합니다. |
| 선택적 속성입니다. 로그 파일의 위치를 정의합니다. |
|
기본값은 |
4.6. HTTP-authentication-factory
속성
속성을 설정하여 http-authentication-factory
를 구성할 수 있습니다.
표 4.6. HTTP-authentication-factory 속성
속성 | 설명 |
---|---|
http-server-mechanism-factory |
이 |
mechanism-configurations | 메커니즘별 구성 목록입니다. |
security-domain | 리소스와 연결할 보안 도메인입니다. |
표 4.7. HTTP-authentication-factory mechanism-configurations 속성
속성 | 설명 |
---|---|
credential-security-factory | 메커니즘에 필요한 대로 인증 정보를 얻는 데 사용할 보안 팩토리입니다. |
final-principal-transformer | 이 메커니즘 영역에 적용할 최종 주요 변환기입니다. |
host-name | 이 구성이 적용되는 호스트 이름입니다. |
mechanism-name | 이 구성은 지정된 이름의 메커니즘이 사용되는 경우에만 적용됩니다. 이 속성이 생략되면 모든 메커니즘 이름과 일치합니다. |
mechanism-realm-configurations | 메커니즘에서 이해할 수 있는 영역 이름의 정의 목록입니다. |
pre-realm-principal-transformer | 영역을 선택하기 전에 적용할 주요 변환기입니다. |
post-realm-principal-transformer | 영역을 선택한 후 적용할 주요 변환기입니다. |
프로토콜 | 이 구성이 적용되는 프로토콜입니다. |
realm-mapper | 메커니즘에서 사용할 영역 매퍼입니다. |
표 4.8. HTTP-authentication-factory mechanism-configurations mechanism-realm-configurations 속성
속성 | 설명 |
---|---|
final-principal-transformer | 이 메커니즘 영역에 적용할 최종 주요 변환기입니다. |
post-realm-principal-transformer | 영역을 선택한 후 적용할 주요 변환기입니다. |
pre-realm-principal-transformer | 영역을 선택하기 전에 적용할 주요 변환기입니다. |
realm-mapper | 메커니즘에서 사용할 영역 매퍼입니다. |
realm-name | 메커니즘에서 제공할 영역의 이름입니다. |
4.7. JAAS-realm
속성
속성을 설정하여 jaas-realm
을 구성할 수 있습니다. 항목을
제외한 모든 속성은 선택 사항입니다.
표 4.9. JAAS-realm
속성
attribute | description |
---|---|
|
로그인 컨텍스트와 함께 사용할 콜백 처리기입니다. 보안 속성 |
|
|
|
사용자 지정 |
|
JAAS 구성 파일의 선택적 경로입니다. java 시스템 속성 |
|
|
4.8. 모듈
명령 인수
모듈
명령에 다른 인수를 사용할 수 있습니다.
표 4.10. 모듈 명령 인수
인수 | 설명 |
---|---|
--absolute-resources |
이 인수를 사용하여
구분 기호 세부 정보는 |
--allow-nonexistent-resources |
이 인수를 사용하여 |
--dependencies | 이 인수를 사용하여 이 모듈이 사용하는 쉼표로 구분된 모듈 이름 목록을 제공합니다. |
--export-dependencies | 내보낸 종속 항목을 지정하려면 이 인수를 사용합니다. module add --name=com.mysql --resources=/path/to/{MySQLDriverJarName} --export-dependencies=wildflyee.api,java.se
|
--main-class | 이 인수를 사용하여 모듈의 main 메서드를 선언하는 정규화된 클래스 이름을 지정합니다. |
--module-root-dir |
기본EAP module add --module-root-dir=/path/to/my-external-modules/ --name=com.mysql --resources=/path/to/{MySQLDriverJarName} --dependencies=wildflyee.api,java.se |
--module-xml |
이 인수를 사용하여 이 새 모듈에 사용할 |
--name | 이 인수를 사용하여 추가할 모듈의 이름을 제공합니다. 이 인수가 필요합니다. |
--properties |
이 인수를 사용하여 모듈 속성을 정의하는 쉼표로 구분된 |
--resource-delimiter |
이 인수를 사용하여 |
--resources |
파일 시스템 경로 목록을 제공하여 이 모듈의 리소스를 지정하려면 이 인수를 사용합니다. 파일은 이 모듈 디렉터리에 복사되고 해당
구분 기호 세부 정보는 |
--slot |
기본 module add --name=com.mysql --slot=8.0 --resources=/path/to/{MySQLDriverJarName} --dependencies=wildflyee.api,java.se
|
4.9. periodic-rotating-file-audit-log
속성
표 4.11. periodic-rotating-file-audit-log 속성
속성 | 설명 |
---|---|
|
모든 감사 이벤트 이후 출력 스트림에 플러시가 필요한지 여부를 지정합니다. 특성을 정의하지 않으면 |
|
감사 파일 인코딩을 지정합니다. 기본값은
|
|
사람이 읽을 수 있는 텍스트 형식 또는 |
| 로그 파일의 위치를 정의합니다. |
| 선택적 속성입니다. 로그 파일의 위치를 정의합니다. |
|
선택적 속성입니다. 순환된 로그에 날짜 접미사를 추가합니다. |
|
기본값은 |
4.10. SASL-authentication-factory
속성
sasl-authentication-factory
는 특성을 설정하여 구성할 수 있습니다.
표 4.12. SASL-authentication-factory 속성
속성 | 설명 |
---|---|
mechanism-configurations | 메커니즘별 구성 목록입니다. |
sasl-server-factory | 이 리소스와 연결할 SASL 서버 팩토리입니다. |
security-domain | 이 리소스와 연결할 보안 도메인입니다. |
표 4.13. SASL-authentication-factory mechanism-configurations 속성
속성 | 설명 |
---|---|
credential-security-factory | 메커니즘에 필요한 대로 인증 정보를 얻는 데 사용할 보안 팩토리입니다. |
final-principal-transformer | 이 메커니즘 영역에 적용할 최종 주요 변환기입니다. |
host-name | 이 구성이 적용되는 호스트 이름입니다. |
mechanism-name | 이 구성은 지정된 이름의 메커니즘이 사용되는 경우에만 적용됩니다. 이 속성이 생략되면 모든 메커니즘 이름과 일치합니다. |
mechanism-realm-configurations | 메커니즘에서 이해할 수 있는 영역 이름의 정의 목록입니다. |
프로토콜 | 이 구성이 적용되는 프로토콜입니다. |
post-realm-principal-transformer | 영역을 선택한 후 적용할 주요 변환기입니다. |
pre-realm-principal-transformer | 영역을 선택하기 전에 적용할 주요 변환기입니다. |
realm-mapper | 메커니즘에서 사용할 영역 매퍼입니다. |
표 4.14. SASL-authentication-factory mechanism-configurations-realm-configurations 속성
속성 | 설명 |
---|---|
final-principal-transformer | 이 메커니즘 영역에 적용할 최종 주요 변환기입니다. |
post-realm-principal-transformer | 영역을 선택한 후 적용할 주요 변환기입니다. |
pre-realm-principal-transformer | 영역을 선택하기 전에 적용할 주요 변환기입니다. |
realm-mapper | 메커니즘에서 사용할 영역 매퍼입니다. |
realm-name | 메커니즘에서 제공할 영역의 이름입니다. |
4.11. security-domain
속성
속성을 설정하여 security-domain
을 구성할 수 있습니다.
속성 | 설명 |
---|---|
default-realm | 이 보안 도메인에 포함된 기본 영역입니다. |
evidence-decoder | 이 도메인에서 사용할 EvidenceDecoder에 대한 참조입니다. |
outflow-anonymous | 이 속성은 다음 시나리오에서 발생하는 익명 ID를 보안 도메인에 대한 outflow를 사용할 수 없는지 여부를 지정합니다.
익명 ID는 해당 도메인에 대해 이전에 설정한 ID를 지웁니다. |
outflow-security-domains | 이 도메인의 보안 ID가 자동으로 흐름을 해제해야 하는 보안 도메인 목록입니다. |
permission-mapper | 이 도메인에서 사용할 PermissionMapper에 대한 참조입니다. |
post-realm-principal-transformer | 제공된 ID 이름에서 작동한 후 적용할 주요 변환기에 대한 참조입니다. |
pre-realm-principal-transformer | 영역을 선택하기 전에 적용할 주체 변환기에 대한 참조입니다. |
principal-decoder | 이 도메인에서 사용할 PrincipalDecoder에 대한 참조입니다. |
realm-mapper | 이 도메인에서 사용할 CryostatMapper에 대한 참조입니다. |
realms | 이 보안 도메인에 포함된 영역 목록입니다. |
role-decoder | 이 도메인에서 사용할 RoleDecoder에 대한 참조입니다. |
role-mapper | 이 도메인에서 사용할 RoleMapper에 대한 참조입니다. |
security-event-listener | 보안 이벤트에 대한 리스너에 대한 참조입니다. |
trusted-security-domains | 이 보안 도메인에서 신뢰하는 보안 도메인의 목록입니다. |
trusted-virtual-security-domains | 이 보안 도메인에서 신뢰하는 가상 보안 도메인 목록입니다. |
4.12. simple-role-decoder
특성
특성을 설정하여 간단한 역할 디코더를 구성할 수 있습니다.
표 4.15. simple-role-decoder 특성
속성 | 설명 |
---|---|
attribute | 역할에 직접 매핑할 ID의 속성 이름입니다. |
4.13. size-rotating-file-audit-log
속성
표 4.16. size-rotating-file-audit-log 속성
속성 | 설명 |
---|---|
|
모든 감사 이벤트 이후 출력 스트림에 플러시가 필요한지 여부를 지정합니다. 특성을 정의하지 않으면 |
|
감사 파일 인코딩을 지정합니다. 기본값은
|
|
기본값은 ScanSetting |
|
회전할 때 백업할 최대 파일 수입니다. 기본값은 |
| 로그 파일의 위치를 정의합니다. |
| 선택적 속성입니다. 로그 파일의 위치를 정의합니다. |
|
기본적으로 Elytron은 서버를 다시 시작할 때 새 로그 파일을 생성하지 않습니다. 서버 재시작 시 로그를 교체하려면 이 속성을 |
|
Elytron이 로그를 교체하기 전에 로그 파일에 도달할 수 있는 최대 크기입니다. 기본값은 10 MB의 경우 |
|
선택적 속성입니다. 순환된 로그에 날짜 접미사를 추가합니다. |
|
기본값은 |
4.14. syslog-audit-log
속성
표 4.17. syslog-audit-log 속성
속성 | 설명 |
---|---|
| 감사 이벤트가 기록된 형식입니다. 지원되는 값:
기본값:
|
| syslog 서버로 전송된 모든 이벤트에 포함할 호스트 이름입니다. |
|
|
|
Elytron이 연결을 닫기 전에 연속 메시지를 지원되는 값:
기본값:
|
|
|
|
|
| 감사 이벤트를 설명하는 데 사용할 RFC 형식입니다. 지원되는 값:
기본값:
|
|
지원되는 값:
기본값:
|