Add Nginx Cockpit Awareness

This commit is contained in:
t3chn0m4g3 2023-04-27 18:42:38 +02:00
parent a08a475f57
commit 5fd0d158e6
6 changed files with 152 additions and 5 deletions

View file

@ -7,7 +7,8 @@ COPY dist/ /root/dist/
RUN apk -U --no-cache add \ RUN apk -U --no-cache add \
nginx \ nginx \
nginx-mod-http-brotli \ nginx-mod-http-brotli \
nginx-mod-http-headers-more && \ nginx-mod-http-headers-more \
nginx-mod-http-lua && \
# #
## Setup T-Pot Landing Page, Eleasticvue, Cyberchef ## Setup T-Pot Landing Page, Eleasticvue, Cyberchef
cp -R /root/dist/html/* /var/lib/nginx/html/ && \ cp -R /root/dist/html/* /var/lib/nginx/html/ && \

View file

@ -5,6 +5,13 @@ load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so;
load_module /usr/lib/nginx/modules/ngx_http_brotli_filter_module.so; load_module /usr/lib/nginx/modules/ngx_http_brotli_filter_module.so;
load_module /usr/lib/nginx/modules/ngx_http_brotli_static_module.so; load_module /usr/lib/nginx/modules/ngx_http_brotli_static_module.so;
# OS ENV variables need to be defined here, so Lua can use them
env COCKPIT;
# Both modules are needed for Lua, in this exact order
load_module /usr/lib/nginx/modules/ndk_http_module.so;
load_module /usr/lib/nginx/modules/ngx_http_lua_module.so;
events { events {
worker_connections 768; worker_connections 768;
# multi_accept on; # multi_accept on;
@ -15,7 +22,6 @@ http {
## ##
# Basic Settings # Basic Settings
## ##
sendfile on; sendfile on;
tcp_nopush on; tcp_nopush on;
tcp_nodelay on; tcp_nodelay on;

View file

@ -90,16 +90,23 @@ server {
auth_basic "closed site"; auth_basic "closed site";
auth_basic_user_file /etc/nginx/nginxpasswd; auth_basic_user_file /etc/nginx/nginxpasswd;
############################# #############################
### T-Pot Landing Page & Apps ### T-Pot Landing Page & Apps
############################# #############################
location / { location / {
index index.html; set_by_lua_block $index_file {
local cockpit = os.getenv("COCKPIT")
if cockpit == "false" then
return "index_light.html"
else
return "index.html"
end
}
auth_basic "closed site"; auth_basic "closed site";
auth_basic_user_file /etc/nginx/nginxpasswd; auth_basic_user_file /etc/nginx/nginxpasswd;
try_files $uri $uri/ /index.html; index $index_file;
try_files $uri $uri/ /$index_file;
} }
location /elasticvue { location /elasticvue {

71
docker/nginx/dist/html/config_light.js vendored Normal file
View file

@ -0,0 +1,71 @@
// ╔╗ ╔═╗╔╗╔╔╦╗╔═╗
// ╠╩╗║╣ ║║║ ║ ║ ║
// ╚═╝╚═╝╝╚╝ ╩ ╚═╝
// ┌─┐┌─┐┌┐┌┌─┐┬┌─┐┬ ┬┬─┐┌─┐┌┬┐┬┌─┐┌┐┌
// │ │ ││││├┤ ││ ┬│ │├┬┘├─┤ │ ││ ││││
// └─┘└─┘┘└┘└ ┴└─┘└─┘┴└─┴ ┴ ┴ ┴└─┘┘└┘
const CONFIG = {
// ┌┐ ┌─┐┌─┐┬┌─┐┌─┐
// ├┴┐├─┤└─┐││ └─┐
// └─┘┴ ┴└─┘┴└─┘└─┘
// General
imageBackground: true,
openInNewTab: true,
twelveHourFormat: false,
// Greetings
greetingMorning: 'Good morning ☕',
greetingAfternoon: 'Good afternoon 🍯',
greetingEvening: 'Good evening 😁',
greetingNight: 'Go to Sleep 🥱',
// ┬ ┬┌─┐┌┬┐┌─┐
// │ │└─┐ │ └─┐
// ┴─┘┴└─┘ ┴ └─┘
//Icons
firstListIcon: 'home',
secondListIcon: 'external-link',
// Links
lists: {
firstList: [
{
name: 'Attack Map',
link: '/map/',
},
{
name: 'Cyberchef',
link: '/cyberchef/',
},
{
name: 'Elasticvue',
link: '/elasticvue/',
},
{
name: 'Kibana',
link: '/kibana/',
},
{
name: 'Spiderfoot',
link: '/spiderfoot/',
},
],
secondList: [
{
name: 'SecurityMeter',
link: 'https://sicherheitstacho.eu',
},
{
name: 'T-Pot @ GitHub',
link: 'https://github.com/telekom-security/tpotce/',
},
{
name: 'T-Pot ReadMe',
link: 'https://github.com/telekom-security/tpotce/blob/master/README.md',
},
],
},
};

60
docker/nginx/dist/html/index_light.html vendored Normal file
View file

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>T-Pot</title>
<link
rel=" shortcut icon"
type="image/png"
href="assets/icons/favicon.png"
/>
<link rel="stylesheet" href="app.css" />
<script src="assets/js/lucide.min.js"></script>
</head>
<!--
╔╗ ╔═╗╔╗╔╔╦╗╔═╗
╠╩╗║╣ ║║║ ║ ║ ║
╚═╝╚═╝╝╚╝ ╩ ╚═╝
-->
<body class="">
<div class="container">
<!-- Clock and Greetings -->
<div class="timeBlock">
<div class="clock">
<div id="hour" class=""></div>
<div id="separator" class=""></div>
<div id="minutes" class=""></div>
</div>
<div id="greetings"></div>
</div>
<!--
┬ ┬┌─┐┌┬┐┌─┐
│ │└─┐ │ └─┐
┴─┘┴└─┘ ┴ └─┘
-->
<div class="card list list__1" id="list_1"></div>
<div class="card list list__2" id="list_2"></div>
</div>
<!-- Config -->
<script src="config_light.js"></script>
<!-- Scripts -->
<script src="assets/js/time.js"></script>
<script src="assets/js/theme.js"></script>
<script src="assets/js/greeting.js"></script>
<script src="assets/js/lists.js"></script>
<script>
lucide.createIcons();
</script>
</body>
<!-- Developed and designed by Miguel R. Ávila: -->
<!-- https://github.com/migueravila -->
</html>

View file

@ -5,6 +5,8 @@ services:
# nginx service # nginx service
nginx: nginx:
build: . build: .
environment:
- COCKPIT=false
container_name: nginx container_name: nginx
restart: always restart: always
tmpfs: tmpfs: