| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  | ############################################ | 
					
						
							|  |  |  | ### NGINX T-Pot configuration file by mo ### | 
					
						
							|  |  |  | ############################################ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | server { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ######################### | 
					
						
							|  |  |  |     ### Basic server settings | 
					
						
							|  |  |  |     ######################### | 
					
						
							| 
									
										
										
										
											2024-12-04 19:55:39 +00:00
										 |  |  |     listen 64297 ssl; | 
					
						
							|  |  |  |     http2 on; | 
					
						
							| 
									
										
										
										
											2022-01-29 00:00:29 +00:00
										 |  |  |     index index.html; | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |     ssl_protocols TLSv1.3; | 
					
						
							|  |  |  |     server_name example.com; | 
					
						
							|  |  |  |     error_page 300 301 302 400 401 402 403 404 500 501 502 503 504 /error.html; | 
					
						
							| 
									
										
										
										
											2022-01-29 00:00:29 +00:00
										 |  |  |     root /var/lib/nginx/html; | 
					
						
							| 
									
										
										
										
											2023-02-03 18:16:32 +00:00
										 |  |  |     add_header Cache-Control "public, max-age=604800"; | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ############################################## | 
					
						
							|  |  |  |     ### Remove version number add different header | 
					
						
							|  |  |  |     ############################################## | 
					
						
							|  |  |  |     server_tokens off; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ############################################## | 
					
						
							|  |  |  |     ### SSL settings and Cipher Suites | 
					
						
							|  |  |  |     ############################################## | 
					
						
							|  |  |  |     ssl_certificate /etc/nginx/cert/nginx.crt; | 
					
						
							|  |  |  |     ssl_certificate_key /etc/nginx/cert/nginx.key; | 
					
						
							| 
									
										
										
										
											2022-02-12 01:04:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |     ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:!DHE:!SHA:!SHA256'; | 
					
						
							|  |  |  |     ssl_ecdh_curve secp384r1; | 
					
						
							|  |  |  |     ssl_dhparam /etc/nginx/ssl/dhparam4096.pem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ssl_prefer_server_ciphers on; | 
					
						
							|  |  |  |     ssl_session_cache shared:SSL:10m; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #################################### | 
					
						
							|  |  |  |     ### OWASP recommendations / settings | 
					
						
							|  |  |  |     #################################### | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-12 01:04:02 +00:00
										 |  |  |     ### Size Limits & Buffer Overflows | 
					
						
							|  |  |  |     ### the size may be configured based on the needs. | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |     client_body_buffer_size  128k; | 
					
						
							|  |  |  |     client_header_buffer_size 1k; | 
					
						
							|  |  |  |     client_max_body_size 2M; | 
					
						
							| 
									
										
										
										
											2023-02-21 00:13:52 +00:00
										 |  |  |      | 
					
						
							| 
									
										
										
										
											2023-02-23 15:51:42 +00:00
										 |  |  |     ### Changed from OWASP recommendations: "2 1k" to "2 1280" (So 1.2k) | 
					
						
							|  |  |  |     ### When you pass though potentially another reverse proxy/load balancer | 
					
						
							|  |  |  |     ### in front of tpotce you can introduce more headers than normal and | 
					
						
							|  |  |  |     ### therefore you can exceed the allowed header buffer of 1k. | 
					
						
							|  |  |  |     ### An 280 extra bytes seems to be working for most use-cases. | 
					
						
							|  |  |  |     ### And still keeping it close to OWASP's recommendation. | 
					
						
							| 
									
										
										
										
											2023-02-21 00:13:52 +00:00
										 |  |  |     large_client_header_buffers 2 1280; | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ### Mitigate Slow HHTP DoS Attack | 
					
						
							|  |  |  |     ### Timeouts definition ## | 
					
						
							|  |  |  |     client_body_timeout   10; | 
					
						
							|  |  |  |     client_header_timeout 10; | 
					
						
							|  |  |  |     keepalive_timeout     5 5; | 
					
						
							|  |  |  |     send_timeout          10; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ### X-Frame-Options is to prevent from clickJacking attack | 
					
						
							|  |  |  |     add_header X-Frame-Options SAMEORIGIN; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ### disable content-type sniffing on some browsers. | 
					
						
							|  |  |  |     add_header X-Content-Type-Options nosniff; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ### This header enables the Cross-site scripting (XSS) filter | 
					
						
							|  |  |  |     add_header X-XSS-Protection "1; mode=block"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ### This will enforce HTTP browsing into HTTPS and avoid ssl stripping attack | 
					
						
							|  |  |  |     add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;"; | 
					
						
							| 
									
										
										
										
											2022-02-12 01:04:02 +00:00
										 |  |  | #    add_header 'Content-Security-Policy' 'upgrade-insecure-requests'; | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ################################## | 
					
						
							|  |  |  |     ### Restrict access and basic auth | 
					
						
							|  |  |  |     ################################## | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # satisfy all; | 
					
						
							|  |  |  |     satisfy any; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # allow 10.0.0.0/8; | 
					
						
							|  |  |  |     # allow 172.16.0.0/12; | 
					
						
							|  |  |  |     # allow 192.168.0.0/16; | 
					
						
							|  |  |  |     allow 127.0.0.1; | 
					
						
							|  |  |  |     allow ::1; | 
					
						
							|  |  |  |     deny  all; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auth_basic           "closed site"; | 
					
						
							|  |  |  |     auth_basic_user_file /etc/nginx/nginxpasswd; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-29 00:00:29 +00:00
										 |  |  |     ############################# | 
					
						
							|  |  |  |     ### T-Pot Landing Page & Apps | 
					
						
							|  |  |  |     ############################# | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     location / { | 
					
						
							| 
									
										
										
										
											2023-04-27 16:42:38 +00:00
										 |  |  |         set_by_lua_block $index_file { | 
					
						
							| 
									
										
										
										
											2024-01-05 20:31:13 +00:00
										 |  |  |               return "index.html"; | 
					
						
							| 
									
										
										
										
											2023-04-27 16:42:38 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |         auth_basic           "closed site"; | 
					
						
							|  |  |  |         auth_basic_user_file /etc/nginx/nginxpasswd; | 
					
						
							| 
									
										
										
										
											2023-04-27 16:42:38 +00:00
										 |  |  |         index $index_file; | 
					
						
							|  |  |  |         try_files $uri $uri/ /$index_file; | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-20 17:42:17 +00:00
										 |  |  |     location /elasticvue { | 
					
						
							| 
									
										
										
										
											2022-01-30 00:48:10 +00:00
										 |  |  |         index index.html; | 
					
						
							| 
									
										
										
										
											2023-01-20 17:42:17 +00:00
										 |  |  |         alias /var/lib/nginx/html/esvue/; | 
					
						
							|  |  |  |         try_files $uri $uri/ /elasticvue/index.html; | 
					
						
							| 
									
										
										
										
											2022-01-30 00:48:10 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-20 17:42:17 +00:00
										 |  |  |     location /cyberchef { | 
					
						
							| 
									
										
										
										
											2022-01-27 02:39:23 +00:00
										 |  |  |         index index.html; | 
					
						
							| 
									
										
										
										
											2023-01-20 17:42:17 +00:00
										 |  |  |         alias /var/lib/nginx/html/cyberchef/; | 
					
						
							|  |  |  |         try_files $uri $uri/ /cyberchef/index.html; | 
					
						
							| 
									
										
										
										
											2022-01-27 02:39:23 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |     ################# | 
					
						
							|  |  |  |     ### Proxied sites | 
					
						
							|  |  |  |     ################# | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ### Kibana | 
					
						
							|  |  |  |     location /kibana/ { | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |         set_by_lua_block $kibana { | 
					
						
							|  |  |  |             local tpot_ostype = os.getenv("TPOT_OSTYPE") | 
					
						
							|  |  |  |             if tpot_ostype == "mac" or tpot_ostype == "win" then | 
					
						
							|  |  |  |                 return "http://kibana:5601"; | 
					
						
							|  |  |  |             else | 
					
						
							| 
									
										
										
										
											2024-12-09 16:38:25 +00:00
										 |  |  |                 return "http://kibana:5601"; | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |             end | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         proxy_pass $kibana; | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |         rewrite /kibana/(.*)$ /$1 break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-12 01:04:02 +00:00
										 |  |  |     ### ES | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |     location /es/ { | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |         set_by_lua_block $elasticsearch { | 
					
						
							|  |  |  |             local tpot_ostype = os.getenv("TPOT_OSTYPE") | 
					
						
							|  |  |  |             if tpot_ostype == "mac" or tpot_ostype == "win" then | 
					
						
							|  |  |  |                 return "http://elasticsearch:9200"; | 
					
						
							|  |  |  |             else | 
					
						
							| 
									
										
										
										
											2024-12-09 16:38:25 +00:00
										 |  |  |                 return "http://elasticsearch:9200"; | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |             end | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-01-05 20:31:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |         proxy_pass $elasticsearch; | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |         rewrite /es/(.*)$ /$1 break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-11 10:32:31 +00:00
										 |  |  |     ### Map | 
					
						
							| 
									
										
										
										
											2022-02-20 23:11:24 +00:00
										 |  |  |     location /map/ { | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |         set_by_lua_block $map_web { | 
					
						
							|  |  |  |             local tpot_ostype = os.getenv("TPOT_OSTYPE") | 
					
						
							|  |  |  |             if tpot_ostype == "mac" or tpot_ostype == "win" then | 
					
						
							|  |  |  |                 return "http://map_web:64299"; | 
					
						
							|  |  |  |             else | 
					
						
							| 
									
										
										
										
											2024-12-09 16:38:25 +00:00
										 |  |  |                 return "http://map_web:64299"; | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |             end | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         proxy_pass $map_web; | 
					
						
							| 
									
										
										
										
											2022-02-20 23:11:24 +00:00
										 |  |  |         rewrite /map/(.*)$ /$1 break; | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |         proxy_read_timeout 7200s; | 
					
						
							| 
									
										
										
										
											2022-02-20 23:11:24 +00:00
										 |  |  | 	proxy_http_version 1.1; | 
					
						
							|  |  |  |         proxy_set_header Upgrade $http_upgrade; | 
					
						
							|  |  |  |         proxy_set_header Connection "Upgrade"; | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  | 	proxy_set_header Host $http_host; | 
					
						
							|  |  |  | 	proxy_redirect http:// https://; | 
					
						
							| 
									
										
										
										
											2022-02-20 23:11:24 +00:00
										 |  |  |     } | 
					
						
							|  |  |  |     location /websocket { | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |         set_by_lua_block $map_web { | 
					
						
							|  |  |  |             local tpot_ostype = os.getenv("TPOT_OSTYPE") | 
					
						
							|  |  |  |             if tpot_ostype == "mac" or tpot_ostype == "win" then | 
					
						
							|  |  |  |                 return "http://map_web:64299"; | 
					
						
							|  |  |  |             else | 
					
						
							| 
									
										
										
										
											2024-12-09 16:38:25 +00:00
										 |  |  |                 return "http://map_web:64299"; | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |             end | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         proxy_pass $map_web; | 
					
						
							|  |  |  |         proxy_read_timeout 7200s; | 
					
						
							| 
									
										
										
										
											2022-02-20 23:11:24 +00:00
										 |  |  |         proxy_http_version 1.1; | 
					
						
							|  |  |  |         proxy_set_header Upgrade $http_upgrade; | 
					
						
							|  |  |  |         proxy_set_header Connection "Upgrade"; | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |         proxy_set_header Host $http_host; | 
					
						
							|  |  |  | 	proxy_redirect http:// https://; | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |     ### Spiderfoot | 
					
						
							|  |  |  |         set_by_lua_block $spiderfoot_backend { | 
					
						
							|  |  |  |             local tpot_ostype = os.getenv("TPOT_OSTYPE") | 
					
						
							|  |  |  |             if tpot_ostype == "mac" or tpot_ostype == "win" then | 
					
						
							|  |  |  |                 return "http://spiderfoot:8080"; | 
					
						
							|  |  |  |             else | 
					
						
							| 
									
										
										
										
											2024-12-09 16:38:25 +00:00
										 |  |  |                 return "http://spiderfoot:8080"; | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |             end | 
					
						
							| 
									
										
										
										
											2020-08-13 09:06:49 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-05-27 12:49:20 +00:00
										 |  |  |     location /spiderfoot/ { | 
					
						
							|  |  |  |         proxy_pass $spiderfoot_backend; | 
					
						
							|  |  |  | 	proxy_set_header Host $http_host; | 
					
						
							|  |  |  | 	proxy_redirect http:// https://; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     location ~ ^/(static|scanviz|scandelete|scaninfo) { | 
					
						
							|  |  |  |         proxy_pass $spiderfoot_backend/spiderfoot/$1$is_args$args; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-08-13 09:06:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-24 02:21:33 +00:00
										 |  |  | } |