fis USER_MANAGER section of config
This commit is contained in:
parent
7db02fcb4b
commit
c761e740bc
36
bridge.py
36
bridge.py
@ -156,7 +156,15 @@ def download_config(L_CONFIG_FILE, cli_file):
|
||||
iterate_config.update(resp['masters'].copy())
|
||||
corrected_config['SYSTEMS'].update(iterate_config)
|
||||
corrected_config['LOGGER'].update(L_CONFIG_FILE['LOGGER'])
|
||||
corrected_config['USER_MANAGER'].update(L_CONFIG_FILE['USER_MANAGER'])
|
||||
## corrected_config['USER_MANAGER'].update(resp['config']['USER_MANAGER'])
|
||||
## print(resp['config']['USER_MANAGER'])
|
||||
corrected_config['USER_MANAGER'] = {}
|
||||
corrected_config['USER_MANAGER']['THIS_SERVER_NAME'] = L_CONFIG_FILE['USER_MANAGER']['THIS_SERVER_NAME']
|
||||
corrected_config['USER_MANAGER']['URL'] = L_CONFIG_FILE['USER_MANAGER']['URL']
|
||||
corrected_config['USER_MANAGER']['SHARED_SECRET'] = L_CONFIG_FILE['USER_MANAGER']['SHARED_SECRET']
|
||||
corrected_config['USER_MANAGER']['REMOTE_CONFIG_ENABLED'] = L_CONFIG_FILE['USER_MANAGER']['REMOTE_CONFIG_ENABLED']
|
||||
corrected_config['USER_MANAGER'].update(resp['config']['USER_MANAGER'])
|
||||
|
||||
## iterate_config.update(resp['masters'].copy())
|
||||
## print(iterate_config)
|
||||
## print(iterate_config)
|
||||
@ -238,13 +246,7 @@ def download_config(L_CONFIG_FILE, cli_file):
|
||||
corrected_config['SYSTEMS'][i]['USE_ACL'] = iterate_config[i]['USE_ACL']
|
||||
corrected_config['SYSTEMS'][i]['SUB_ACL'] = config.acl_build(iterate_config[i]['SUB_ACL'], 16776415)
|
||||
|
||||
|
||||
## print(iterate_masters)
|
||||
## for i in iterate_masters:
|
||||
## iterate_masters['SYSTEMS']
|
||||
## config.process_acls(corrected_config)
|
||||
## print(corrected_config['SYSTEMS'])
|
||||
## print('-------')
|
||||
## print(corrected_config)
|
||||
return corrected_config
|
||||
# For exception, write blank dict
|
||||
except requests.ConnectionError:
|
||||
@ -825,6 +827,7 @@ class routerHBP(HBSYSTEM):
|
||||
|
||||
def __init__(self, _name, _config, _report):
|
||||
HBSYSTEM.__init__(self, _name, _config, _report)
|
||||
## print(_config)
|
||||
self.name = _name
|
||||
|
||||
# list of self._targets for unit (subscriber, private) calls
|
||||
@ -1352,27 +1355,13 @@ if __name__ == '__main__':
|
||||
|
||||
# Call the external routine to build the configuration dictionary
|
||||
LOCAL_CONFIG = config.build_config(cli_args.CONFIG_FILE)
|
||||
#print(LOCAL_CONFIG)
|
||||
#print(download_config(LOCAL_CONFIG))
|
||||
#if LOCAL_CONFIG['USER_MANAGER']['REMOTE_CONFIG_ENABLED']:
|
||||
#print(download_config(LOCAL_CONFIG)['config'])
|
||||
## CONFIG = config.build_config(download_config(LOCAL_CONFIG))
|
||||
#CONFIG = download_config(LOCAL_CONFIG)
|
||||
#if not LOCAL_CONFIG['USER_MANAGER']['REMOTE_CONFIG_ENABLED']:
|
||||
## print(download_config(LOCAL_CONFIG)['config'])
|
||||
## CONFIG = config.build_config(cli_args.CONFIG_FILE)
|
||||
#print((CONFIG))
|
||||
|
||||
|
||||
## config.process_acls(LOCAL_CONFIG)
|
||||
if LOCAL_CONFIG['USER_MANAGER']['REMOTE_CONFIG_ENABLED']:
|
||||
CONFIG = download_config(LOCAL_CONFIG, cli_args.CONFIG_FILE)
|
||||
print('enabled')
|
||||
else:
|
||||
CONFIG = config.build_config(cli_args.CONFIG_FILE)
|
||||
|
||||
|
||||
## print(CONFIG)
|
||||
|
||||
# Ensure we have a path for the rules file, if one wasn't specified, then use the default (top of file)
|
||||
if not cli_args.RULES_FILE:
|
||||
cli_args.RULES_FILE = os.path.dirname(os.path.abspath(__file__))+'/rules.py'
|
||||
@ -1487,7 +1476,6 @@ if __name__ == '__main__':
|
||||
# Get rule parameter for private calls
|
||||
UNIT = rules_module.UNIT
|
||||
|
||||
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
|
||||
|
@ -339,7 +339,7 @@ class HBSYSTEM(DatagramProtocol):
|
||||
if self._CONFIG['USER_MANAGER']['SHORTEN_PASSPHRASE'] == False:
|
||||
pass
|
||||
_calc_hash = bhex(sha256(_salt_str+calc_passphrase).hexdigest())
|
||||
## print(calc_passphrase)
|
||||
print(calc_passphrase)
|
||||
# print(_calc_hash)
|
||||
return _calc_hash
|
||||
|
||||
|
@ -571,7 +571,7 @@ def create_app():
|
||||
@login_required
|
||||
def gen():
|
||||
#print(str(gen_passphrase(3153591))) #(int(i[0])))
|
||||
## try:
|
||||
try:
|
||||
#content = Markup('<strong>The HTML String</strong>')
|
||||
#user_id = request.args.get('user_id')
|
||||
u = current_user
|
||||
@ -658,8 +658,8 @@ def create_app():
|
||||
<p> </p>
|
||||
'''
|
||||
#content = content + '\n\n' + str(script_links[i[0]])
|
||||
## except:
|
||||
## content = Markup('<strong>No DMR IDs found or other error.</strong>')
|
||||
except:
|
||||
content = Markup('<strong>No DMR IDs found or other error.</strong>')
|
||||
|
||||
|
||||
#return str(content)
|
||||
@ -1987,6 +1987,12 @@ def create_app():
|
||||
'STALE_TIME': i.ai_stale * 86400,
|
||||
})
|
||||
s_config['USER_MANAGER'].update({
|
||||
'SHORTEN_LENGTH': shorten_length,
|
||||
'SHORTEN_SAMPLE': shorten_sample,
|
||||
'EXTRA_1': extra_1,
|
||||
'EXTRA_2': extra_2,
|
||||
'EXTRA_INT_1': extra_int_1,
|
||||
'EXTRA_INT_2': extra_int_2,
|
||||
'APPEND_INT': append_int,
|
||||
'SHORTEN_PASSPHRASE': i.um_shorten_passphrase,
|
||||
'BURN_FILE': i.um_burn_file,
|
||||
@ -4792,8 +4798,12 @@ def create_app():
|
||||
mode='override',
|
||||
value=authorized_peer(hblink_req['login_id'])[1]
|
||||
)
|
||||
try:
|
||||
active_tgs[hblink_req['login_server']][hblink_req['system']] = [{'1':[]}, {'2':[]}, {'SYSTEM': ''}, {'peer_id':hblink_req['login_id']}]
|
||||
print(active_tgs)
|
||||
## print('Restart ' + hblink_req['login_server'] + ' please.')
|
||||
except:
|
||||
active_tgs[hblink_req['login_server']] = {}
|
||||
pass
|
||||
elif authorized_peer(hblink_req['login_id'])[0] == False:
|
||||
## print('log fail')
|
||||
authlog_add(hblink_req['login_id'], hblink_req['login_ip'], hblink_req['login_server'], 'Not Registered', '-', 'Failed')
|
||||
|
Loading…
Reference in New Issue
Block a user