fix incorrect value for user manager, improve EOBP
This commit is contained in:
		
							parent
							
								
									97bb174bf6
								
							
						
					
					
						commit
						bad9ad53ae
					
				@ -145,7 +145,7 @@ def download_rules(L_CONFIG_FILE, cli_file):
 | 
				
			|||||||
    try:
 | 
					    try:
 | 
				
			||||||
        req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
 | 
					        req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
 | 
				
			||||||
        resp = json.loads(req.text)
 | 
					        resp = json.loads(req.text)
 | 
				
			||||||
        print(resp)
 | 
					##        print(resp)
 | 
				
			||||||
        return resp['rules']
 | 
					        return resp['rules']
 | 
				
			||||||
    except requests.ConnectionError:
 | 
					    except requests.ConnectionError:
 | 
				
			||||||
        logger.error('Config server unreachable, defaulting to local config')
 | 
					        logger.error('Config server unreachable, defaulting to local config')
 | 
				
			||||||
@ -189,6 +189,7 @@ def download_config(L_CONFIG_FILE, cli_file):
 | 
				
			|||||||
##            corrected_config['SYSTEMS'][i] = {}
 | 
					##            corrected_config['SYSTEMS'][i] = {}
 | 
				
			||||||
##            print(iterate_config[i])
 | 
					##            print(iterate_config[i])
 | 
				
			||||||
            if iterate_config[i]['MODE'] == 'MASTER' or iterate_config[i]['MODE'] == 'PROXY' or iterate_config[i]['MODE'] == 'OPENBRIDGE':
 | 
					            if iterate_config[i]['MODE'] == 'MASTER' or iterate_config[i]['MODE'] == 'PROXY' or iterate_config[i]['MODE'] == 'OPENBRIDGE':
 | 
				
			||||||
 | 
					##                print(iterate_config[i])
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['TG1_ACL'] = config.acl_build(iterate_config[i]['TG1_ACL'], 4294967295)
 | 
					                corrected_config['SYSTEMS'][i]['TG1_ACL'] = config.acl_build(iterate_config[i]['TG1_ACL'], 4294967295)
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['TG2_ACL'] = config.acl_build(iterate_config[i]['TG2_ACL'], 4294967295)
 | 
					                corrected_config['SYSTEMS'][i]['TG2_ACL'] = config.acl_build(iterate_config[i]['TG2_ACL'], 4294967295)
 | 
				
			||||||
                corrected_config['SYSTEMS'][i]['PASSPHRASE'] = bytes(iterate_config[i]['PASSPHRASE'], 'utf-8')
 | 
					                corrected_config['SYSTEMS'][i]['PASSPHRASE'] = bytes(iterate_config[i]['PASSPHRASE'], 'utf-8')
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								hblink.py
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								hblink.py
									
									
									
									
									
								
							@ -159,14 +159,16 @@ class OPENBRIDGE(DatagramProtocol):
 | 
				
			|||||||
        logger.info('(%s) is mode OPENBRIDGE. No De-Registration required, continuing shutdown', self._system)
 | 
					        logger.info('(%s) is mode OPENBRIDGE. No De-Registration required, continuing shutdown', self._system)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def send_system(self, _packet):
 | 
					    def send_system(self, _packet):
 | 
				
			||||||
        if _packet[:4] == DMRD:
 | 
					        if _packet[:4] == DMRD or _packet[:4] == EOBP:
 | 
				
			||||||
            #_packet = _packet[:11] + self._config['NETWORK_ID'] + _packet[15:]
 | 
					            #_packet = _packet[:11] + self._config['NETWORK_ID'] + _packet[15:]
 | 
				
			||||||
            _packet = b''.join([_packet[:11], self._config['NETWORK_ID'], _packet[15:]])
 | 
					            _packet = b''.join([_packet[:11], self._config['NETWORK_ID'], _packet[15:]])
 | 
				
			||||||
            #_packet += hmac_new(self._config['PASSPHRASE'],_packet,sha1).digest()
 | 
					            #_packet += hmac_new(self._config['PASSPHRASE'],_packet,sha1).digest()
 | 
				
			||||||
            _packet = b''.join([_packet, (hmac_new(self._config['PASSPHRASE'],_packet,sha1).digest())])
 | 
					            _packet = b''.join([_packet, (hmac_new(self._config['PASSPHRASE'],_packet,sha1).digest())])
 | 
				
			||||||
            if self._config['USE_ENCRYPTION'] == True:
 | 
					            if self._config['USE_ENCRYPTION'] == True or _packet[:4] == EOBP:
 | 
				
			||||||
                _enc_pkt = encrypt_packet(self._config['ENCRYPTION_KEY'], _packet)
 | 
					                _enc_pkt = encrypt_packet(self._config['ENCRYPTION_KEY'], _packet)
 | 
				
			||||||
                _packet = b'EOBP' + _enc_pkt
 | 
					                _packet = b'EOBP' + _enc_pkt
 | 
				
			||||||
 | 
					                print('Encrypting')
 | 
				
			||||||
 | 
					                print(_packet)
 | 
				
			||||||
            self.transport.write(_packet, (self._config['TARGET_IP'], self._config['TARGET_PORT']))
 | 
					            self.transport.write(_packet, (self._config['TARGET_IP'], self._config['TARGET_PORT']))
 | 
				
			||||||
            # KEEP THE FOLLOWING COMMENTED OUT UNLESS YOU'RE DEBUGGING DEEPLY!!!!
 | 
					            # KEEP THE FOLLOWING COMMENTED OUT UNLESS YOU'RE DEBUGGING DEEPLY!!!!
 | 
				
			||||||
            # logger.debug('(%s) TX Packet to OpenBridge %s:%s -- %s', self._system, self._config['TARGET_IP'], self._config['TARGET_PORT'], ahex(_packet))
 | 
					            # logger.debug('(%s) TX Packet to OpenBridge %s:%s -- %s', self._system, self._config['TARGET_IP'], self._config['TARGET_PORT'], ahex(_packet))
 | 
				
			||||||
@ -188,8 +190,11 @@ class OPENBRIDGE(DatagramProtocol):
 | 
				
			|||||||
##        logger.debug('(%s) RX packet from %s -- %s', self._system, _sockaddr, ahex(_packet))
 | 
					##        logger.debug('(%s) RX packet from %s -- %s', self._system, _sockaddr, ahex(_packet))
 | 
				
			||||||
        if _packet[:4] == DMRD or _packet[:4] == EOBP:
 | 
					        if _packet[:4] == DMRD or _packet[:4] == EOBP:
 | 
				
			||||||
            if _packet[:4] == EOBP:
 | 
					            if _packet[:4] == EOBP:
 | 
				
			||||||
 | 
					                print('dec')
 | 
				
			||||||
 | 
					                print(_packet)
 | 
				
			||||||
                _d_pkt = decrypt_packet(self._config['ENCRYPTION_KEY'], _packet[4:])
 | 
					                _d_pkt = decrypt_packet(self._config['ENCRYPTION_KEY'], _packet[4:])
 | 
				
			||||||
                _packet = _d_pkt
 | 
					                _packet = _d_pkt
 | 
				
			||||||
 | 
					                print(_packet)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # DMRData -- encapsulated DMR data frame
 | 
					            # DMRData -- encapsulated DMR data frame
 | 
				
			||||||
            if _packet[:4] == DMRD:
 | 
					            if _packet[:4] == DMRD:
 | 
				
			||||||
@ -252,7 +257,7 @@ class OPENBRIDGE(DatagramProtocol):
 | 
				
			|||||||
        # Server Data packet, decrypt and process it.
 | 
					        # Server Data packet, decrypt and process it.
 | 
				
			||||||
        elif _packet[:4] == SVRD:
 | 
					        elif _packet[:4] == SVRD:
 | 
				
			||||||
            _d_pkt = decrypt_packet(self._config['ENCRYPTION_KEY'], _packet[4:])
 | 
					            _d_pkt = decrypt_packet(self._config['ENCRYPTION_KEY'], _packet[4:])
 | 
				
			||||||
            print('svr pakcet')
 | 
					            print('SVRD')
 | 
				
			||||||
            print(_d_pkt)
 | 
					            print(_d_pkt)
 | 
				
			||||||
#************************************************
 | 
					#************************************************
 | 
				
			||||||
#     HB MASTER CLASS
 | 
					#     HB MASTER CLASS
 | 
				
			||||||
@ -309,7 +314,7 @@ class HBSYSTEM(DatagramProtocol):
 | 
				
			|||||||
            return resp
 | 
					            return resp
 | 
				
			||||||
        except requests.ConnectionError:
 | 
					        except requests.ConnectionError:
 | 
				
			||||||
            return {'allow':True}
 | 
					            return {'allow':True}
 | 
				
			||||||
 | 
					# Sends login confirmation for log
 | 
				
			||||||
    def send_login_conf(self, _id, server_name, peer_ip, old_auth):
 | 
					    def send_login_conf(self, _id, server_name, peer_ip, old_auth):
 | 
				
			||||||
        #Change this to a config value
 | 
					        #Change this to a config value
 | 
				
			||||||
        user_man_url = self._CONFIG['USER_MANAGER']['URL']
 | 
					        user_man_url = self._CONFIG['USER_MANAGER']['URL']
 | 
				
			||||||
@ -331,7 +336,7 @@ class HBSYSTEM(DatagramProtocol):
 | 
				
			|||||||
        #return resp
 | 
					        #return resp
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            logger.info(e)
 | 
					            logger.info(e)
 | 
				
			||||||
            
 | 
					# Sends PEER info for map and other stuff            
 | 
				
			||||||
    def send_peer_loc(self, _id, call, lat, lon, url, description, loc, soft):
 | 
					    def send_peer_loc(self, _id, call, lat, lon, url, description, loc, soft):
 | 
				
			||||||
        #Change this to a config value
 | 
					        #Change this to a config value
 | 
				
			||||||
        user_man_url = self._CONFIG['USER_MANAGER']['URL']
 | 
					        user_man_url = self._CONFIG['USER_MANAGER']['URL']
 | 
				
			||||||
@ -592,7 +597,7 @@ 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['REG_ACL'])
 | 
				
			||||||
##                    print(self._CONFIG['USER_MANAGER']['REMOTE_CONFIG_ENABLED'])
 | 
					##                    print(self._CONFIG['USER_MANAGER']['REMOTE_CONFIG_ENABLED'])
 | 
				
			||||||
                    b_acl = self._config['REG_ACL']
 | 
					                    b_acl = self._config['REG_ACL']
 | 
				
			||||||
 | 
				
			|||||||
@ -5139,7 +5139,7 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
 | 
				
			|||||||
<tr>
 | 
					<tr>
 | 
				
			||||||
<td><strong> User Manager for login:</strong></td>
 | 
					<td><strong> User Manager for login:</strong></td>
 | 
				
			||||||
<td> <select name="enable_um">
 | 
					<td> <select name="enable_um">
 | 
				
			||||||
<option selected="selected" value="''' + str(m.enable_um) + '''">Current - ''' + str(m.static_positions) + '''</option>
 | 
					<option selected="selected" value="''' + str(m.enable_um) + '''">Current - ''' + str(m.enable_um) + '''</option>
 | 
				
			||||||
<option value="True">True</option>
 | 
					<option value="True">True</option>
 | 
				
			||||||
<option value="False">False</option>
 | 
					<option value="False">False</option>
 | 
				
			||||||
</select></td>
 | 
					</select></td>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user