Skip to content
This repository was archived by the owner on Apr 30, 2020. It is now read-only.

Commit c9e51dc

Browse files
committed
first commit
0 parents  commit c9e51dc

21 files changed

+671
-0
lines changed

Diff for: A_README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## Simple Test Case: Single Host with rsync

Diff for: A_connect.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
ssh -i $(pwd)/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p2208 user@localhost

Diff for: A_rsync.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
rsync -avz -e "ssh -i $(pwd)/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p2208" user@localhost:~/test/* ./test/

Diff for: B_README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Simple Test Case:
2+
3+
Can only connect to hostB trough hostA.

Diff for: B_connect.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
ssh -i $(pwd)/id_rsa \
4+
-o StrictHostKeyChecking=no \
5+
-o UserKnownHostsFile=/dev/null \
6+
-o "ProxyCommand ssh -W %h:%p -i $(pwd)/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p2208 user@localhost" \
7+
user@host_b

Diff for: B_rsync.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
rsync -Pavz -e "ssh -i $(pwd)/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o \"ProxyCommand ssh -W %h:%p -i $(pwd)/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p2208 user@localhost\"" user@host_b:~/test/* ./test/
4+
5+
#rsync -av -e "ssh -A root@proxy ssh" ./src user@target:/dst
6+

Diff for: C_README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Simple Test Case:
2+
3+
Can only connect to hostB trough hostA.
4+
Can only connect to hostC trough hostB.
5+
6+
7+
!! usage of custom ssh_config file !!

Diff for: C_connect.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
ssh -F ssh_config user@hostc

Diff for: C_rsync.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
rsync -avz -e "ssh -F ssh_config" hostc:~/test/* ./test/

Diff for: D_README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Simple Test Case:
2+
3+
Can only connect to hostB trough hostA.
4+
Can only connect to hostC trough hostB.
5+
6+
With Database
7+
8+
!! usage of custom ssh_config file !!

Diff for: D_connect.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
ssh -F ssh_config user@hostc

Diff for: D_mysqldump.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
DBhost=database
4+
DBport=3306
5+
username=root
6+
password=root
7+
database=sequelmovie
8+
9+
DBHost2=127.0.0.1
10+
DBPort2=2206
11+
Username2=root
12+
Password2=root
13+
Database2=sequelmovie2
14+
15+
ssh -F ssh_config user@hostc -C "mysqldump -h${DBhost} -P${DBport} -u${username} -p${password} ${database}" \
16+
| mysql -h${DBHost2} -P${DBPort2} -u${Username2} -p${Password2} ${Database2}
17+
18+
ssh -F ssh_config user@hostc -C "mysqldump -h${DBhost} -P${DBport} -u${username} -p${password} ${database}" \
19+
| ssh -F ssh_config user@hostc -C "mysql -h${DBhost} -P${DBport} -u${username} -p${password} ${Database2}"

Diff for: D_rsync.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
##not working:
4+
5+
rsync -avz -e "ssh -F ssh_config" hostc:~/test/* ./test/

Diff for: Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM ubuntu:latest
2+
3+
RUN apt-get update && apt-get install -y openssh-server rsync mysql-client
4+
RUN mkdir /var/run/sshd
5+
#RUN echo 'root:root' | chpasswd
6+
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
7+
8+
# SSH login fix. Otherwise user is kicked off after login
9+
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
10+
11+
ENV NOTVISIBLE "in users profile"
12+
RUN echo "export VISIBLE=now" >> /etc/profile
13+
14+
RUN useradd -ms /bin/bash user
15+
16+
EXPOSE 22
17+
CMD ["/usr/sbin/sshd", "-D"]

Diff for: authorized_keys

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDc6Ee+PKtK/ubuLwZbhoyy5itSL3wSVJWRHKvXW2x0v8qPZY318zMC9YOcUzhYZGBJHVyB+16SNidpOzwiEPIJ2KKv7qcjs/atLLmgZ3LeBGFxEsqyu8OoQclqDri5Zmt3XMmfI+QUOyGj/tJbN0XloL0XKXqqs4V1UfYQsJSutGrMQ5hRPQHDG46mXQdb/jU0AH23l10G6IvLv45y+czL95rSOwTCrsMNZuJcFSFilrzGgpghZYLreM6lGEa2zAmtXvdQAK2aFmiTczEGzh1TI2Gk0iakouJNfgaXKY7ELGRJB1/natqqS/SpG2Tf8YQh7RWu2eEM/3NruSCRH76b user@localhost

Diff for: db-seed/movies.sql

+481
Large diffs are not rendered by default.

Diff for: docker-compose.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: '2'
2+
3+
services:
4+
host_a:
5+
build: .
6+
volumes:
7+
- "./authorized_keys:/home/user/.ssh/authorized_keys"
8+
ports:
9+
- "2208:22"
10+
networks:
11+
- hostAB
12+
host_b:
13+
build: .
14+
volumes:
15+
- "./authorized_keys:/home/user/.ssh/authorized_keys"
16+
networks:
17+
- hostAB
18+
- hostBC
19+
host_c:
20+
build: .
21+
volumes:
22+
- "./authorized_keys:/home/user/.ssh/authorized_keys"
23+
- "./testApp:/var/www/prod"
24+
- "./testApp:/var/www/testing"
25+
networks:
26+
- hostBC
27+
- database
28+
database:
29+
image: mysql:5.7
30+
networks:
31+
- database
32+
ports:
33+
- "2206:3306"
34+
environment:
35+
MYSQL_ROOT_PASSWORD: root
36+
MYSQL_DATABASE: sequelmovie
37+
volumes:
38+
- ./db-seed:/docker-entrypoint-initdb.d
39+
40+
networks:
41+
hostAB:
42+
driver: bridge
43+
hostBC:
44+
driver: bridge
45+
database:
46+
driver: bridge

Diff for: id_rsa

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-----BEGIN RSA PRIVATE KEY-----
2+
MIIEpAIBAAKCAQEA3OhHvjyrSv7m7i8GW4aMsuYrUi98ElSVkRyr11tsdL/Kj2WN
3+
9fMzAvWDnFM4WGRgSR1cgftekjYnaTs8IhDyCdiir+6nI7P2rSy5oGdy3gRhcRLK
4+
srvDqEHJag64uWZrd1zJnyPkFDsho/7SWzdF5aC9Fyl6qrOFdVH2ELCUrrRqzEOY
5+
UT0BwxuOpl0HW/41NAB9t5ddBuiLy7+OcvnMy/ea0jsEwq7DDWbiXBUhYpa8xoKY
6+
IWWC63jOpRhGtswJrV73UACtmhZok3MxBs4dUyNhpNImpKLiTX4GlymOxCxkSQdf
7+
52raqkv0qRtk3/GEIe0VrtnhDP9za7kgkR++mwIDAQABAoIBAQDPe1M2+GCiNbvM
8+
ZlqASGWJ+ekibfsIdG1uOBGmWfYJycGE4YtuQBffZZ1RjFBVpSFSSsOCSghPJ5Ho
9+
onweOvA6E0DqISrWu8aqbGGEqOUYZeDnhRDgwr5IIFH+zQjvCaVSHNI6KEmmPsuf
10+
7kzA469At7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q+04DQ
26+
veqVhMk031JAF4goLuUmgRH2CReU3UpYQ9V5tGcEcv12F8sFA2GZ+g==
27+
-----END RSA PRIVATE KEY-----

Diff for: id_rsa.pub

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDc6Ee+PKtK/ubuLwZbhoyy5itSL3wSVJWRHKvXW2x0v8qPZY318zMC9YOcUzhYZGBJHVyB+16SNidpOzwiEPIJ2KKv7qcjs/atLLmgZ3LeBGFxEsqyu8OoQclqDri5Zmt3XMmfI+QUOyGj/tJbN0XloL0XKXqqs4V1UfYQsJSutGrMQ5hRPQHDG46mXQdb/jU0AH23l10G6IvLv45y+czL95rSOwTCrsMNZuJcFSFilrzGgpghZYLreM6lGEa2zAmtXvdQAK2aFmiTczEGzh1TI2Gk0iakouJNfgaXKY7ELGRJB1/natqqS/SpG2Tf8YQh7RWu2eEM/3NruSCRH76b user@localhost

Diff for: ssh_config

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Host hostc
2+
User user
3+
HostName host_c
4+
ProxyJump hostb
5+
6+
Host hostb
7+
User user
8+
HostName host_b
9+
ProxyJump hosta
10+
11+
Host hosta
12+
User user
13+
Port 2208
14+
HostName localhost
15+
16+
Host *
17+
StrictHostKeyChecking no
18+
UserKnownHostsFile /dev/null
19+
IdentityFile ./id_rsa

Diff for: testApp/index.php

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
echo 'This is the testApp of phpsu';
5+
6+
if ($_GET['phpsu'] === 'cool') {
7+
echo PHP_EOL . 'oh yes ;D';
8+
}

0 commit comments

Comments
 (0)