mirror of
				https://gitlab.crans.org/mediatek/med.git
				synced 2025-11-04 08:22:14 +01:00 
			
		
		
		
	Remplissage complet de l'ipset au démarage
This commit is contained in:
		@@ -15,12 +15,15 @@
 | 
				
			|||||||
# You should have received a copy of the GNU General Public License along
 | 
					# 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.,
 | 
					# with this program; if not, write to the Free Software Foundation, Inc.,
 | 
				
			||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 | 
					# 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
 | 
					# Ce script est appellé avant le démarage du portail, il insère les bonnes règles
 | 
				
			||||||
# dans l'iptables et active le routage
 | 
					# dans l'iptables et active le routage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import os, sys
 | 
					import os, sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from django.core.wsgi import get_wsgi_application
 | 
				
			||||||
 | 
					from os.path import dirname
 | 
				
			||||||
 | 
					
 | 
				
			||||||
proj_path = "/var/www/portail_captif/"
 | 
					proj_path = "/var/www/portail_captif/"
 | 
				
			||||||
# This is so Django knows where to find stuff.
 | 
					# This is so Django knows where to find stuff.
 | 
				
			||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "portail_captif.settings")
 | 
					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.
 | 
					# This is so my local_settings.py gets loaded.
 | 
				
			||||||
os.chdir(proj_path)
 | 
					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
 | 
					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
 | 
					# Restauration de l'iptables
 | 
				
			||||||
restore_iptables()
 | 
					restore_iptables()
 | 
				
			||||||
# Activation du routage sur les bonnes if
 | 
					# Activation du routage sur les bonnes if
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user