A
A
Amurchikus2014-10-02 11:58:37
PHP
Amurchikus, 2014-10-02 11:58:37

How to connect WEB (php) session with Iptables (firewall)?

Good afternoon fellow programmers!
I ask for help to find a way to associate a web session with iptables.
There is a web form for user authorization, when authorizing in which (establishing a session) it is necessary to include a rule for skipping packets in the itables firewall - in other words, it is necessary to build a rule for a web session (if there is a session, then the rule is enabled).
I'm trying to do this on a Debian OS.
In this matter, how and where and what packets go is not important. It is important to understand how you can build a firewall check during a web session?
Maybe someone implemented this on other systems, I will be grateful for an example.
I'm trying to implement on a Debian + iptables+apache2+php5 bundle
Thanks for any help!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
IPv4, 2014-10-02
@Amurchikus

shell_exec?

I
Ivan Kiselev, 2014-10-02
@homelessness

Oh oh oh. I have never implemented it, but, for example, when creating a new session, you can use php to create some file containing the addition of the necessary iptables rule, and when the session ends, create a file with the rule to delete, and bash script by cron, or a daemon run - check the status of these created files and apply the rules from the newly appeared files. It sounds very crooked, but nothing else came to mind.

P
Pavel Belyaev, 2018-01-10
@PavelBelyaev

When creating a session, add an entry to the database, run another PHP script using the crontab, which will see new entries and their statuses and at the same time entries to delete and manage iptables

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question