summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstartxfr <clarue@startx.fr>2017-07-23 14:23:43 +0200
committerstartxfr <clarue@startx.fr>2017-07-23 14:23:43 +0200
commit11621aff584557c0141cef87b6e229f382349e9e (patch)
treee3256f0c3e19b5a020efbc8671090799906515e6
parentaec34cca4a69039bf300ad60e2b356936bad466a (diff)
downloadphpmyadmin-11621aff584557c0141cef87b6e229f382349e9e.tar.gz
phpmyadmin-11621aff584557c0141cef87b6e229f382349e9e.tar.bz2
phpmyadmin-11621aff584557c0141cef87b6e229f382349e9e.tar.xz
phpmyadmin-11621aff584557c0141cef87b6e229f382349e9e.zip
change user setting in openshift centos image to be compliant with openshift container policy
-rw-r--r--Bombs/cpu/sx.sh34
-rw-r--r--Bombs/mem/sx.sh34
-rw-r--r--OS/Dockerfile2
-rw-r--r--OS/README.md2
-rw-r--r--OS/sx.sh34
5 files changed, 9 insertions, 97 deletions
diff --git a/Bombs/cpu/sx.sh b/Bombs/cpu/sx.sh
index 2f2607a..e028787 100644
--- a/Bombs/cpu/sx.sh
+++ b/Bombs/cpu/sx.sh
@@ -2,40 +2,12 @@
export TERM=xterm
pid=0
-function check_environment {
- if [ ! -v CONTAINER_TYPE ]; then
- CONTAINER_TYPE="unknown"
- export CONTAINER_TYPE
- echo "! WARNING : environment var CONTAINER_TYPE is missing..."
- echo "! WARNING : auto-assigned value : $CONTAINER_TYPE"
- fi
- if [ ! -v CONTAINER_SERVICE ]; then
- CONTAINER_SERVICE=$CONTAINER_TYPE;
- export CONTAINER_SERVICE;
- echo "! WARNING : environment var CONTAINER_SERVICE is missing..."
- echo "! WARNING : auto-assigned value : $CONTAINER_SERVICE"
- fi
- if [ ! -v CONTAINER_INSTANCE ]; then
- CONTAINER_INSTANCE=$CONTAINER_TYPE "_" $CONTAINER_SERVICE;
- export CONTAINER_INSTANCE;
- echo "! WARNING : environment var CONTAINER_INSTANCE is missing..."
- echo "! WARNING : auto-assigned value : $CONTAINER_INSTANCE"
- fi
-}
-
function display_container_header {
echo "+====================================================="
echo "| Container : $HOSTNAME"
echo "| OS : $(</etc/redhat-release)"
- if [ -v CONTAINER_TYPE ]; then
- echo "| Type : $CONTAINER_TYPE"
- fi
- if [ -v CONTAINER_SERVICE ]; then
- echo "| Service : $CONTAINER_SERVICE"
- fi
- if [ -v CONTAINER_INSTANCE ]; then
- echo "| Instance : $CONTAINER_INSTANCE"
- fi
+ echo "| kubernetes : $KUBERNETES_SERVICE_HOST"
+ echo "| user : $(</etc/whoami)"
echo "+====================================================="
}
@@ -59,7 +31,5 @@ function start_service {
exit 0
}
-
-check_environment
display_container_header
start_service \ No newline at end of file
diff --git a/Bombs/mem/sx.sh b/Bombs/mem/sx.sh
index fd9115e..f607a0f 100644
--- a/Bombs/mem/sx.sh
+++ b/Bombs/mem/sx.sh
@@ -2,40 +2,12 @@
export TERM=xterm
pid=0
-function check_environment {
- if [ ! -v CONTAINER_TYPE ]; then
- CONTAINER_TYPE="unknown"
- export CONTAINER_TYPE
- echo "! WARNING : environment var CONTAINER_TYPE is missing..."
- echo "! WARNING : auto-assigned value : $CONTAINER_TYPE"
- fi
- if [ ! -v CONTAINER_SERVICE ]; then
- CONTAINER_SERVICE=$CONTAINER_TYPE;
- export CONTAINER_SERVICE;
- echo "! WARNING : environment var CONTAINER_SERVICE is missing..."
- echo "! WARNING : auto-assigned value : $CONTAINER_SERVICE"
- fi
- if [ ! -v CONTAINER_INSTANCE ]; then
- CONTAINER_INSTANCE=$CONTAINER_TYPE "_" $CONTAINER_SERVICE;
- export CONTAINER_INSTANCE;
- echo "! WARNING : environment var CONTAINER_INSTANCE is missing..."
- echo "! WARNING : auto-assigned value : $CONTAINER_INSTANCE"
- fi
-}
-
function display_container_header {
echo "+====================================================="
echo "| Container : $HOSTNAME"
echo "| OS : $(</etc/redhat-release)"
- if [ -v CONTAINER_TYPE ]; then
- echo "| Type : $CONTAINER_TYPE"
- fi
- if [ -v CONTAINER_SERVICE ]; then
- echo "| Service : $CONTAINER_SERVICE"
- fi
- if [ -v CONTAINER_INSTANCE ]; then
- echo "| Instance : $CONTAINER_INSTANCE"
- fi
+ echo "| kubernetes : $KUBERNETES_SERVICE_HOST"
+ echo "| user : $(</etc/whoami)"
echo "+====================================================="
}
@@ -59,7 +31,5 @@ function start_service {
exit 0
}
-
-check_environment
display_container_header
start_service \ No newline at end of file
diff --git a/OS/Dockerfile b/OS/Dockerfile
index 2b47905..f04434e 100644
--- a/OS/Dockerfile
+++ b/OS/Dockerfile
@@ -3,5 +3,7 @@ MAINTAINER Christophe LARUE <dev@startx.fr>
COPY sx.sh /bin/sx
RUN chmod 775 /bin/sx
+RUN useradd startx && echo "startx" | passwd --stdin startx && usermod -aG wheel startx
+USER startx
CMD [ "/bin/sx" ]
diff --git a/OS/README.md b/OS/README.md
index ff1d247..3609af5 100644
--- a/OS/README.md
+++ b/OS/README.md
@@ -1,6 +1,6 @@
# Docker OS Images : Centos7
-Simple container used to have an os container running in openshift and ready to investigate using sysadmin tools. This image is based on [centos/s2i-core-centos7](https://hub.docker.com/r/centos/s2i-core-centos7) done by [sclorg](https://github.com/sclorg/s2i-base-container/tree/master/core). Official image for all openshift s2i containers.
+Simple container used to have an os container running in openshift and ready to investigate using sysadmin tools. This image is based on [centos/s2i-core-centos7](https://hub.docker.com/r/centos/s2i-core-centos7) done by [sclorg](https://github.com/sclorg/s2i-base-container/tree/master/core).
You can find information on this image and how to use it by visiting the [Dockerhub registry](https://github.com/startxfr/docker-images)
diff --git a/OS/sx.sh b/OS/sx.sh
index 96a8448..5bf4d17 100644
--- a/OS/sx.sh
+++ b/OS/sx.sh
@@ -1,41 +1,13 @@
#!/bin/bash
export TERM=xterm
pid=0
-printenv
-function check_environment {
- if [ ! -v CONTAINER_TYPE ]; then
- CONTAINER_TYPE="unknown"
- export CONTAINER_TYPE
- echo "! WARNING : environment var CONTAINER_TYPE is missing..."
- echo "! WARNING : auto-assigned value : $CONTAINER_TYPE"
- fi
- if [ ! -v CONTAINER_SERVICE ]; then
- CONTAINER_SERVICE=$CONTAINER_TYPE;
- export CONTAINER_SERVICE;
- echo "! WARNING : environment var CONTAINER_SERVICE is missing..."
- echo "! WARNING : auto-assigned value : $CONTAINER_SERVICE"
- fi
- if [ ! -v CONTAINER_INSTANCE ]; then
- CONTAINER_INSTANCE=$CONTAINER_TYPE "_" $CONTAINER_SERVICE;
- export CONTAINER_INSTANCE;
- echo "! WARNING : environment var CONTAINER_INSTANCE is missing..."
- echo "! WARNING : auto-assigned value : $CONTAINER_INSTANCE"
- fi
-}
function display_container_header {
echo "+====================================================="
echo "| Container : $HOSTNAME"
echo "| OS : $(</etc/redhat-release)"
- if [ -v CONTAINER_TYPE ]; then
- echo "| Type : $CONTAINER_TYPE"
- fi
- if [ -v CONTAINER_SERVICE ]; then
- echo "| Service : $CONTAINER_SERVICE"
- fi
- if [ -v CONTAINER_INSTANCE ]; then
- echo "| Instance : $CONTAINER_INSTANCE"
- fi
+ echo "| kubernetes : $KUBERNETES_SERVICE_HOST"
+ echo "| user : $(</etc/whoami)"
echo "+====================================================="
}
@@ -49,7 +21,5 @@ function start_service {
done
}
-
-check_environment
display_container_header
start_service \ No newline at end of file