Movie Streaming: A Fail2Ban-Naxsi-Fancyindex Project

The aim of this project is to integrate the functionality of different softwares in order to better understand the potencials of integrating them together. In this small project we will create a location from where we will stream safely mp4 movies.

Required Materials:

  • a computer running linux
  • compiled nginx with fancymodule and naxsi
  • fail2ban installed
  • external hard drive to store the movies
  • any mp4 movie
  • After having installled the required software enable the fail2ban jails modifing the file jail.conf located in /etc/fail2ban. Most importantly enable the rules related to ssh and nginx-basic-auth. Follow the steps at this link to add a naxsi profile to fail2ban. In this way when the rules are not respected fail2ban will block the ip of the offenders.

    Install the package apache utilities with the command sudo apt-get install apache2-utils. This will permit you to setup a password for the auth basic module. Next setup the password with the command sudo htpasswd -c /etc/nginx/.htpasswd username.

    In the root of nginx create a folder called Stream. It will be the folder from which we will stream the movies.

    Modify the nginx configuration adding the following locations to your existing server block:

    Now use the command sudo fdisk -l to discover the location of your hard drive. Than mount it in the Stream folder previously created and mount it in that location wih the command sudo mount /*/ /usr/share/nginx/html/Stream.

    Go to http://yourip/Stream, insert your username and password, and only then you will see the list of all your files inside the hard drive, if you click on one of your mp4 movies it should start streaming. Fail2ban will take care of banning all the ips that fail to insert the right password. It is racommended to use https connections over http in order to protect the password.

    Enjoy your very personal Movie Streaming Server :)

    This article was last updatated the 15/2/16