Skip to content

Commit

Permalink
Merge pull request #978 from proditis/master
Browse files Browse the repository at this point in the history
docker related improvements
  • Loading branch information
proditis committed Aug 19, 2023
2 parents ab5d00d + deb1b52 commit 19ad1fc
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 12 deletions.
2 changes: 2 additions & 0 deletions contrib/Dockerfile-vpn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ RUN set -ex \
libdbi-perl libdbd-mysql libdbd-mysql-perl supervisor; \
cd /var/www/echoCTF.RED/${RED_APP}; \
chmod a+x /usr/local/bin/composer; \
touch /sbin/pfctl && chmod +x /sbin/pfctl; \
ln -s /var/www/echoCTF.RED/${RED_APP}/yii /usr/local/sbin/backend; \
git config --global url."https://".insteadOf "git://" ; \
# [ -z "${GITHUB_OAUTH_TOKEN}" ] || composer config -g github-oauth.github.com "${GITHUB_OAUTH_TOKEN}"; \
# [ -z "${GITHUB_OAUTH_TOKEN}" ] || composer config --global github-protocols https; \
Expand Down
10 changes: 9 additions & 1 deletion contrib/entrypoint-vpn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,13 @@ if [ ! -f /etc/openvpn/.configured ]; then
echo "*** The systems are now configured. ***"
echo "***************************************"
fi
openvpn --dev tun0 --config /etc/openvpn/openvpn_tun0.conf
while ! mysqlshow -h db > /dev/null 2>&1
do
echo "Failed to connect to [db], waiting 1 second" && sleep 1
done

echo "Attempting to spin up targets"
backend target/spin


$@
10 changes: 3 additions & 7 deletions contrib/mysql-init.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
DELIMITER ;;
IF (SELECT count(*) FROM information_schema.tables WHERE table_schema = 'echoCTF' AND table_name = 'devnull' LIMIT 1)>0 THEN
CALL echoCTF.init_mysql();
DO memc_servers_behavior_set('MEMCACHED_BEHAVIOR_TCP_NODELAY','1');
DO memc_servers_behavior_set('MEMCACHED_BEHAVIOR_NO_BLOCK','1');
END IF;;
DELIMITER ;
CALL echoCTF.init_mysql();
DO memc_servers_behavior_set('MEMCACHED_BEHAVIOR_TCP_NODELAY','1');
DO memc_servers_behavior_set('MEMCACHED_BEHAVIOR_NO_BLOCK','1');
2 changes: 1 addition & 1 deletion contrib/openvpn_tun0.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ log-append /var/log/openvpn/openvpn.log
proto udp4
port 1194
management 127.0.0.1 11195 /etc/openvpn/private/mgmt.pwd
daemon openvpn
#daemon openvpn
#chroot /var/openvpn/chrootjail
crl-verify /etc/openvpn/crl.pem
float
Expand Down
12 changes: 12 additions & 0 deletions contrib/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,15 @@ command = tail -3f /var/log/openvpn/openvpn.log
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

[program:IndexPlusInstances]
user = root
environment = TERM=vt100
command = watch -t -n 30 "backend cron/index;backend cron/instances"

[program:openvpn]
user = root
command = openvpn --dev tun0 --config /etc/openvpn/openvpn_tun0.conf
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
2 changes: 1 addition & 1 deletion docker-compose-novpn-macvlan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
context: .
dockerfile: contrib/Dockerfile-mariadb
restart: "always"
command: ["mysqld","--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci","--skip-character-set-client-handshake"]
command: ["mysqld","--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci","--skip-character-set-client-handshake","--init_file=/always-initdb.d/99_mysql-init.sql"]
volumes:
- data-mysql:/var/lib/mysql
environment:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-novpn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
context: .
dockerfile: contrib/Dockerfile-mariadb
restart: "always"
command: ["mysqld","--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci","--skip-character-set-client-handshake"]
command: ["mysqld","--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci","--skip-character-set-client-handshake","--init_file=/always-initdb.d/99_mysql-init.sql"]
# ports:
# - 3306:3306
# - 11211:11211
Expand Down
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ version: '2'
services:
db:
container_name: echoctfred_db
hostname: db
image: echothrust/echoctf.red-db
build:
context: .
dockerfile: contrib/Dockerfile-mariadb
restart: "always"
command: ["mysqld","--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci","--skip-character-set-client-handshake"]
command: ["mysqld","--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci","--skip-character-set-client-handshake", "--init_file=/always-initdb.d/99_mysql-init.sql"]
# ports:
# - 3306:3306
# - 11211:11211
Expand All @@ -24,6 +25,7 @@ services:

backend:
container_name: echoctfred_backend
hostname: backend
image: echothrust/echoctf.red-backend
build:
context: .
Expand All @@ -50,6 +52,7 @@ services:

frontend:
container_name: echoctfred_frontend
hostname: frontend
image: echothrust/echoctf.red-frontend
build:
context: .
Expand Down Expand Up @@ -77,6 +80,7 @@ services:

vpn:
container_name: echoctfred_vpn
hostname: vpn
cap_add:
- NET_ADMIN
privileged: true
Expand Down

0 comments on commit 19ad1fc

Please sign in to comment.