#!/bin/bash


if [[ $1 = "check" ]]
then
   if grep -q "tlsfilter" /proc/modules
       then
          echo "active"
       else 
          echo "inactive"
   fi

elif [[ $1 = "on" ]]
then
     insmod /usr/lib/idefix/tlsfilter/module/tlsfilter.ko
     systemctl start tls-sni.service
     systemctl start tls-sni.path
     echo "Tlsfilter on"

elif [[ $1 == "off" ]] 
then
     rmmod tlsfilter
     systemctl stop tls-sni.path
     systemctl stop tls-sni.service
     echo "Tlsfilter off"
else 
    echo "Bad parameter. Use on or off"

fi