This commit is contained in:
Houtworm 2023-06-09 03:52:50 +02:00
parent 27a5ef8d88
commit d0bd3a7c28
30 changed files with 2558 additions and 0 deletions

15
srcs/ftp/Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM alpine
RUN sleep 10
RUN apk update
RUN apk add openssl
RUN apk add pure-ftpd --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
RUN apk add telegraf
COPY srcs/start.sh /root/start.sh
COPY srcs/vsftpd.conf /etc/vsftpd/vsftpd.conf
COPY srcs/telegraf.conf /etc/telegraf/telegraf.conf
WORKDIR /root/
RUN adduser --disabled-password admin
RUN echo "admin:password" | chpasswd
CMD sh start.sh
EXPOSE 21/tcp
EXPOSE 21000/tcp

20
srcs/ftp/deployment.yaml Normal file
View File

@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ftp
labels:
app: ftp
spec:
replicas: 1
selector:
matchLabels:
app: ftp
template:
metadata:
labels:
app: ftp
spec:
containers:
- name: ftp
image: ftp
imagePullPolicy: Never

17
srcs/ftp/service.yaml Normal file
View File

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: ftp
spec:
type: LoadBalancer
selector:
app: ftp
ports:
- name: ftp
protocol: TCP
port: 21
nodePort: 21
- name: pftp
protocol: TCP
port: 21000
nodePort: 21000

3
srcs/ftp/srcs/start.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
telegraf &
pure-ftpd -p 21000:21000

View File

@ -0,0 +1,28 @@
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
urls = ["http://influxdb:8086"]
database = "ftp"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]

View File

@ -0,0 +1,30 @@
ftpd_banner=A very rigorous evaluator I might say.
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
xferlog_std_format=YES
chroot_local_user=YES
allow_writeable_chroot=YES
pam_service_name=vsftpd
tcp_wrappers=YES
rsa_cert_file=/etc/ssl/private/vsftpd.crt
rsa_private_key_file=/etc/ssl/private/vsftpd.key
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
#pasv_address=127.0.0.1
#pasv_addr_resolve=NO
pasv_enable=YES
pasv_min_port=21000
pasv_max_port=21000
port_enable=YES

11
srcs/ftp/srcs/vsftpd.conf Normal file
View File

@ -0,0 +1,11 @@
listen=YES
local_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
pam_service_name=vsftpd
seccomp_sandbox=NO
write_enable=YES
secure_chroot_dir=/var/empty
anonymous_enable=YES
anon_root=/srv/ftp
no_anon_password=YES

View File

@ -0,0 +1,15 @@
FROM alpine
RUN sleep 10
RUN apk update
RUN apk add mariadb
RUN apk add mariadb-client
RUN apk add telegraf
COPY srcs/start.sh /root/start.sh
COPY srcs/telegraf.conf /etc/telegraf/telegraf.conf
COPY srcs/my.cnf /etc/my.cnf.d/mariadb-server.cnf
COPY srcs/maria.sql /root/maria.sql
WORKDIR /root/
RUN mkdir -p /run/mysqld
RUN chown -R mysql:mysql /run/mysqld /var/lib/mysql
CMD sh start.sh
EXPOSE 3306/tcp

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mariadb
labels:
app: mariadb
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mariadb
labels:
type: local
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
capacity:
storage: 1Gi
hostPath:
path: "/mnt/mariadb"
type: DirectoryOrCreate
claimRef:
name: mariadb
namespace: default

12
srcs/mariadb/service.yaml Normal file
View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: mariadb
spec:
type: ClusterIP
selector:
app: mariadb
ports:
- name: mariadb
protocol: TCP
port: 3306

1839
srcs/mariadb/srcs/maria.sql Normal file

File diff suppressed because one or more lines are too long

49
srcs/mariadb/srcs/my.cnf Normal file
View File

@ -0,0 +1,49 @@
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
datadir = /var/lib/mysql
tmpdir = /tmp
bind-address = 0.0.0.0
skip-networking = false
# Galera-related settings
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
# This group is only read by MariaDB-10.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.5]

View File

@ -0,0 +1,13 @@
#!/bin/sh
telegraf &
if cat /var/lib/mysql/initialized
then
touch /var/lib/mysql/initialized
else
mysql_install_db --user=mysql --datadir=/var/lib/mysql
mysqld & sleep 10
mysql < maria.sql
killall mysqld
touch /var/lib/mysql/initialized
fi
mysqld

View File

@ -0,0 +1,28 @@
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
urls = ["http://influxdb:8086"]
database = "mariadb"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]

View File

@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mariadb
labels:
app: mariadb
spec:
replicas: 1
serviceName: mariadb
selector:
matchLabels:
app: mariadb
template:
metadata:
labels:
app: mariadb
spec:
containers:
- name: mariadb
image: mariadb
imagePullPolicy: Never
volumeMounts:
- name: mariadb
mountPath: /var/lib/mysql
volumes:
- name: mariadb
persistentVolumeClaim:
claimName: mariadb

View File

@ -0,0 +1,25 @@
FROM alpine
RUN sleep 10
RUN apk update
RUN apk add openssh
RUN apk add openssl
RUN apk add nginx
RUN apk add telegraf
COPY srcs/start.sh /root/start.sh
COPY srcs/nginx.conf /etc/nginx/nginx.conf
COPY srcs/index.html /var/www/index.html
COPY srcs/telegraf.conf /etc/telegraf/telegraf.conf
WORKDIR /root/
RUN adduser --disabled-password admin
RUN echo "admin:password" | chpasswd
RUN openssl genrsa -out nginx.key
RUN openssl req -new -key nginx.key -out nginx.csr -subj "/C=NL/ST=Friesland/L=Heerenveen/O=localhost/OU=localhost/CN=localhost/emailAddress=djonker@student.codam.nl"
RUN openssl x509 -req -days 365 -in nginx.csr -signkey nginx.key -out nginx.crt
RUN mv nginx.crt /etc/ssl/certs/nginx.crt
RUN mv nginx.key /etc/ssl/private/nginx.key
RUN chmod 600 /etc/ssl/certs/nginx.crt /etc/ssl/private/nginx.key
RUN ssh-keygen -A
CMD sh start.sh
EXPOSE 80/tcp
EXPOSE 443/tcp
EXPOSE 22/tcp

View File

@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: Never
livenessProbe:
exec:
command:
- /bin/sh
- -c
- 'pgrep telegraf && pgrep sshd && pgrep nginx'

21
srcs/nginx/service.yaml Normal file
View File

@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
type: LoadBalancer
selector:
app: nginx
ports:
- name: http
protocol: TCP
port: 80
nodePort: 80
- name: https
protocol: TCP
port: 443
nodePort: 443
- name: ssh
protocol: TCP
port: 22
nodePort: 22

View File

@ -0,0 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="Houtworm" content="">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<script src="js/script.js"></script>
<h1>You seem to be a rigorous tester :)</h1>
</body>
</html>

View File

@ -0,0 +1,50 @@
user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
error_log /var/log/nginx/error.log notice;
error_log /var/log/nginx/error.log info;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 3600;
gzip on;
gzip_comp_level 6;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/rss+xml text/javascript image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype;
server {
listen 443 ssl default_server;
ssl_certificate /etc/ssl/certs/nginx.crt;
ssl_certificate_key /etc/ssl/private/nginx.key;
root /var/www;
index index.php index.html index.htm;
server_name localhost;
location / {
autoindex on;
try_files $uri $uri/ =404;
}
location = /wordpress {
return 307 https://$host:5050;
}
location /phpmyadmin/ {
proxy_pass https://$host:5000;
}
}
server {
listen 80;
return 301 https://$host$request_uri;
}
}

4
srcs/nginx/srcs/start.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
/usr/sbin/sshd
telegraf &
nginx -g 'daemon off;'

View File

@ -0,0 +1,28 @@
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
urls = ["http://influxdb:8086"]
database = "nginx"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]

View File

@ -0,0 +1,32 @@
FROM alpine
RUN sleep 10
RUN apk update
RUN apk add openssl
RUN apk add nginx
RUN apk add php7
RUN apk add php7-fpm
RUN apk add php7-mysqli
RUN apk add php7-gd
RUN apk add php7-mbstring
RUN apk add php7-curl
RUN apk add php7-json
RUN apk add php7-xml
RUN apk add php7-zip
RUN apk add telegraf
COPY srcs/start.sh /root/start.sh
COPY srcs/nginx.conf /etc/nginx/nginx.conf
COPY srcs/telegraf.conf /etc/telegraf/telegraf.conf
COPY srcs/wordpress.conf /var/www/wordpress/wp-config.php
WORKDIR /root/
RUN wget https://wordpress.org/latest.tar.gz
RUN tar -xvf latest.tar.gz
RUN mv wordpress/* /var/www/wordpress/
RUN chown -R root:root /var/www
RUN openssl genrsa -out nginx.key
RUN openssl req -new -key nginx.key -out nginx.csr -subj "/C=NL/ST=Friesland/L=Heerenveen/O=localhost/OU=localhost/CN=localhost/emailAddress=djonker@student.codam.nl"
RUN openssl x509 -req -days 365 -in nginx.csr -signkey nginx.key -out nginx.crt
RUN mv nginx.crt /etc/ssl/certs/nginx.crt
RUN mv nginx.key /etc/ssl/private/nginx.key
RUN chmod 600 /etc/ssl/certs/nginx.crt /etc/ssl/private/nginx.key
CMD sh start.sh
EXPOSE 5050/tcp

View File

@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: wordpress
labels:
app: wordpress
spec:
replicas: 1
selector:
matchLabels:
app: wordpress
template:
metadata:
labels:
app: wordpress
spec:
containers:
- name: wordpress
image: wordpress
imagePullPolicy: Never
livenessProbe:
exec:
command:
- /bin/sh
- -c
- 'pgrep telegraf && pgrep php-fpm7 && pgrep nginx'

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: wordpress
spec:
type: LoadBalancer
selector:
app: wordpress
ports:
- name: wordpress
protocol: TCP
port: 5050
nodePort: 5050

View File

@ -0,0 +1,50 @@
user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
error_log /var/log/nginx/error.log notice;
error_log /var/log/nginx/error.log info;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 3600;
gzip on;
gzip_comp_level 6;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/rss+xml text/javascript image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype;
server {
listen 5050 ssl default_server;
ssl_certificate /etc/ssl/certs/nginx.crt;
ssl_certificate_key /etc/ssl/private/nginx.key;
root /var/www/wordpress;
index index.php index.html index.htm;
server_name localhost;
location / {
autoindex on;
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi.conf;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
}
# server {
# listen 5050;
# return 301 https://$host$request_uri:5050;
# }
}

View File

@ -0,0 +1,4 @@
#!/bin/sh
telegraf &
php-fpm7 &
nginx -g 'daemon off;'

View File

@ -0,0 +1,28 @@
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
urls = ["http://influxdb:8086"]
database = "wordpress"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]

View File

@ -0,0 +1,94 @@
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/support/article/editing-wp-config-php/
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'wordpress' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password' );
/** MySQL hostname */
define( 'DB_HOST', 'mariadb' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8mb4' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 's`&T$qD81;7*0*cQQ[(,kaUO9dJZsg+>[MB(,6o8c}ixu]o4<7:IfFm47YlZ}H.g' );
define( 'SECURE_AUTH_KEY', 'VP]zWxYl9qI7UN&2Tpxfi19GVKVnL K{E<{eQk@%yGVAenVYI9=fMdW<u8F?|hM@' );
define( 'LOGGED_IN_KEY', 'fmx,d+CobrGgu8YKClAupcXZPr#~a#>wQ8H#^=T}lYc-[<;_{GB>O1J<0hRB aS8' );
define( 'NONCE_KEY', '~mc~SvOjEtecCl`LGO*gBSc+LSF(uJIn[*CYs>X?9_pLAI 2-I5L_MK@rsjGpi~l' );
define( 'AUTH_SALT', 'W{pgvAJTq@!kWR2_e2K(,1QDh^t{(2nO@.n!M>bqpFI0J0kz[=)&K_X)qk|64H`m' );
define( 'SECURE_AUTH_SALT', 'jjnbWeXgfySz<d!#/9Hi;CrB`FJy76&=u+N#HyOy+.At nPS492p8PH{z(b?.lU^' );
define( 'LOGGED_IN_SALT', '~@ClPol9m9<,Mv.,&cA!a`iR{kxq29bhLdH?/(yV+)2^9[,I-1yC?=VfXB#BPB[o' );
define( 'NONCE_SALT', '@T?7wO4&YykHFhpw#^c4>Hg&yal@!YSRcZr@G3</ztzN2v5__%RQ@;fN3_b)w0*`' );
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';