Nexus3 Repository 생성 및 Keycloak 연동 시도(실패)
Nexus repository 설치
Nexus data 디렉토리 생성
$ mkdir -p /srv/nexus-data $ chown -R 200 /srv/nexus-data
Nexus data 디렉토리 mount + nexus 이미지 다운로드 & 컨테이너 실행
$ docker run -itd \ -p 8081:8081 \ -p 51001:51001 \ -v /srv/nexus-data:/nexus-data \ --name nexus \ sonatype/nexus3
Nexus 접속
ID/PASSWORD : admin/(/srv/nexus-data 폴더에 초기 admin 비밀번호 위치)
PyPi repository 생성
Repositories > Create repository > pypi (hosted) 선택
이름 입력 후 저장
생성한 repository에 파일 업로드
$ vi .pypirc [distutils] index-servers = nexus-pypi [nexus-pypi] repository: http://192.168.146.132:8081/repository/nexus-pypi/ username = admin password = admin $ python3 -m twine upload --repository nexus-pypi python-packages/*
Keycloak 연동
Keycloak plugin 설치
https://github.com/flytreeleft/nexus3-keycloak-plugin/releases 에서 컴파일된 버전 다운로드 가능
Plugin 빌드
Nexus install directory(/opt/sonatype/nexus)에 plugin 복사
Docker로 생성하여 install 폴더 들어가려면 docker 콘솔 실행하여야 함startup.properties 파일에 번들 추가
Keycloak 영역 클라이언트 구성
Keycloak realm > clients > create > nexus3Settings
>Access Type: confidential
>Service Accounts Enabled: On
>Authorization Enabled: On
Service Account Roles
>Client Roles: realm-management
>Available Roles
:view-realm
,view-clients
,view-users
>Add selected
>Assigned Roles
Installation
>Format Option: Keycloak OIDC JSON
> 파일 복사keycloak.json 생성
Container 재시작
Keycloak 연동 (실패)
Nexus에서 keycloak 영역 활성화
Role 생성
참조 URL : https://github.com/flytreeleft/nexus3-keycloak-plugin
연동 안되는 이슈
Error 내용 : Keycloak에 user 생성 후 해당 user로 nexus 접근 시도 하였으나 접근 불가. 새로운 user로 접속 시도 시 인증이 되지 않음. 하기 URL 참조: https://community.sonatype.com/t/authenticate-users-via-keycloak/652
추가 ) Nexus pro(유료 버전) 에서는 SAML 연동 구성이 가능하다고 합니다. https://help.sonatype.com/repomanager3/system-configuration/user-authentication/saml