DIRECTORY REDIRECTION (OPSEC)

#if not c2.conf then direct.conf, etc - this config file is for whatever need to be redirected
root@NGVM: nano /etc/nginx/conf.d/c2.conf
 server{
   listen 443 ssl default_server;
   listen [::]:443 ssl default-server;
   
   ssl_certificate /etc/letsencrypt/live/nuclear.cyberwarfare.live/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/nuclear.cyberwarfare.live/privatekey.pem;
   ssl_session_cache shared:le_nginx_SSL:1m;
   ssl_session_timeout 1440m;
   
   ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
   ssl_prefer_server_ciphers on;
   
   ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-SHA ECDHE-ECDSA-AES256-SHA ECDHE-ECD$
   
   root /var/www/html;
   index index.php index.html index.htm index.nginx-debian.html;              //these are the files that will be served
   
   server_name nuclear.cyberwarfare.live;
   
   #if anyone visits the root directory '/' then they'll get a 404 error
   location / {
     try_files $uri $uri/ =404;
   }
   
   #anyone visiting the /cwl directory will then be redirected to the payload server
   #also, it is setup to only accept incoming traffic from an authenticated source
   location /cwl {
     proxy_pass http://20.66.87.234:5555/;                 //this is the payload ip/port which is this nginx vm
	 proxy_redirect off;
	 proxy_set_header Host $host;
	 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   }
 }
 
#Reload NGINX
root@NGVM:  sudo nginx -s reload

Last updated