diff --git a/README.md b/README.md index 06ffcea..0e4c762 100644 --- a/README.md +++ b/README.md @@ -215,23 +215,9 @@ This will install the systemd units to run and update the bridghead. Also, this ### Basic Auth -For Data protection we use basic authenfication for some services. To access those services you need an username and password combination. -Cation: If you start the bridgehead without the authenfication, then those services are not accesbile. -We generate such a combination at the first install. Also, we provide a script which generates such a combination for you. - -``` shell -add_user.sh -``` - -The script will print the hashed user password combination. Please put the combination to the ```/etc/bridgehead/.local.conf``` - -It should look like this - -```conf -LDM_Password=':$...$.....$...............' -``` - -You can use the ```add_bc_auth_user.sh``` script to generate an another user and add it to the ```.local.conf``` wiht comma seperation. +For Data protection we use basic authentification for some services. To access those services you need an username and password combination. +Caution: If you start the bridgehead without the authentification, then those services are not accessible. +We generate such a combination at the first install (`/etc/bridgehead/.local.conf`). ## Configuration diff --git a/bbmri/docker-compose.yml b/bbmri/docker-compose.yml index ee35119..4188714 100644 --- a/bbmri/docker-compose.yml +++ b/bbmri/docker-compose.yml @@ -21,7 +21,7 @@ services: - "traefik.http.routers.dashboard.service=api@internal" - "traefik.http.routers.dashboard.tls=true" - "traefik.http.routers.dashboard.middlewares=auth" - - "traefik.http.middlewares.auth.basicauth.users=${bc_auth_users}" + - "traefik.http.middlewares.auth.basicauth.users=${LDM_LOGIN}" ports: - 80:80 - 443:443 @@ -65,7 +65,7 @@ services: - "blaze-data:/app/data" labels: - "traefik.enable=true" - - "traefik.http.middlewares.ccp-auth.basicauth.users=${bc_auth_users}" + - "traefik.http.middlewares.ccp-auth.basicauth.users=${LDM_LOGIN}" - "traefik.http.routers.blaze_ccp.rule=PathPrefix(`/bbmri-localdatamanagement`)" - "traefik.http.middlewares.ccp_b_strip.stripprefix.prefixes=/bbmri-localdatamanagement" - "traefik.http.services.blaze_ccp.loadbalancer.server.port=8080" diff --git a/lib/add_bc_user.sh b/lib/add_bc_user.sh deleted file mode 100755 index 8185658..0000000 --- a/lib/add_bc_user.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -e -source lib/functions.sh - -log "INFO" "This script add's a user with password to the bridghead" - -read -p 'Username: ' bc_user -read -sp 'Password: ' bc_password - -log "INFO" "\nPlease export the line in the your environment. Please replace the dollar signs with with \\\$" -docker run --rm -it httpd:latest htpasswd -nb $bc_user $bc_password diff --git a/lib/setup-bridgehead-units.sh b/lib/setup-bridgehead-units.sh index 7518f3a..820d6f6 100755 --- a/lib/setup-bridgehead-units.sh +++ b/lib/setup-bridgehead-units.sh @@ -39,10 +39,11 @@ if [ -z "$LDM_LOGIN" ]; then generated_passwd="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)" log "INFO" "Your generated credentials are:\n user: $PROJECT\n password: $generated_passwd" - parsed_passwd=$(docker run --rm -it httpd:latest htpasswd -nb $PROJECT $generated_passwd | tr -d '\n') + parsed_passwd=$(docker run --rm -it httpd:latest htpasswd -nb $PROJECT $generated_passwd | tr -d '\n' | tr -d '\r') + printf "##Localdatamanagement basic auth\n#User: $PROJECT\n#Password: $generated_passwd\n" >> /etc/bridgehead/${PROJECT}.local.conf; log "INFO" "These credentials are now written to /etc/bridgehead/${PROJECT}.local.conf" - echo "LDM_LOGIN='${parsed_passwd}'" >> /etc/bridgehead/${PROJECT}.local.conf; + echo -n "LDM_LOGIN='${parsed_passwd}'" >> /etc/bridgehead/${PROJECT}.local.conf; fi log "INFO" "Register system units for bridgehead and bridgehead-update"