From 44dfa82381179bc5abe3cd6c0d9d34792e690c42 Mon Sep 17 00:00:00 2001 From: baloola <baloola-mu@hotmail.com> Date: Sat, 21 Nov 2020 17:07:38 +0100 Subject: [PATCH] writing permission for sftp users --- .gitlab-ci.yml | 9 +++++++++ docker-compose.dem.yml | 2 +- docker-compose.emg.yml | 2 +- docker-compose.vhr18.yml | 2 +- sftp/Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ sftp/entrypoint.sh | 12 ++++++++++++ 6 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 sftp/Dockerfile create mode 100644 sftp/entrypoint.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 74dd9a1c..d360a9a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,6 +30,9 @@ build-tag: - IMAGE_6="$CI_REGISTRY_IMAGE/pvs_ingestor" - docker pull "$IMAGE_6":latest || true - docker build --cache-from "$IMAGE_6":latest -t "$IMAGE_6":dev -t "$IMAGE_6":$CI_COMMIT_TAG ingestor/ + - IMAGE_7="$CI_REGISTRY_IMAGE/pvs_sftp" + - docker pull "$IMAGE_7":latest || true + - docker build --cache-from "$IMAGE_7":latest -t "$IMAGE_7":latest -t "$IMAGE_7":$CI_COMMIT_TAG sftp/ - cd ./testing && ./gitlab_test.sh - if [ $? -ne 0 ]; then exit 1; fi # actually fail build - docker push "$IMAGE_1":$CI_COMMIT_TAG @@ -70,6 +73,9 @@ build-master-staging: - IMAGE_6="$CI_REGISTRY_IMAGE/pvs_ingestor" - docker pull "$IMAGE_6":"$TAG_USED" || true - docker build --cache-from "$IMAGE_6":"$TAG_USED" -t "$IMAGE_6":dev -t "$IMAGE_6":"$TAG_USED" ingestor/ + - IMAGE_7="$CI_REGISTRY_IMAGE/pvs_sftp" + - docker pull "$IMAGE_7":latest || true + - docker build --cache-from "$IMAGE_7":latest -t "$IMAGE_7":latest -t "$IMAGE_7":$CI_COMMIT_TAG sftp/ - cd ./testing && ./gitlab_test.sh - if [ $? -ne 0 ]; then exit 1; fi # actually fail build - docker push "$IMAGE_1":"$TAG_USED" @@ -112,6 +118,9 @@ build: - IMAGE="$CI_REGISTRY_IMAGE/pvs_ingestor" - docker pull "$IMAGE":staging || true - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev ingestor/ + - IMAGE="$CI_REGISTRY_IMAGE/pvs_sftp" + - docker pull "$IMAGE":staging || true + - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev sftp/ - cd ./testing && ./gitlab_test.sh - if [ $? -ne 0 ]; then exit 1; fi # actually fail build except: diff --git a/docker-compose.dem.yml b/docker-compose.dem.yml index e24433b4..6178f53c 100644 --- a/docker-compose.dem.yml +++ b/docker-compose.dem.yml @@ -173,7 +173,7 @@ services: deploy: replicas: 1 sftp: - image: atmoz/sftp:latest + image: registry.gitlab.eox.at/esa/prism/vs/pvs_sftp:latest volumes: - type: volume source: report-data diff --git a/docker-compose.emg.yml b/docker-compose.emg.yml index 1f681ac9..a74d3460 100644 --- a/docker-compose.emg.yml +++ b/docker-compose.emg.yml @@ -188,7 +188,7 @@ services: deploy: replicas: 1 sftp: - image: atmoz/sftp:latest + image: registry.gitlab.eox.at/esa/prism/vs/pvs_sftp:latest volumes: - type: volume source: report-data diff --git a/docker-compose.vhr18.yml b/docker-compose.vhr18.yml index 557e100a..40206b9e 100644 --- a/docker-compose.vhr18.yml +++ b/docker-compose.vhr18.yml @@ -192,7 +192,7 @@ services: deploy: replicas: 1 sftp: - image: atmoz/sftp:latest + image: registry.gitlab.eox.at/esa/prism/vs/pvs_sftp:latest volumes: - type: volume source: report-data diff --git a/sftp/Dockerfile b/sftp/Dockerfile new file mode 100644 index 00000000..7de24769 --- /dev/null +++ b/sftp/Dockerfile @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------ +# +# Project: prism view server +# Authors: Stephan Meissl <stephan.meissl@eox.at> +# +#------------------------------------------------------------------------------ +# Copyright (C) 2020 EOX IT Services GmbH <https://eox.at> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies of this Software or works derived from this Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +#----------------------------------------------------------------------------- + +FROM atmoz/sftp:latest + +LABEL name="prism view server docker base image" \ + vendor="EOX IT Services GmbH <https://eox.at>" \ + license="MIT Copyright (C) 2020 EOX IT Services GmbH <https://eox.at>" \ + type="prism view server docker base image" \ + version="1.0.0" + + +RUN mkdir /etc/sftp.d +ADD entrypoint.sh /etc/sftp.d + +RUN chmod -v +x /etc/sftp.d/entrypoint.sh diff --git a/sftp/entrypoint.sh b/sftp/entrypoint.sh new file mode 100644 index 00000000..7d70c0e8 --- /dev/null +++ b/sftp/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash +echo " baloola" +for user_home in /home/* ; do +echo $user_home + if [ -d "$user_home" ]; then + username=`basename $user_home` + echo "Setup $user_home/data folder for $username" + mkdir -p $user_home/data + chown -R $username:users $user_home/data + fi + +done -- GitLab