6.3. 제한된 환경에서 아티팩트 리포지토리 활성화
기술 스택을 구성하면 자체 서명된 인증서를 사용하여 사내 리포지토리의 아티팩트로 작업할 수 있습니다.
6.3.1. Maven 링크 복사링크가 클립보드에 복사되었습니다!
제한된 환경에서 실행되는 Maven 작업 영역에서 Maven 아티팩트 리포지토리를 활성화할 수 있습니다.
사전 요구 사항
- Maven 작업 영역을 실행하고 있지 않습니다.
-
<
username> -devspaces인 사용자 네임스페이스를 알고 있습니다. 여기서 <username>은 OpenShift Dev Spaces 사용자 이름입니다.
프로세스
<
;username> -devspaces네임스페이스에서 TLS 인증서에 대한 보안을 적용합니다.kind: Secret apiVersion: v1 metadata: name: tls-cer annotations: controller.devfile.io/mount-path: /home/user/certs controller.devfile.io/mount-as: file labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-secret: 'true' data: tls.cer: >- <Base64_encoded_content_of_public_cert>1 - 1
- 비활성화된 줄 래핑을 사용한 Base64 인코딩.
<
;username> -devspaces네임스페이스에서 ConfigMap을 적용하여settings.xml파일을 생성합니다.kind: ConfigMap apiVersion: v1 metadata: name: settings-xml annotations: controller.devfile.io/mount-as: subpath controller.devfile.io/mount-path: /home/user/.m2 labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: settings.xml: | <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <offline/> <pluginGroups/> <servers/> <mirrors> <mirror> <id>redhat-ga-mirror</id> <name>Red Hat GA</name> <url>https://<maven_artifact_repository_route>/repository/redhat-ga/</url> <mirrorOf>redhat-ga</mirrorOf> </mirror> <mirror> <id>maven-central-mirror</id> <name>Maven Central</name> <url>https://<maven_artifact_repository_route>/repository/maven-central/</url> <mirrorOf>maven-central</mirrorOf> </mirror> <mirror> <id>jboss-public-repository-mirror</id> <name>JBoss Public Maven Repository</name> <url>https://<maven_artifact_repository_route>/repository/jboss-public/</url> <mirrorOf>jboss-public-repository</mirrorOf> </mirror> </mirrors> <proxies/> <profiles/> <activeProfiles/> </settings>-
선택 사항: JBoss EAP 기반 devfile을 사용하는 경우 <
username> -devspaces 네임스페이스에 두 번째ConfigMap을 적용하고 동일한 콘텐츠, 다른 이름 및settings-xml/home/jboss/.m2마운트 경로를 적용합니다. <
;username> -devspaces네임스페이스에서 TrustStore 초기화 스크립트에 대한 ConfigMap을 적용합니다.Java 8
kind: ConfigMap apiVersion: v1 metadata: name: init-truststore annotations: controller.devfile.io/mount-as: subpath controller.devfile.io/mount-path: /home/user/ labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: init-java8-truststore.sh: | #!/usr/bin/env bash keytool -importcert -noprompt -file /home/user/certs/tls.cer -trustcacerts -keystore ~/.java/current/jre/lib/security/cacerts -storepass changeitJava 11
kind: ConfigMap apiVersion: v1 metadata: name: init-truststore annotations: controller.devfile.io/mount-as: subpath controller.devfile.io/mount-path: /home/user/ labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: init-java11-truststore.sh: | #!/usr/bin/env bash keytool -importcert -noprompt -file /home/user/certs/tls.cer -cacerts -storepass changeit- Maven 작업 공간을 시작합니다.
-
tools컨테이너에서 새 터미널을 엽니다. -
~/init-truststore.sh를 실행합니다.
6.3.2. gradle 링크 복사링크가 클립보드에 복사되었습니다!
제한된 환경에서 실행되는 Gradle 작업 영역에서 Gradle 아티팩트 리포지토리를 활성화할 수 있습니다.
사전 요구 사항
- Gradle 작업 영역을 실행하지 않습니다.
프로세스
TLS 인증서의 보안을 적용합니다.
kind: Secret apiVersion: v1 metadata: name: tls-cer annotations: controller.devfile.io/mount-path: /home/user/certs controller.devfile.io/mount-as: file labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-secret: 'true' data: tls.cer: >- <Base64_encoded_content_of_public_cert>1 - 1
- 비활성화된 줄 래핑을 사용한 Base64 인코딩.
TrustStore 초기화 스크립트의 ConfigMap을 적용합니다.
kind: ConfigMap apiVersion: v1 metadata: name: init-truststore annotations: controller.devfile.io/mount-as: subpath controller.devfile.io/mount-path: /home/user/ labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: init-truststore.sh: | #!/usr/bin/env bash keytool -importcert -noprompt -file /home/user/certs/tls.cer -cacerts -storepass changeitGradle init 스크립트의 ConfigMap을 적용합니다.
kind: ConfigMap apiVersion: v1 metadata: name: init-gradle annotations: controller.devfile.io/mount-as: subpath controller.devfile.io/mount-path: /home/user/.gradle labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: init.gradle: | allprojects { repositories { mavenLocal () maven { url "https://<gradle_artifact_repository_route>/repository/maven-public/" credentials { username "admin" password "passwd" } } } }- Gradle 작업 영역을 시작합니다.
-
tools컨테이너에서 새 터미널을 엽니다. -
~/init-truststore.sh를 실행합니다.
6.3.3. npm 링크 복사링크가 클립보드에 복사되었습니다!
제한된 환경에서 실행되는 npm 작업 영역에서 npm 아티팩트 리포지토리를 활성화할 수 있습니다.
사전 요구 사항
- npm 작업 영역을 실행하지 않습니다.
환경 변수를 설정하는 ConfigMap을 적용하면 작업 공간 부팅 루프가 발생할 수 있습니다.
이 동작이 발생하면 ConfigMap 을 제거하고 devfile을 직접 편집합니다.
프로세스
TLS 인증서의 보안을 적용합니다.
kind: Secret apiVersion: v1 metadata: name: tls-cer annotations: controller.devfile.io/mount-path: /public-certs controller.devfile.io/mount-as: file labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-secret: 'true' data: nexus.cer: >- <Base64_encoded_content_of_public_cert>__1 - 1
- 비활성화된 줄 래핑을 사용한 Base64 인코딩.
툴컨테이너에서 다음 환경 변수를 설정하려면 ConfigMap을 적용합니다.kind: ConfigMap apiVersion: v1 metadata: name: disconnected-env annotations: controller.devfile.io/mount-as: env labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: NPM_CONFIG_REGISTRY: >- https://<npm_artifact_repository_route>/repository/npm-all/
6.3.3.1. 자체 서명된 인증서 검증 비활성화 링크 복사링크가 클립보드에 복사되었습니다!
아래 명령을 실행하여 자체 서명된 인증서의 검증을 바이패스하여 SSL/TLS를 비활성화합니다. 이는 잠재적인 보안 위험입니다. 더 나은 솔루션을 위해 NODE_EXTRA_CA_CERTS 를 사용하여 신뢰하는 자체 서명된 인증서를 구성합니다.
프로세스
터미널에서 다음 명령을 실행합니다.
npm config set strict-ssl false
6.3.3.2. 인증서를 사용하도록 NODE_EXTRA_CA_CERTS 구성 링크 복사링크가 클립보드에 복사되었습니다!
아래 명령을 사용하여 SSL/TLS 인증서가 있는 위치를 가리키도록 NODE_EXTRA_CA_CERTS를 설정합니다.
프로세스
터미널에서 다음 명령을 실행합니다.
`export NODE_EXTRA_CA_CERTS=/public-certs/nexus.cer`1 `npm install`- 1
/public-certs/ Cryostat.cer는 Nexus 아티팩트의 자체 서명된 SSL/TLS 인증서의 경로입니다.
6.3.4. Python 링크 복사링크가 클립보드에 복사되었습니다!
제한된 환경에서 실행되는 Python 작업 영역에서 Python 아티팩트 리포지토리를 활성화할 수 있습니다.
사전 요구 사항
- Python 작업 영역을 실행하지 않습니다.
환경 변수를 설정하는 ConfigMap을 적용하면 작업 공간 부팅 루프가 발생할 수 있습니다.
이 동작이 발생하면 ConfigMap 을 제거하고 devfile을 직접 편집합니다.
프로세스
TLS 인증서의 보안을 적용합니다.
kind: Secret apiVersion: v1 metadata: name: tls-cer annotations: controller.devfile.io/mount-path: /home/user/certs controller.devfile.io/mount-as: file labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-secret: 'true' data: tls.cer: >- <Base64_encoded_content_of_public_cert>1 - 1
- 비활성화된 줄 래핑을 사용한 Base64 인코딩.
툴컨테이너에서 다음 환경 변수를 설정하려면 ConfigMap을 적용합니다.kind: ConfigMap apiVersion: v1 metadata: name: disconnected-env annotations: controller.devfile.io/mount-as: env labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: PIP_INDEX_URL: >- https://<python_artifact_repository_route>/repository/pypi-all/ PIP_CERT: /home/user/certs/tls.cer
6.3.5. Go 링크 복사링크가 클립보드에 복사되었습니다!
제한된 환경에서 실행되는 Go 작업 영역에서 Go 아티팩트 리포지토리를 활성화할 수 있습니다.
사전 요구 사항
- Go 작업 영역을 실행하지 않습니다.
환경 변수를 설정하는 ConfigMap을 적용하면 작업 공간 부팅 루프가 발생할 수 있습니다.
이 동작이 발생하면 ConfigMap 을 제거하고 devfile을 직접 편집합니다.
프로세스
TLS 인증서의 보안을 적용합니다.
kind: Secret apiVersion: v1 metadata: name: tls-cer annotations: controller.devfile.io/mount-path: /home/user/certs controller.devfile.io/mount-as: file labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-secret: 'true' data: tls.cer: >- <Base64_encoded_content_of_public_cert>1 - 1
- 비활성화된 줄 래핑을 사용한 Base64 인코딩.
툴컨테이너에서 다음 환경 변수를 설정하려면 ConfigMap을 적용합니다.kind: ConfigMap apiVersion: v1 metadata: name: disconnected-env annotations: controller.devfile.io/mount-as: env labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: GOPROXY: >- http://<athens_proxy_route> SSL_CERT_FILE: /home/user/certs/tls.cer
6.3.6. NuGet 링크 복사링크가 클립보드에 복사되었습니다!
제한된 환경에서 실행되는 Cryostat 작업 영역에서 Cryostat 아티팩트 리포지토리를 활성화할 수 있습니다.
사전 요구 사항
- Cryostat 작업 영역을 실행 중이 아닙니다.
환경 변수를 설정하는 ConfigMap을 적용하면 작업 공간 부팅 루프가 발생할 수 있습니다.
이 동작이 발생하면 ConfigMap 을 제거하고 devfile을 직접 편집합니다.
프로세스
TLS 인증서의 보안을 적용합니다.
kind: Secret apiVersion: v1 metadata: name: tls-cer annotations: controller.devfile.io/mount-path: /home/user/certs controller.devfile.io/mount-as: file labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-secret: 'true' data: tls.cer: >- <Base64_encoded_content_of_public_cert>1 - 1
- 비활성화된 줄 래핑을 사용한 Base64 인코딩.
ConfigMap을 적용하여
툴컨테이너에서 TLS 인증서 파일 경로에 대한 환경 변수를 설정합니다.kind: ConfigMap apiVersion: v1 metadata: name: disconnected-env annotations: controller.devfile.io/mount-as: env labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: SSL_CERT_FILE: /home/user/certs/tls.cerConfigMap을 적용하여
nuget.config파일을 생성합니다.kind: ConfigMap apiVersion: v1 metadata: name: init-nuget annotations: controller.devfile.io/mount-as: subpath controller.devfile.io/mount-path: /projects labels: controller.devfile.io/mount-to-devworkspace: 'true' controller.devfile.io/watch-configmap: 'true' data: nuget.config: | <?xml version="1.0" encoding="UTF-8"?> <configuration> <packageSources> <add key="nexus2" value="https://<nuget_artifact_repository_route>/repository/nuget-group/"/> </packageSources> <packageSourceCredentials> <nexus2> <add key="Username" value="admin" /> <add key="Password" value="passwd" /> </nexus2> </packageSourceCredentials> </configuration>