5장. Apicurio 레지스트리 배포 보안
Apicurio Registry는 OpenID Connect(OIDC) 및 HTTP 기본 설정에 따라 Red Hat Single Sign-On을 사용하여 인증 및 권한 부여를 제공합니다. Red Hat Single Sign-On Operator를 사용하여 필요한 설정을 자동으로 구성하거나 Red Hat Single Sign-On 및 Apicurio Registry에서 수동으로 설정할 수 있습니다.
또한 Apicurio Registry는 OpenID Connect(OIDC) 및 OAuth 인증 코드 흐름을 기반으로 Microsoft Azure Active Directory를 사용하여 인증 및 권한 부여를 제공합니다. Azure AD 및 Apicurio 레지스트리에서 필요한 설정을 수동으로 구성할 수 있습니다.
Red Hat Single Sign-On 또는 Azure AD의 역할 기반 권한 부여 옵션 외에도 Apicurio Registry는 아티팩트 작성자만 쓰기 권한이 있는 스키마 또는 API 수준에서 콘텐츠 기반 권한 부여를 제공합니다. OpenShift 클러스터 내부 또는 외부에서 Apicurio 레지스트리에 대한 HTTPS 연결을 구성할 수도 있습니다.
이 장에서는 OpenShift에서 Apicurio 레지스트리 배포에 대해 다음 보안 옵션을 구성하는 방법을 설명합니다.
- 5.1절. “Red Hat Single Sign-On Operator를 사용하여 Apicurio Registry 보안”
- 5.2절. “Red Hat Single Sign-On을 사용하여 Apicurio 레지스트리 인증 및 권한 부여 구성”
- 5.3절. “Microsoft Azure Active Directory를 사용하여 Apicurio 레지스트리 인증 및 권한 부여 구성”
- 5.4절. “Apicurio 레지스트리 인증 및 권한 부여 구성 옵션”
- 5.5절. “OpenShift 클러스터 내부에서 Apicurio 레지스트리에 대한 HTTPS 연결 구성”
- 5.6절. “OpenShift 클러스터 외부에서 Apicurio 레지스트리에 대한 HTTPS 연결 구성”
추가 리소스
Java 클라이언트 애플리케이션의 보안 구성에 대한 자세한 내용은 다음을 참조하십시오.
5.1. Red Hat Single Sign-On Operator를 사용하여 Apicurio Registry 보안
다음 절차에서는 Red Hat Single Sign-On으로 보호되도록 Apicurio Registry REST API 및 웹 콘솔을 구성하는 방법을 보여줍니다.
Apicurio Registry는 다음 사용자 역할을 지원합니다.
이름 | capabilities |
---|---|
| 전체 액세스 권한, 제한 없음. |
|
아티팩트를 생성하고 아티팩트 규칙을 구성합니다. 글로벌 규칙을 수정하거나 가져오기/내보냈거나 |
|
보기 및 검색만 합니다. 아티팩트 또는 규칙을 수정하거나 가져오기/내보냈거나 |
ApicurioRegistry
CRD에는 웹 콘솔을 읽기 전용 모드로 설정하는 데 사용할 수 있는 관련 구성 옵션이 있습니다. 그러나 이 구성은 REST API에 영향을 미치지 않습니다.
사전 요구 사항
- Apicurio Registry Operator가 이미 설치되어 있어야 합니다.
- Red Hat Single Sign-On Operator를 설치하거나 OpenShift 클러스터에서 Red Hat Single Sign-On에 액세스할 수 있어야 합니다.
이 절차의 예제 구성은 개발 및 테스트용으로만 사용됩니다. 절차를 간단하게 유지하기 위해 프로덕션 환경에 권장되는 HTTPS 및 기타 방어 기능을 사용하지 않습니다. 자세한 내용은 Red Hat Single Sign-On 설명서를 참조하십시오.
프로세스
- OpenShift 웹 콘솔에서 설치된 Operator 및 Red Hat Single Sign-On Operator 를 클릭한 다음 Keycloak 탭을 클릭합니다.
Apicurio 레지스트리 배포 보안을 위해 Create Keycloak 을 클릭하여 새 Red Hat Single Sign-On 인스턴스를 프로비저닝합니다. 예를 들어 기본값을 사용할 수 있습니다.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: keycloak.org/v1alpha1 kind: Keycloak metadata: name: example-keycloak labels: app: sso spec: instances: 1 externalAccess: enabled: True podDisruptionBudget: enabled: True
apiVersion: keycloak.org/v1alpha1 kind: Keycloak metadata: name: example-keycloak labels: app: sso spec: instances: 1 externalAccess: enabled: True podDisruptionBudget: enabled: True
- 인스턴스가 생성될 때까지 기다린 다음 Networking 을 클릭한 다음 Routes 를 클릭하여 keycloak 인스턴스의 새 경로에 액세스합니다.
- 위치 URL을 클릭하고 Apicurio Registry를 배포할 때 나중에 사용할 수 있도록 표시된 URL 값을 복사합니다.
설치된 Operator 및 Red Hat Single Sign-On Operator 를 클릭하고 Keycloak 을 클릭한 다음 Keycloak 만들기를 클릭하여
레지스트리
예제 영역을 생성합니다.Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: keycloak.org/v1alpha1 kind: KeycloakRealm metadata: name: registry-keycloakrealm labels: app: sso spec: instanceSelector: matchLabels: app: sso realm: displayName: Registry enabled: true id: registry realm: registry sslRequired: none roles: realm: - name: sr-admin - name: sr-developer - name: sr-readonly clients: - clientId: registry-client-ui implicitFlowEnabled: true redirectUris: - '*' standardFlowEnabled: true webOrigins: - '*' publicClient: true - clientId: registry-client-api implicitFlowEnabled: true redirectUris: - '*' standardFlowEnabled: true webOrigins: - '*' publicClient: true users: - credentials: - temporary: false type: password value: changeme enabled: true realmRoles: - sr-admin username: registry-admin - credentials: - temporary: false type: password value: changeme enabled: true realmRoles: - sr-developer username: registry-developer - credentials: - temporary: false type: password value: changeme enabled: true realmRoles: - sr-readonly username: registry-user
apiVersion: keycloak.org/v1alpha1 kind: KeycloakRealm metadata: name: registry-keycloakrealm labels: app: sso spec: instanceSelector: matchLabels: app: sso realm: displayName: Registry enabled: true id: registry realm: registry sslRequired: none roles: realm: - name: sr-admin - name: sr-developer - name: sr-readonly clients: - clientId: registry-client-ui implicitFlowEnabled: true redirectUris: - '*' standardFlowEnabled: true webOrigins: - '*' publicClient: true - clientId: registry-client-api implicitFlowEnabled: true redirectUris: - '*' standardFlowEnabled: true webOrigins: - '*' publicClient: true users: - credentials: - temporary: false type: password value: changeme enabled: true realmRoles: - sr-admin username: registry-admin - credentials: - temporary: false type: password value: changeme enabled: true realmRoles: - sr-developer username: registry-developer - credentials: - temporary: false type: password value: changeme enabled: true realmRoles: - sr-readonly username: registry-user
중요프로덕션에 배포하는 경우 환경에 적합한 값으로 이
KeycloakRealm
리소스를 사용자 지정해야 합니다. Red Hat Single Sign-On 웹 콘솔을 사용하여 영역을 생성하고 관리할 수도 있습니다.클러스터에 유효한 HTTPS 인증서가 구성되지 않은 경우 임시 해결 방법으로 다음 HTTP
Service
및Ingress
리소스를 생성할 수 있습니다.네트워킹 및 서비스를 클릭하고 다음 예제를 사용하여 서비스 생성 을 클릭합니다.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: v1 kind: Service metadata: name: keycloak-http labels: app: keycloak spec: ports: - name: keycloak-http protocol: TCP port: 8080 targetPort: 8080 selector: app: keycloak component: keycloak type: ClusterIP sessionAffinity: None status: loadBalancer: {}
apiVersion: v1 kind: Service metadata: name: keycloak-http labels: app: keycloak spec: ports: - name: keycloak-http protocol: TCP port: 8080 targetPort: 8080 selector: app: keycloak component: keycloak type: ClusterIP sessionAffinity: None status: loadBalancer: {}
네트워킹을 클릭한 다음 Ingress 를 클릭하고 다음 예제를 사용하여 Ingress 생성 을 클릭합니다.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: keycloak-http labels: app: keycloak spec: rules: - host: KEYCLOAK_HTTP_HOST http: paths: - path: / pathType: ImplementationSpecific backend: service: name: keycloak-http port: number: 8080
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: keycloak-http labels: app: keycloak spec: rules: - host: KEYCLOAK_HTTP_HOST http: paths: - path: / pathType: ImplementationSpecific backend: service: name: keycloak-http port: number: 8080
호스트
값을 수정하여 Apicurio Registry 사용자에게 액세스할 수 있는 경로를 생성하고 Red Hat Single Sign-On Operator에서 생성한 HTTPS 경로 대신 사용합니다.
Apicurio Registry Operator 를 클릭하고 ApicurioRegistry 탭에서 다음 예제를 사용하여 ApicurioRegistry 만들기 를 클릭하고
keycloak
섹션의 값을 바꿉니다.Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: registry.apicur.io/v1 kind: ApicurioRegistry metadata: name: example-apicurioregistry-kafkasql-keycloak spec: configuration: security: keycloak: url: "http://keycloak-http-<namespace>.apps.<cluster host>" # ^ Required # Use an HTTP URL in development. realm: "registry" # apiClientId: "registry-client-api" # ^ Optional (default value) # uiClientId: "registry-client-ui" # ^ Optional (default value) persistence: 'kafkasql' kafkasql: bootstrapServers: '<my-cluster>-kafka-bootstrap.<my-namespace>.svc:9092'
apiVersion: registry.apicur.io/v1 kind: ApicurioRegistry metadata: name: example-apicurioregistry-kafkasql-keycloak spec: configuration: security: keycloak: url: "http://keycloak-http-<namespace>.apps.<cluster host>" # ^ Required # Use an HTTP URL in development. realm: "registry" # apiClientId: "registry-client-api" # ^ Optional (default value) # uiClientId: "registry-client-ui" # ^ Optional (default value) persistence: 'kafkasql' kafkasql: bootstrapServers: '<my-cluster>-kafka-bootstrap.<my-namespace>.svc:9092'