sonatype-nexus-community/cs-auth-proxy

Name: cs-auth-proxy

Owner: Sonatype Community

Description: SAML SSO for Sonatype Nexus IQ

Created: 2018-03-07 18:50:12.0

Updated: 2018-04-27 16:42:29.0

Pushed: 2018-04-23 19:50:42.0

Homepage:

Size: 281

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Here are scripts and configuration to build a SAML-based authentication environment for Nexus IQ using Docker and Docker Compose.

Overview
Quickstart
bin/create-iq-volume.sh license_file
docker-compose build
docker-compose up -d
Background

Some customers want SAML support for our products. This docker-compose based approach demonstrates a functional SSO environment similar to that deployed by these customers:

The base images for the environment are available on Dockerhub and customized at runtime.

SAML Configuration

This environment provides a fully functional SAML-based setup. But, to be useful as a reference implementation, more information about how Apache / mod_auth_mellon are configured and operate is provided below.

General Overview

Here is what the final authentication workflow looks like:

For us:

The configuration process includes the following steps:

  1. Create Service Provider metadata. The mod_auth_mellon module includes a helper script to create an XML-formatted metadata file describing the service provider endpoints. This information (specifically, service URLs and certificates) is required in order to configure the IdP service.

  2. Create IdP Configuration. The IdP needs to have the new service added, including what sets of users will have access, what assertions will be provided, etc. A primary output from the IdP is an XML-formatted metadata file which the Service Provider requires to complete configuration.

  3. Complete SP Configuration. The SP requires the IdP metadata file to complete its configuration.

  4. Configure the Proxy. Once the Apache SP is configured and authentication is working, information about from the SAML assertion must be passed to the service being proxied.

Create Service Provider Metadata

mod_auth_mellon includes a helper script to create the SP metadata. In addition to creating files, it outputs important information to the console. A wrapper script gen.sh was invoked to create this information for this environment:

cker run -t -i --rm sonatype/saml-proxy /bin/bash

t@86a86bf15775 /]# /etc/httpd/saml2/gen.sh 

ut files:
ate key:                              sonatype.key
ificate:                              sonatype.cert
data:                                 sonatype.xml
:                                     localhost:8000

oints:
leLogoutService (SOAP):               http://localhost:8000/mellon/logout
leLogoutService (HTTP-Redirect):      http://localhost:8000/mellon/logout
rtionConsumerService (HTTP-POST):     http://localhost:8000/mellon/postResponse
rtionConsumerService (HTTP-Artifact): http://localhost:8000/mellon/artifactResponse
rtionConsumerService (PAOS):          http://localhost:8000/mellon/paosResponse
IdP Configuration

In order to add a new service to the IdP, the information generated in the previous step is required. Keycloak (and some other IdPs) can import this metadata directly, others may require a more manual procedure.

Arbitrary assertions can be provided by the IdP to the SP: they typically include group membership and extended information about the user.

Complete SP Configuration

Metadata from the IdP is required to complete mod_auth_mellon configuration. This includes URLs serviced by the IdP, certificates, and other information about the IdP.

Once a service is added to Keycloak, this metadata can be trvially retrieved:

rl -q http://keycloak:8080/auth/realms/sonatype/protocol/saml/descriptor

See Example IdP Metadata.

Configure the Proxy

Once SAML authentication is functional, the proxy must be configured to pass traffic to the backend service.

This basic proxy config:

  1. requires authorization for all locations on the httpd instance.
  2. uses the MellonMergeEnvVars On directive to allow SAML variables to be set in the environment.
  3. sets the HTTP header X-SSO-USER to the username assertion. Other IdP's may expose this information differently.

This environment contains a few tools which may help in determining the correct configuration for another IdP.

The Sonatype COTS config proxies requests for Sonatype IQ: https://localhost:8000/iq/.

Details
Alternate Deployment: IQ and LDAP

A docker-compose configuration for running just IQ and LDAP is included: IQ is exposed on localhost:18070 and localhost:18071.

docker-compose -f iq-ldap.yml up

Access IQ at http://localhost:18070.

Note that the same docker volume us is used for this minimal configuration; this is possible since parameters rather than config.yml are used to enable reverseProxyAuthentication.

Scripts
Keycloak Information
LDAP Information

LDAP Connection:

LDAP User Lookup:

LDAP Group Lookup:

User information. The following users are in the directory. All users have the same password: ch@ngeme.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.