fix ACL bug, fix server listing
This commit is contained in:
parent
69b8570ee2
commit
f5f1f9b91f
@ -68,7 +68,6 @@ def acl_build(_acl, _max):
|
|||||||
return(True, set((const.ID_MIN, _max)))
|
return(True, set((const.ID_MIN, _max)))
|
||||||
|
|
||||||
acl = [] #set()
|
acl = [] #set()
|
||||||
print(type(_acl))
|
|
||||||
if type(_acl) == tuple:
|
if type(_acl) == tuple:
|
||||||
_acl = ''.join(_acl)
|
_acl = ''.join(_acl)
|
||||||
sections = _acl.split(':')
|
sections = _acl.split(':')
|
||||||
@ -319,6 +318,7 @@ def build_config(_config_file):
|
|||||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||||
'EXTERNAL_PROXY_SCRIPT': config.getboolean(section, 'EXTERNAL_PROXY_SCRIPT'),
|
'EXTERNAL_PROXY_SCRIPT': config.getboolean(section, 'EXTERNAL_PROXY_SCRIPT'),
|
||||||
'STATIC_APRS_POSITION_ENABLED': config.getboolean(section, 'STATIC_APRS_POSITION_ENABLED'),
|
'STATIC_APRS_POSITION_ENABLED': config.getboolean(section, 'STATIC_APRS_POSITION_ENABLED'),
|
||||||
|
'USE_USER_MAN': config.getboolean(section, 'USE_USER_MAN'),
|
||||||
'REPEAT': config.getboolean(section, 'REPEAT'),
|
'REPEAT': config.getboolean(section, 'REPEAT'),
|
||||||
'PASSPHRASE': bytes(config.get(section, 'PASSPHRASE'), 'utf-8'),
|
'PASSPHRASE': bytes(config.get(section, 'PASSPHRASE'), 'utf-8'),
|
||||||
'EXTERNAL_PORT': config.getint(section, 'EXTERNAL_PORT'),
|
'EXTERNAL_PORT': config.getint(section, 'EXTERNAL_PORT'),
|
||||||
|
@ -68,6 +68,8 @@ def acl_build(_acl, _max):
|
|||||||
return(True, set((const.ID_MIN, _max)))
|
return(True, set((const.ID_MIN, _max)))
|
||||||
|
|
||||||
acl = [] #set()
|
acl = [] #set()
|
||||||
|
if type(_acl) == tuple:
|
||||||
|
_acl = ''.join(_acl)
|
||||||
sections = _acl.split(':')
|
sections = _acl.split(':')
|
||||||
|
|
||||||
if sections[0] == 'PERMIT':
|
if sections[0] == 'PERMIT':
|
||||||
|
22
hblink.py
22
hblink.py
@ -621,6 +621,9 @@ class HBSYSTEM(DatagramProtocol):
|
|||||||
|
|
||||||
elif _command == RPTL: # RPTLogin -- a repeater wants to login
|
elif _command == RPTL: # RPTLogin -- a repeater wants to login
|
||||||
_peer_id = _data[4:8]
|
_peer_id = _data[4:8]
|
||||||
|
print()
|
||||||
|
print((self._config['REG_ACL']))
|
||||||
|
print()
|
||||||
# Check to see if we've reached the maximum number of allowed peers
|
# Check to see if we've reached the maximum number of allowed peers
|
||||||
if len(self._peers) < self._config['MAX_PEERS']:
|
if len(self._peers) < self._config['MAX_PEERS']:
|
||||||
# Check for valid Radio ID
|
# Check for valid Radio ID
|
||||||
@ -635,15 +638,20 @@ class HBSYSTEM(DatagramProtocol):
|
|||||||
else:
|
else:
|
||||||
user_auth = False
|
user_auth = False
|
||||||
elif self._config['USE_USER_MAN'] == False:
|
elif self._config['USE_USER_MAN'] == False:
|
||||||
## print('False')
|
print('False')
|
||||||
#### print(self._config['REG_ACL'])
|
|
||||||
## print(self._CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'])
|
|
||||||
b_acl = self._config['REG_ACL']
|
b_acl = self._config['REG_ACL']
|
||||||
if self._CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True:
|
if self._CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True:
|
||||||
b_acl = acl_build(self._config['REG_ACL'], 4294967295)
|
# If UMS is False, and Rmote Confir True
|
||||||
print(b_acl)
|
if acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and acl_check(_peer_id, self._config['REG_ACL']):
|
||||||
if acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and acl_check(_peer_id, b_acl):#acl_check(_peer_id, b_acl):
|
user_auth = True
|
||||||
user_auth = True
|
print(self._CONFIG['GLOBAL']['REG_ACL'])
|
||||||
|
else:
|
||||||
|
user_auth = False
|
||||||
|
#If UMS and Remot Config False
|
||||||
|
elif self._CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == False:
|
||||||
|
user_auth = False
|
||||||
|
if acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and acl_check(_peer_id, b_acl):#acl_check(_peer_id, b_acl):
|
||||||
|
user_auth = True
|
||||||
if user_auth == True:
|
if user_auth == True:
|
||||||
# Build the configuration data strcuture for the peer
|
# Build the configuration data strcuture for the peer
|
||||||
self._peers.update({_peer_id: {
|
self._peers.update({_peer_id: {
|
||||||
|
51
web/app.py
51
web/app.py
@ -919,29 +919,32 @@ def hbnet_web_service():
|
|||||||
script_links = ast.literal_eval(script_l.field_2)
|
script_links = ast.literal_eval(script_l.field_2)
|
||||||
svr_content = ''
|
svr_content = ''
|
||||||
for i in sl:
|
for i in sl:
|
||||||
try:
|
if i.ip == '':
|
||||||
if time.time() - ping_list[i.name] < 20:
|
break
|
||||||
svr_status = '''<div class="alert alert-success">
|
elif i.ip != '':
|
||||||
<strong>Online</strong>
|
try:
|
||||||
</div> '''
|
if time.time() - ping_list[i.name] < 20:
|
||||||
elif time.time() - ping_list[i.name] <= 300:
|
svr_status = '''<div class="alert alert-success">
|
||||||
|
<strong>Online</strong>
|
||||||
|
</div> '''
|
||||||
|
elif time.time() - ping_list[i.name] <= 300:
|
||||||
|
svr_status = '''<div class="alert alert-warning">
|
||||||
|
<strong>Unknown <br /> (No pings, less than 5 min.)</strong>
|
||||||
|
</div> '''
|
||||||
|
elif time.time() - ping_list[i.name] > 300:
|
||||||
|
svr_status = '''<div class="alert alert-danger">
|
||||||
|
<strong>Offline</strong>
|
||||||
|
</div> '''
|
||||||
|
else:
|
||||||
|
svr_status = '''<div class="alert alert-warning">
|
||||||
|
<strong>Unknown Condition</strong>
|
||||||
|
</div> '''
|
||||||
|
print(ping_list)
|
||||||
|
print(time.time())
|
||||||
|
except:
|
||||||
svr_status = '''<div class="alert alert-warning">
|
svr_status = '''<div class="alert alert-warning">
|
||||||
<strong>Unknown <br /> (No pings, less than 5 min.)</strong>
|
<strong>Unknown</strong>
|
||||||
</div> '''
|
</div> '''
|
||||||
elif time.time() - ping_list[i.name] > 300:
|
|
||||||
svr_status = '''<div class="alert alert-danger">
|
|
||||||
<strong>Offline</strong>
|
|
||||||
</div> '''
|
|
||||||
else:
|
|
||||||
svr_status = '''<div class="alert alert-warning">
|
|
||||||
<strong>Unknown Condition</strong>
|
|
||||||
</div> '''
|
|
||||||
print(ping_list)
|
|
||||||
print(time.time())
|
|
||||||
except:
|
|
||||||
svr_status = '''<div class="alert alert-warning">
|
|
||||||
<strong>Unknown</strong>
|
|
||||||
</div> '''
|
|
||||||
|
|
||||||
svr_content = svr_content + '''
|
svr_content = svr_content + '''
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@ -3731,7 +3734,7 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
|
|||||||
<td style="width: 78.7895%;"> <input name="dash_url" type="text" value="''' + str(s.dash_url) + '''"/></td>
|
<td style="width: 78.7895%;"> <input name="dash_url" type="text" value="''' + str(s.dash_url) + '''"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 16.0381%;"><strong> Host (IP/DNS, for listing on passphrase page):</strong></td>
|
<td style="width: 16.0381%;"><strong> Host (IP/DNS, for listing on passphrase page, blank to not list):</strong></td>
|
||||||
<td style="width: 78.7895%;"> <input name="server_ip" type="text" value="''' + str(s.ip) + '''"/></td>
|
<td style="width: 78.7895%;"> <input name="server_ip" type="text" value="''' + str(s.ip) + '''"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -3938,7 +3941,7 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
|
|||||||
<td style="width: 70%;"> <input name="dash_url" type="text" /></td>
|
<td style="width: 70%;"> <input name="dash_url" type="text" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 16.0381%;"><strong> Host (IP/DNS):</strong></td>
|
<td style="width: 16.0381%;"><strong> Host (IP/DNS, blank to not list):</strong></td>
|
||||||
<td style="width: 78.7895%;"> <input name="server_ip" type="text" /></td>
|
<td style="width: 78.7895%;"> <input name="server_ip" type="text" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user