wapt-barracuda-nac/setup.py

64 lines
2.4 KiB
Python

# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
# This file is part of WAPT
# Copyright (C) 2013 Tranquil IT Systems http://www.tranquil.it
# WAPT aims to help Windows systems administrators to deploy
# setup and update applications on users PC.
#
# WAPT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# WAPT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WAPT. If not, see <http://www.gnu.org/licenses/>.
#
# -----------------------------------------------------------------------
from setuphelpers import *
uninstallkey = []
variables = {
#'barracuda_nac_conf': XXXX
}
# Read local variables file if available
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
print('Reading local encrypted variables file')
from cryptography.fernet import Fernet
import yaml
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read())
variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())))
def install():
import re
print('Installing Barracuda Network Access Client')
match = re.search('(\d+\.\d+\.\d+)\.(\d+)$',control['version'].split('-',1)[0])
major_version = match.group(1)
minor_version = match.group(2)
install_exe_if_needed(
'NetworkAccessClient_%s-%s_x64.exe' % (major_version, minor_version),
silentflags=r'/clone_wait /s /v"/qr PROGTYPE=VPN REBOOT=Suppress"',
key='{51A8F280-06EC-490C-8AE6-D702F5689507}',
min_version=major_version,
killbefore=['nacvpn.exe','nacuserctx.exe']
)
if 'barracuda_nac_conf' in variables:
print('Configuring Barracuda Network Access Client')
open('barracuda.reg','w').write(
variables['barracuda_nac_conf']
)
run('reg import barracuda.reg')
if __name__ == '__main__':
update_package()