Luciano Andrade 8 vuotta sitten
vanhempi
commit
0e78c52230

+ 13 - 0
docker-compose.yml

@@ -48,6 +48,19 @@ services:
     image: rabbitmq
     restart: always
 
+  supervisord:
+    image: fd3-supervisord
+    build:
+      context: supervisord
+    ports:
+      - "9001:9001"
+    volumes: 
+      - ./supervisord/:/etc/supervisord/
+      - ./supervisord/var/:/var/log/supervisor/
+      - ./supervisord/sshd_config:/etc/ssh/sshd_config
+    environment:
+      TERM: "xterm"
+ 
   nginx-proxy:
     image: jwilder/nginx-proxy
     container_name: nginx-proxy

+ 36 - 0
supervisord/Dockerfile

@@ -0,0 +1,36 @@
+##################################################################
+FROM debian:8.0
+RUN apt-get update && apt-get install -yq parallel git vim tmux python-pip lockfile-progs
+RUN pip install supervisor
+
+RUN mkdir -p /var/log/supervisor/
+EXPOSE 9001
+
+##################################################################
+#sshd server
+RUN apt-get install -yq openssh-server
+
+RUN apt-get update && apt-get install -y openssh-server
+RUN mkdir /var/run/sshd
+#RUN echo 'root:screencast' | chpasswd
+#RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
+
+# SSH login fix. Otherwise user is kicked off after login
+RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
+
+ENV NOTVISIBLE "in users profile"
+RUN echo "export VISIBLE=now" >> /etc/profile
+
+RUN mkdir /etc/ssh/keys/
+
+COPY keys/bitbucket.id_rsa.pub /etc/ssh/keys/authorized_keys
+
+RUN chmod 0700 /etc/ssh/keys
+RUN chmod 0600 /etc/ssh/keys/authorized_keys
+RUN chown root:root -R /etc/ssh/keys
+
+EXPOSE 22
+##################################################################
+
+CMD (echo supervisord --configuration  /etc/supervisord/supervisor.conf  --nodaemon; echo /usr/sbin/sshd -D) | parallel
+

+ 6 - 0
supervisord/bin/cmd-list.txt

@@ -0,0 +1,6 @@
+hola
+mundo
+esto
+estaria muy, pero muy bien
+si lo leyera
+completo

+ 0 - 0
supervisord/bin/server1


+ 7 - 0
supervisord/bin/tmux-send.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+lockfile-create $1
+while IFS='$\n' read -r line; do
+    # do whatever with line
+    tmux send-keys -t $1 $line "C-m"
+done
+lockfile-remove $1

+ 0 - 0
supervisord/conf.d/.gitkeep


+ 27 - 0
supervisord/keys/bitbucket.id_rsa

@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEAsCo4Xa/fLaryiZt6igRK1IPNJsKeDLWBN6CWrv3TQ2iMcwE1
+zhTTX115N+KngVN8p1v5VrSMHKpvyXQDZPG/FJnWm5ry75qSYTmEtY8nfRsGAbwT
+i4swY+4jqrH1RRjbuVMsXPGjFX34SZTTJEl8ouVAFy/7HR+ODUe2+enWVnaouhVs
+Xj+bW2u7/dV1kZctFa5g5iV3hqGH32dBME5ztg4Fh7fAxkRTiJl+NBI7/LIdv9dl
+qmtDAdNdRqaI1dBpy8sHyZhRfjPeVbhdKsjE5IBhDLlYzyxK5FC41us08VCdq+M1
+1qVzIVM61PBosW5NfwlrRgLDPEXkazUdhJO6YwIDAQABAoIBAFEf4D0klH4PTwmX
+k+Ki/2LGH19OGEJ6Azt+tGV5diSArMz5LbHtXTl5bi0SL1ka/TiE3lnTYwKAamI3
+DqkZuojeHzohLOayI96qAjcp6WFvZGDAH7APNQWP0NT2hqB/RhAeATv7+sIW9JPN
++T2oqcDKGa2T5uwOb/glolmMGaxOzNfAFAgnD7p7cnR0yijW5t3bc4q0sOFu/H3N
+jYsAqvMu6Nkpt9hjlu42x5Muwj9YeKwpZoE1sno62JeQFZo7nO7DrOrE7DOENoWV
+PMDxs8Hz0SRQlZcJn2I/W9wX8A8gCAWGhbAtUGQkS8gCaMp0dOcxoV3EttriQgtU
+X1oUwIECgYEA2Vge4E8E53BzLGTk8sozn1qteYn3cLGgJgC78MEzZN/G57DxVbC9
+ntlSlYaYLlaPlSlNzZyG0s3UhpPY7YgP9srpohfPyXvb0yc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ba7v91XWRly0VrmDmJXeGoYffZ0EwTnO2DgWHt8DGRFOImX40Ejv8sh2/12Wqa0MB011GpojV0GnLywfJmFF+M95VuF0qyMTkgGEMuVjPLErkULjW6zTxUJ2r4zXWpXMhUzrU8Gixbk1/CWtGAsM8ReRrNR2Ek7pj flowdat@bitbucket

+ 35 - 0
supervisord/sshd_config

@@ -0,0 +1,35 @@
+Port 22
+Protocol 2
+HostKey /etc/ssh/ssh_host_rsa_key
+HostKey /etc/ssh/ssh_host_dsa_key
+HostKey /etc/ssh/ssh_host_ecdsa_key
+HostKey /etc/ssh/ssh_host_ed25519_key
+UsePrivilegeSeparation yes
+
+KeyRegenerationInterval 3600
+ServerKeyBits 1024
+
+SyslogFacility AUTH
+LogLevel INFO
+
+LoginGraceTime 120
+PermitRootLogin without-password
+StrictModes yes
+
+RSAAuthentication yes
+PubkeyAuthentication yes
+AuthorizedKeysFile	/etc/ssh/keys/authorized_keys
+
+IgnoreRhosts yes
+RhostsRSAAuthentication no
+HostbasedAuthentication no
+PermitEmptyPasswords no
+ChallengeResponseAuthentication no
+
+PrintMotd no
+PrintLastLog yes
+TCPKeepAlive yes
+
+Subsystem sftp /usr/lib/openssh/sftp-server
+
+UsePAM yes

+ 34 - 0
supervisord/supervisor.conf

@@ -0,0 +1,34 @@
+; supervisor config file
+
+[unix_http_server]
+file=/var/run/supervisor.sock   ; (the path to the socket file)
+chmod=0700                       ; sockef file mode (default 0700)
+
+[supervisord]
+logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
+pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
+childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)
+
+[inet_http_server]
+port = 0.0.0.0:9001
+username = iksop
+password = queRini6
+
+; the below section must remain in the config file for RPC
+; (supervisorctl/web interface) to work, additional interfaces may be
+; added by defining them in separate rpcinterface: sections
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
+[supervisorctl]
+serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket
+
+; The [include] section can just contain the "files" setting.  This
+; setting can list multiple files (separated by whitespace or
+; newlines).  It can also contain wildcards.  The filenames are
+; interpreted as relative to this file.  Included files *cannot*
+; include files themselves.
+
+[include]
+files = /etc/supervisord/conf.d/*.conf
+

+ 0 - 0
supervisord/var/.gitkeep