def setup(python_lib_only=None): if python_lib_only is not None: python_lib_only = val_to_boolean(python_lib_only) if not python_lib_only: if OS_ID in ['rhel', 'centos']: raise UnsupportedOS(kb='KB00003') elif OS_LIKE == 'debian': install_system_packages(['libow-dev']) elif OS_LIKE == 'fedora': install_system_packages(['owfs-libs', 'owfs-devel']) else: if not Path('/usr/include/owcapi.h').exists() and not Path( '/usr/local/include/owcapi.h').exists(): build_system_package( src= 'https://github.com/owfs/owfs/releases/download/v3.2p4/owfs-3.2p4.tar.gz', sha256= 'af0a5035f3f3df876ca15aea13486bfed6b3ef5409dee016db0be67755c35fcc', tdir='owfs-3.2p4', configure_args=[ '--prefix=/usr', '--disable-owtcl', '--disable-owphp', '--disable-owpython', '--disable-zero', '--disable-owshell', '--disable-owhttpd', '--disable-owftpd', '--disable-owserver', '--disable-owperl', '--disable-owtap', '--disable-owmon', '--disable-owexternal' ], update_ld=True) append_python_libraries(python_libs)
def setup(): if OS_LIKE == 'debian': install_system_packages(['libsnmp-dev']) elif OS_LIKE == 'fedora': install_system_packages(['net-snmp-devel']) elif OS_LIKE == 'alpine': install_system_packages(['net-snmp-dev']) else: raise UnsupportedOS append_python_libraries(python_libs)
def setup(controller=None, cert=None, key=None, listen=None, module=None, chain=None, redirect=None, http=None): if controller not in ['uc', 'lm', 'sfa']: raise InvalidParameter if not is_enabled(controller): raise FunctionFailed(f'{controller} is not enebled') if listen is None or ':' not in listen: raise InvalidParameter if http and ':' not in http: raise InvalidParameter if module is None: module = 'builtin' if module not in ['builtin', 'pyopenssl']: raise InvalidParameter if module == 'pyopenssl': append_python_libraries(['pyopenssl==20.0.1']) if redirect is not None: redirect = val_to_boolean(redirect) if redirect is None: raise InvalidParameter for f in [cert, key]: check_file(f) if chain: check_file(chain) cfg = f'config/{controller}/main' eva.registry.key_set_field(cfg, 'webapi/ssl-listen', listen) eva.registry.key_set_field(cfg, 'webapi/ssl-cert', cert) eva.registry.key_set_field(cfg, 'webapi/ssl-key', key) if http: eva.registry.key_set_field(cfg, 'webapi/listen', http) if module: eva.registry.key_set_field(cfg, 'webapi/ssl-module', module) if chain: eva.registry.key_set_field(cfg, 'webapi/ssl-chain', chain) if redirect is not None: eva.registry.key_set_field(cfg, 'webapi/ssl-force-redirect', redirect) restart_controller(controller)
def setup(host=None, domain=None, key_prefix='', ca=None, cache_time=None, cache_first=False): if not is_enabled('sfa'): raise FunctionFailed('SFA is not enabled') if not host: raise InvalidParameter if cache_time: try: cache_time = int(cache_time) except: raise InvalidParameter('cache_time is not a number') if OS_LIKE == 'debian': install_system_packages(['libsasl2-dev', 'libldap2-dev', 'libssl-dev']) elif OS_LIKE == 'fedora': install_system_packages(['openldap-devel', 'openssl-devel']) elif OS_LIKE == 'alpine': install_system_packages(['openldap-dev']) with open('/usr/lib/libldap_r.so', 'w') as fh: fh.write('INPUT ( libldap.so )') else: raise UnsupportedOS append_python_libraries(python_libs) config = {'host': host} if domain: config['domain'] = domain if key_prefix: config['key-prefix'] = key_prefix if ca: config['ca'] = ca if cache_time and cache_time > 0: config['cache-time'] = cache_time if val_to_boolean(cache_first): config['cache-first'] = True eva.registry.key_set_field('config/sfa/main', 'msad', config) restart_controller('sfa')
def setup(mods=False): mods = val_to_boolean(mods) append_python_libraries(python_libraries) if mods: download_phis(phis)