From 850ab0acb3f61270bd37a72f33edcc3e08692d38 Mon Sep 17 00:00:00 2001 From: William Robinet Date: Wed, 24 Mar 2021 17:47:06 +0100 Subject: [PATCH] Extract traffic mirroring commands from docker run scripts --- docker/debian-bullseye/docker_run.sh | 8 -------- docker/debian-buster/docker_run.sh | 8 -------- docker/debian-stretch/docker_run.sh | 8 -------- docker/mirror_traffic_to_container.sh | 8 ++++++++ docker/ubuntu-bionic/docker_run.sh | 8 -------- docker/ubuntu-focal/docker_run.sh | 8 -------- docker/ubuntu-groovy/docker_run.sh | 8 -------- docker/ubuntu-xenial/docker_run.sh | 8 -------- 8 files changed, 8 insertions(+), 56 deletions(-) create mode 100755 docker/mirror_traffic_to_container.sh diff --git a/docker/debian-bullseye/docker_run.sh b/docker/debian-bullseye/docker_run.sh index d415fe2..9af67e5 100755 --- a/docker/debian-bullseye/docker_run.sh +++ b/docker/debian-bullseye/docker_run.sh @@ -1,15 +1,7 @@ #!/bin/bash -local_if=ens3f0 -container_ip=172.17.0.2 ssldump_version=1.4b distribution=debian-bullseye -sudo iptables -t mangle -I PREROUTING 1 -i ${local_if} -j TEE --gateway ${container_ip} -sudo iptables -t mangle -I POSTROUTING 1 -o ${local_if} -j TEE --gateway ${container_ip} - docker run -it ssldump-${distribution}:${ssldump_version} -sudo iptables -t mangle -D PREROUTING 1 -sudo iptables -t mangle -D POSTROUTING 1 - diff --git a/docker/debian-buster/docker_run.sh b/docker/debian-buster/docker_run.sh index f8b0106..1c1073b 100755 --- a/docker/debian-buster/docker_run.sh +++ b/docker/debian-buster/docker_run.sh @@ -1,15 +1,7 @@ #!/bin/bash -local_if=ens3f0 -container_ip=172.17.0.2 ssldump_version=1.4b distribution=debian-buster -sudo iptables -t mangle -I PREROUTING 1 -i ${local_if} -j TEE --gateway ${container_ip} -sudo iptables -t mangle -I POSTROUTING 1 -o ${local_if} -j TEE --gateway ${container_ip} - docker run -it ssldump-${distribution}:${ssldump_version} -sudo iptables -t mangle -D PREROUTING 1 -sudo iptables -t mangle -D POSTROUTING 1 - diff --git a/docker/debian-stretch/docker_run.sh b/docker/debian-stretch/docker_run.sh index a2650c0..56db0f2 100755 --- a/docker/debian-stretch/docker_run.sh +++ b/docker/debian-stretch/docker_run.sh @@ -1,15 +1,7 @@ #!/bin/bash -local_if=ens3f0 -container_ip=172.17.0.2 ssldump_version=1.4b distribution=debian-stretch -sudo iptables -t mangle -I PREROUTING 1 -i ${local_if} -j TEE --gateway ${container_ip} -sudo iptables -t mangle -I POSTROUTING 1 -o ${local_if} -j TEE --gateway ${container_ip} - docker run -it ssldump-${distribution}:${ssldump_version} -sudo iptables -t mangle -D PREROUTING 1 -sudo iptables -t mangle -D POSTROUTING 1 - diff --git a/docker/mirror_traffic_to_container.sh b/docker/mirror_traffic_to_container.sh new file mode 100755 index 0000000..a553130 --- /dev/null +++ b/docker/mirror_traffic_to_container.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +local_if=ens3f0 +container_ip=172.17.0.2 + +sudo iptables -t mangle -I PREROUTING 1 -i ${local_if} -j TEE --gateway ${container_ip} +sudo iptables -t mangle -I POSTROUTING 1 -o ${local_if} -j TEE --gateway ${container_ip} + diff --git a/docker/ubuntu-bionic/docker_run.sh b/docker/ubuntu-bionic/docker_run.sh index c2ec286..1199905 100755 --- a/docker/ubuntu-bionic/docker_run.sh +++ b/docker/ubuntu-bionic/docker_run.sh @@ -1,15 +1,7 @@ #!/bin/bash -local_if=ens3f0 -container_ip=172.17.0.2 ssldump_version=1.4b distribution=ubuntu-bionic -sudo iptables -t mangle -I PREROUTING 1 -i ${local_if} -j TEE --gateway ${container_ip} -sudo iptables -t mangle -I POSTROUTING 1 -o ${local_if} -j TEE --gateway ${container_ip} - docker run -it ssldump-${distribution}:${ssldump_version} -sudo iptables -t mangle -D PREROUTING 1 -sudo iptables -t mangle -D POSTROUTING 1 - diff --git a/docker/ubuntu-focal/docker_run.sh b/docker/ubuntu-focal/docker_run.sh index bb385d8..d4ee3af 100755 --- a/docker/ubuntu-focal/docker_run.sh +++ b/docker/ubuntu-focal/docker_run.sh @@ -1,15 +1,7 @@ #!/bin/bash -local_if=ens3f0 -container_ip=172.17.0.2 ssldump_version=1.4b distribution=ubuntu-focal -sudo iptables -t mangle -I PREROUTING 1 -i ${local_if} -j TEE --gateway ${container_ip} -sudo iptables -t mangle -I POSTROUTING 1 -o ${local_if} -j TEE --gateway ${container_ip} - docker run -it ssldump-${distribution}:${ssldump_version} -sudo iptables -t mangle -D PREROUTING 1 -sudo iptables -t mangle -D POSTROUTING 1 - diff --git a/docker/ubuntu-groovy/docker_run.sh b/docker/ubuntu-groovy/docker_run.sh index 7c1d459..f2ba0fa 100755 --- a/docker/ubuntu-groovy/docker_run.sh +++ b/docker/ubuntu-groovy/docker_run.sh @@ -1,15 +1,7 @@ #!/bin/bash -local_if=ens3f0 -container_ip=172.17.0.2 ssldump_version=1.4b distribution=ubuntu-groovy -sudo iptables -t mangle -I PREROUTING 1 -i ${local_if} -j TEE --gateway ${container_ip} -sudo iptables -t mangle -I POSTROUTING 1 -o ${local_if} -j TEE --gateway ${container_ip} - docker run -it ssldump-${distribution}:${ssldump_version} -sudo iptables -t mangle -D PREROUTING 1 -sudo iptables -t mangle -D POSTROUTING 1 - diff --git a/docker/ubuntu-xenial/docker_run.sh b/docker/ubuntu-xenial/docker_run.sh index 582ad04..8c3e8d3 100755 --- a/docker/ubuntu-xenial/docker_run.sh +++ b/docker/ubuntu-xenial/docker_run.sh @@ -1,15 +1,7 @@ #!/bin/bash -local_if=ens3f0 -container_ip=172.17.0.2 ssldump_version=1.4b distribution=ubuntu-xenial -sudo iptables -t mangle -I PREROUTING 1 -i ${local_if} -j TEE --gateway ${container_ip} -sudo iptables -t mangle -I POSTROUTING 1 -o ${local_if} -j TEE --gateway ${container_ip} - docker run -it ssldump-${distribution}:${ssldump_version} -sudo iptables -t mangle -D PREROUTING 1 -sudo iptables -t mangle -D POSTROUTING 1 -