x_old_misp_docker icon indicating copy to clipboard operation
x_old_misp_docker copied to clipboard

misp-proxy - HTTPS request redirect to HTTP response

Open pasket opened this issue 6 years ago • 2 comments

Hi,

I'm trying to configure misp-proxy to ensure all is transmited securely using https. However, if you make a https request, it always respondes with http page. For example:

httpS://localhost redirects to http://localhost/users/login
httpS://localhost/users/logout redirects to http://localhost/users/login
...

One https request gets an http redirection.

I appreciate any help.

Thanks.

pasket avatar Aug 16 '18 20:08 pasket

Hi,

I've been analyzing this issue and for the moment I'll work with this workarround. First thing, I don't need a reverse proxy jet, I just need to allow MISP access exclusively by HTTPS. So, I decided to focus on that and to configure misp-web image/container to serve HTTPS requests.

  1. Create a directory for the certificates and create using openssl
$ mkdir misp-web/ssl
$ cd misp-web/ssl
$ openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout misp-web.key -out misp-web.crt
  1. Change Apache configuration in order use only SSL. Do it in a separated file, I'll mount it later using docker-compose.
$ cd ..
$ vim misp.conf
	# <VirtualHost *:80>
	# 	ServerAdmin [email protected]
	# 	ServerName misp.local
	# 	DocumentRoot /var/www/MISP/app/webroot
	# 	<Directory /var/www/MISP/app/webroot>
	# 		Options -Indexes
	# 		AllowOverride all
	# 		Order allow,deny
	# 		allow from all
	# 	</Directory>
	# 
	# 	LogLevel warn
	# 	ErrorLog /var/log/apache2/misp.local_error.log
	# 	CustomLog /var/log/apache2/misp.local_access.log combined
	# 	ServerSignature Off
	#         Header set X-Content-Type-Options nosniff
	#         Header set X-Frame-Options DENY
	# </VirtualHost>

	<VirtualHost *:443>
		ServerAdmin [email protected]
		ServerName misp.local
		DocumentRoot /var/www/MISP/app/webroot
		<Directory /var/www/MISP/app/webroot>
			Options -Indexes
			AllowOverride all
			Order allow,deny
			allow from all
		</Directory>

		LogLevel warn
		ErrorLog /var/log/apache2/misp.local_error.log
		CustomLog /var/log/apache2/misp.local_access.log combined

		SSLEngine on
		SSLCertificateFile /etc/ssl/certs/misp-web/misp-web.crt
		SSLCertificateKeyFile /etc/ssl/certs/misp-web/misp-web.key

		ServerSignature Off
	        Header set X-Content-Type-Options nosniff
	        Header set X-Frame-Options DENY
	</VirtualHost>
  1. Modify docker-compose to share https port and mount configuration file and the certificates
$ cd ..
$ vim docker-compose.yml
	...
	ports:
      # - "80:80"
      - "443:443"
    volumes:
      - ./misp-web/misp.conf:/etc/apache2/sites-available/misp.conf
      - ./misp-web/ssl:/etc/ssl/certs/misp-web
      ...
	...
  1. Start docker-compose, just to create the container. MISP will not work yet. $ docker-compose up -d

  2. I don't really like this because it applies to the container and not to the image. We need to activate ssl and restart Apache.

$ docker exec -it misp-web a2enmod ssl
$ docker exec -it misp-web service apache2 restart
  1. Ready. Check https://<your_misp_ip>

pasket avatar Aug 17 '18 20:08 pasket

Hey! Reaching out since this issue is the closest one to mine.

I am attempting to setup https only traffic with an ssl and have my misp server be available at a subdomain i.e.( misp.xxxx.com).

Updated the docker.compose.yml and apache2 config and ssl certs. The browser is happy with the domain name and says the certs are valid but when I login I get image

Any thoughts?

guirkgumbo avatar Jun 14 '21 02:06 guirkgumbo