From 45b26b1e341328e9efb9343000b1fbd405752da4 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Mon, 12 Jun 2017 11:33:25 +0200 Subject: [PATCH] =?UTF-8?q?Remplissage=20complet=20de=20l'ipset=20au=20d?= =?UTF-8?q?=C3=A9marage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portail_captif/start_portail.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/portail_captif/start_portail.py b/portail_captif/start_portail.py index 1b3c91d..7c096bc 100755 --- a/portail_captif/start_portail.py +++ b/portail_captif/start_portail.py @@ -15,12 +15,15 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# +# # Ce script est appellé avant le démarage du portail, il insère les bonnes règles # dans l'iptables et active le routage import os, sys +from django.core.wsgi import get_wsgi_application +from os.path import dirname + proj_path = "/var/www/portail_captif/" # This is so Django knows where to find stuff. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "portail_captif.settings") @@ -29,9 +32,18 @@ sys.path.append(proj_path) # This is so my local_settings.py gets loaded. os.chdir(proj_path) -from users.models import restore_iptables, apply +from users.models import restore_iptables, create_ip_set, fill_ipset, apply from portail_captif.settings import AUTORIZED_INTERFACES + +application = get_wsgi_application() + +# Creation de l'ipset +create_ip_set() + +# Remplissage avec les macs autorisées +fill_ipset() + # Restauration de l'iptables restore_iptables() # Activation du routage sur les bonnes if