From 76237a9b6b3b8a48c0f57346957d9dd34cf8defa Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 21 Jul 2016 19:29:32 +0200 Subject: [PATCH] library/roles/smartgears/r_connector: Fix the script that initializes/creates uses. library/roles/smartgears/smartgears-nginx-frontend/templates/rstudio-dev.d4science.org-virtualhost.j2: Add a piece of configuration that was only on the production server. --- smartgears/r_connector/templates/rusersadd.j2 | 35 ++++++++++++------- .../rstudio-dev.d4science.org-virtualhost.j2 | 6 +++- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/smartgears/r_connector/templates/rusersadd.j2 b/smartgears/r_connector/templates/rusersadd.j2 index 9a65de89..73dd6838 100755 --- a/smartgears/r_connector/templates/rusersadd.j2 +++ b/smartgears/r_connector/templates/rusersadd.j2 @@ -1,19 +1,30 @@ #!/bin/bash USER="$1" -HDIR="{{ r_connector_usershome }}/$USER" +HDIR="{{ r_connector_usershome }}$USER" +logfile={{ smartgears_user_home }}/tomcat/logs/runuseradd.log +exec > $logfile 2>&1 + if [ -d $HDIR ] ; then - #echo "user dir exist" - exit 0 + #echo "user dir exist" + exit 0 else - if id -u $USER >/dev/null 2>&1 - then - #"echo "ldap user first login" - /bin/su - $USER - exit 0 - else - #echo "user does not exist and is not ldap" - /usr/sbin/useradd -m -s /bin/false $USER - fi + if id -u $USER >/dev/null 2>&1 + then + #"echo "ldap user first login" + sudo /bin/su - $USER /bin/ls + sudo /bin/chmod g+ws $HDIR + sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }} + sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }} + sudo /bin/chgrp -R {{ smartgears_user }} $HDIR + exit 0 + else + #echo "user does not exist and is not ldap" + sudo /usr/sbin/useradd -m -s /bin/false -g {{ smartgears_user }} $USER + sudo /bin/chmod g+ws $HDIR + sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }} + sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }} + sudo /bin/chgrp -R {{ smartgears_user }} $HDIR + fi fi diff --git a/smartgears/smartgears-nginx-frontend/templates/rstudio-dev.d4science.org-virtualhost.j2 b/smartgears/smartgears-nginx-frontend/templates/rstudio-dev.d4science.org-virtualhost.j2 index 3e7b1442..4d0e380a 100644 --- a/smartgears/smartgears-nginx-frontend/templates/rstudio-dev.d4science.org-virtualhost.j2 +++ b/smartgears/smartgears-nginx-frontend/templates/rstudio-dev.d4science.org-virtualhost.j2 @@ -8,10 +8,14 @@ server { proxy_read_timeout 600; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $schema; + proxy_set_header X-Forwarded-Proto http; proxy_set_header Host $http_host; proxy_redirect off; + location /auth-sign-in { + rewrite ^/auth-sign-in http://{{ ansible_fqdn }}/r-connector/gcube/service/disconnect; + } + {% for instance in tomcat_m_instances %} {% for context in instance.app_contexts %} location /{{ context }} {