diff --git a/.gitignore b/.gitignore
index d18402de..9a0bac94 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*.pyc
.*.swp
+.DS_Store
diff --git a/modules/speedtestv2.py b/modules/speedtestv2.py
new file mode 100644
index 00000000..797ae771
--- /dev/null
+++ b/modules/speedtestv2.py
@@ -0,0 +1,12 @@
+# Copyright 2018 dhtech
+#
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file
+
+
+def generate(host, *args):
+
+ info = {}
+ return {'speedtestv2': info}
+
+# vim: ts=4: sts=4: sw=4: expandtab
diff --git a/modules/speedtestv2/files/downloading.html b/modules/speedtestv2/files/downloading.html
new file mode 100644
index 00000000..b78c32fa
Binary files /dev/null and b/modules/speedtestv2/files/downloading.html differ
diff --git a/modules/speedtestv2/files/hosted.html b/modules/speedtestv2/files/hosted.html
new file mode 100644
index 00000000..ea51ac3b
--- /dev/null
+++ b/modules/speedtestv2/files/hosted.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ Speedtest by OpenSpeedtest.com
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/speedtestv2/files/index.html b/modules/speedtestv2/files/index.html
new file mode 100644
index 00000000..2772b6b6
--- /dev/null
+++ b/modules/speedtestv2/files/index.html
@@ -0,0 +1,167 @@
+
+
+
+ SpeedTest by OpenSpeedTest™
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/speedtestv2/files/upload.html b/modules/speedtestv2/files/upload.html
new file mode 100644
index 00000000..e69de29b
diff --git a/modules/speedtestv2/manifests/init.pp b/modules/speedtestv2/manifests/init.pp
new file mode 100644
index 00000000..5fcd49e2
--- /dev/null
+++ b/modules/speedtestv2/manifests/init.pp
@@ -0,0 +1,115 @@
+# Copyright 2024 dhtech
+#
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file
+#
+# == Class: speedtest
+#
+# This class manages the speedtest
+#
+#
+# === Parameters
+#
+
+class speedtestv2 {
+
+ ensure_packages(['ssl-cert', 'nginx'])
+
+ file { '/etc/ssl/certs/server-fullchain.crt':
+ ensure => file,
+ owner => 'root',
+ group => 'ssl-cert',
+ mode => '0644',
+ source => 'puppet:///letsencrypt/fullchain.pem',
+ links => 'follow',
+ notify => Service['nginx'],
+ }
+
+ file { '/etc/ssl/private/server.key':
+ ensure => file,
+ owner => 'root',
+ group => 'ssl-cert',
+ mode => '0640',
+ source => 'puppet:///letsencrypt/privkey.pem',
+ links => 'follow',
+ notify => Service['nginx'],
+ }
+
+ service { 'nginx':
+ ensure => 'running',
+ name => 'nginx',
+ enable => true,
+ require => Package['nginx'],
+ }
+
+ file { '/etc/nginx/sites-enabled/default':
+ ensure =>absent,
+ force =>true,
+ notify =>Service['nginx'],
+ require =>Package['nginx'],
+ }
+
+ file { 'speedtestv2-conf':
+ ensure => file,
+ path => '/etc/nginx/sites-enabled/speedtest',
+ content => template('speedtestv2/speedtest.conf.erb'),
+ notify => Service['nginx'],
+ require => Package['nginx'],
+ }
+
+ # Needed for 'ssl-cert' group
+ ensure_packages(['ssl-cert'])
+
+ file { '/etc/ssl/certs/speedtest2.event.dreamhack.se.crt':
+ ensure => file,
+ owner => 'root',
+ group => 'ssl-cert',
+ mode => '0644',
+ source => 'puppet:///letsencrypt/fullchain.pem',
+ links => 'follow',
+ }
+
+ file { '/etc/ssl/private/speedtest2.event.dreamhack.se.key':
+ ensure => file,
+ owner => 'root',
+ group => 'ssl-cert',
+ mode => '0640',
+ source => 'puppet:///letsencrypt/privkey.pem',
+ links => 'follow',
+ }
+ file { '/usr/share/nginx/html/speedtestv2-downloading.html':
+ ensure => present,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ source => 'puppet:///modules/speedtestv2/downloading.html',
+}
+
+file { '/usr/share/nginx/html/index.html':
+ ensure => present,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ source => 'puppet:///modules/speedtestv2/index.html',
+}
+
+file { '/usr/share/nginx/html/hosted.html':
+ ensure => present,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ source => 'puppet:///modules/speedtestv2/hosted.html',
+}
+
+file { '/usr/share/nginx/html/upload.html':
+ ensure => present,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ source => 'puppet:///modules/speedtestv2/upload.html',
+}
+
+}
+
+
+
diff --git a/modules/speedtestv2/metadata.json b/modules/speedtestv2/metadata.json
new file mode 100644
index 00000000..17de50fe
--- /dev/null
+++ b/modules/speedtestv2/metadata.json
@@ -0,0 +1,13 @@
+{
+ "name": "speedtestv2",
+ "version": "0.1.0",
+ "author": "dhtech",
+ "summary": "speedtest v2 site",
+ "license": "BSD",
+ "source": "",
+ "project_page": null,
+ "issues_url": null,
+ "dependencies": [
+ {"name":"puppetlabs/stdlib","version_requirement":">= 1.0.0"}
+ ]
+}
diff --git a/modules/speedtestv2/templates/nginx.conf.erb b/modules/speedtestv2/templates/nginx.conf.erb
new file mode 100644
index 00000000..43a5213b
--- /dev/null
+++ b/modules/speedtestv2/templates/nginx.conf.erb
@@ -0,0 +1,15 @@
+worker_processes auto;
+worker_rlimit_nofile 100000;
+events {
+ worker_connections 2048;
+ multi_accept on;
+}
+
+error_log /var/log/nginx/error.log notice;
+pid /tmp/nginx.pid;
+
+http {
+ include mime.types;
+ default_type application/octet-stream;
+ include /etc/nginx/conf.d/*.conf;
+}
diff --git a/modules/speedtestv2/templates/speedtest.conf.erb b/modules/speedtestv2/templates/speedtest.conf.erb
new file mode 100644
index 00000000..7b228e55
--- /dev/null
+++ b/modules/speedtestv2/templates/speedtest.conf.erb
@@ -0,0 +1,106 @@
+# SpeedTest by OpenSpeedTest™ is a Free and Open-Source Network Speed Test Software.
+# Like this Project? Please Donate NOW & Keep us Alive -> https://go.openspeedtest.com/Donate
+# Thank you for your support! we greatly appreciate your donation.
+# Your contribution helps us continue to improve and maintain the tool for everyone to use.
+# Official Website : https://OpenSpeedTest.com | Email: support@openspeedtest.com
+# Developed by : Vishnu | https://Vishnu.Pro | Email : me@vishnu.pro
+
+server {
+ server_name _ localhost speedtest2.event.dreamhack.se;
+ listen 80 reuseport;
+ listen 443 ssl reuseport;
+ listen [::]:80 reuseport;
+ listen [::]:443 ssl reuseport;
+ # If you like to Enable HTTP2 add "http2" to the above line.
+ # If HTTP2 Enabled. Upload location should Proxy_Pass to http 1.1 port.
+ # Otherwise you will see abnormal Upload Speeds.
+ # Nginx Server Windows SSL Performance was very poor! Better use Linux if you need SSL support.
+ ssl_certificate /etc/ssl/certs/speedtest2.event.dreamhack.se.crt; # Use your own certificate & key
+ ssl_certificate_key /etc/ssl/private/speedtest2.event.dreamhack.se.key; # <-- key
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
+ ssl_ciphers "ALL";
+ ssl_prefer_server_ciphers on;
+ ssl_session_cache shared:SSL:100m;
+ ssl_session_timeout 1d;
+ ssl_session_tickets on;
+ root /usr/share/nginx/html/;
+ index index.html;
+ client_max_body_size 35m;
+ error_page 405 =200 $uri;
+ access_log off;
+ gzip off;
+ fastcgi_read_timeout 999;
+ log_not_found off;
+ server_tokens off;
+ error_log /dev/null; #Disable this for Windows Nginx.
+ tcp_nodelay on;
+ tcp_nopush on;
+ sendfile on;
+ open_file_cache max=200000 inactive=20s;
+ open_file_cache_valid 30s;
+ open_file_cache_min_uses 2;
+ open_file_cache_errors off;
+
+ location ~ /\.well-known/acme-challenge/ {
+ allow all;
+ default_type "text/plain";
+ root /usr/share/nginx/html/;
+ try_files $uri =404;
+ break;
+ }
+
+ location / {
+ add_header 'Access-Control-Allow-Origin' "*" always;
+ add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always;
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
+ #Very Very Important! You SHOULD send no-store from server for Google Chrome.
+ add_header Cache-Control 'no-store, no-cache, max-age=0, no-transform';
+ add_header Last-Modified $date_gmt;
+ if_modified_since off;
+ expires off;
+ etag off;
+
+ if ($request_method = OPTIONS ) {
+ add_header 'Access-Control-Allow-Credentials' "true";
+ add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always;
+ add_header 'Access-Control-Allow-Origin' "$http_origin" always;
+ add_header 'Access-Control-Allow-Methods' "GET, POST, OPTIONS" always;
+ return 200;
+ }
+ }
+
+ #HTTP2 & HTTP3 will not wait for the post body and return 200. We need to stop that behaviour.
+ #Otherwise, you will see abnormal upload speed. To fix this issue, Enable the following lines. (Only Applicable If you Enabled HTTP2 or HTTP3 in This Server.)
+
+ #HTTP2 & HTTP3 -> UPLOAD FIX -- START
+
+ #location = /upload {
+ # proxy_pass http://127.0.0.1:3000/dev-null;
+ #}
+ #location = /dev-null {
+ # return 200;
+ #}
+
+ #HTTP2 & HTTP3 -> UPLOAD FIX -- END
+
+ # Caching for Static Files,
+ location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|eot|woff|woff2|svg)$ {
+ access_log off;
+ expires 365d;
+ add_header Cache-Control public;
+ add_header Vary Accept-Encoding;
+ tcp_nodelay off;
+ open_file_cache max=3000 inactive=120s;
+ open_file_cache_valid 45s;
+ open_file_cache_min_uses 2;
+ open_file_cache_errors off;
+ gzip on;
+ gzip_disable "msie6";
+ gzip_vary on;
+ gzip_proxied any;
+ gzip_comp_level 6;
+ gzip_buffers 16 8k;
+ gzip_http_version 1.1;
+ gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
+ }
+}
\ No newline at end of file