1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

Feature switch for firewall applier

This commit is contained in:
Игорь Чудов 2020-06-30 17:47:15 +04:00
parent 6df2f45b89
commit 95e2f5dbb1
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

View File

@ -17,18 +17,33 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .applier_frontend import applier_frontend
from .applier_frontend import (
applier_frontend
, check_enabled
)
from .appliers.firewall_rule import FirewallRule
class firewall_applier(applier_frontend):
__module_name = 'FirewallApplier'
__module_experimental = True
__module_enabled = False
__firewall_branch = 'SOFTWARE\\Policies\\Microsoft\\WindowsFirewall\\FirewallRules'
def __init__(self, storage):
self.storage = storage
self.firewall_settings = self.storage.filter_hklm_entries('{}%'.format(self.__firewall_branch))
self.__module_enabled = check_enabled(
self.storage
, self.__module_name
, self.__module_experimental
)
def apply(self):
def run(self):
for setting in self.firewall_settings:
rule = FirewallRule(setting.data)
rule.apply()
def apply(self):
if self.__module_enabled:
self.run()