mirror of
https://github.com/Ysurac/openmptcprouter-vps-admin.git
synced 2025-02-14 19:41:52 +00:00
Use fd00 isntead of fe80 for 6in4, allow all users to set VPN IPs in config
This commit is contained in:
parent
0780292d15
commit
a30f1f3246
2 changed files with 15 additions and 8 deletions
7
debian/changelog
vendored
7
debian/changelog
vendored
|
@ -1,3 +1,10 @@
|
||||||
|
omr-vps-admin (0.9+20240222) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Use fd00 instead of fe80 for 6in4
|
||||||
|
* Allow all users to set VPN IPs in config
|
||||||
|
|
||||||
|
-- OpenMPTCProuter <contact@openmptcprouter.com> Thu, 22 Feb 2024 18:17:04 +0200
|
||||||
|
|
||||||
omr-vps-admin (0.8+20240213) unstable; urgency=medium
|
omr-vps-admin (0.8+20240213) unstable; urgency=medium
|
||||||
|
|
||||||
* Fix Shadowsocks-go add user and XRay/V2Ray remove user
|
* Fix Shadowsocks-go add user and XRay/V2Ray remove user
|
||||||
|
|
16
omr-admin.py
16
omr-admin.py
|
@ -1835,8 +1835,8 @@ async def config(userid: Optional[int] = Query(None), serial: Optional[str] = Qu
|
||||||
if 'ULA=' in line:
|
if 'ULA=' in line:
|
||||||
ula = line.replace(line[:4], '').rstrip()
|
ula = line.replace(line[:4], '').rstrip()
|
||||||
else:
|
else:
|
||||||
locaip6 = 'fe80::a00:1'
|
locaip6 = 'fd00::a00:1'
|
||||||
remoteip6 = 'fe80::a00:2'
|
remoteip6 = 'fd00::a00:2'
|
||||||
|
|
||||||
vpn = 'glorytun_tcp'
|
vpn = 'glorytun_tcp'
|
||||||
if 'vpn' in omr_config_data['users'][0][username]:
|
if 'vpn' in omr_config_data['users'][0][username]:
|
||||||
|
@ -2912,8 +2912,8 @@ class VPNips(BaseModel):
|
||||||
# Set user vpn IPs
|
# Set user vpn IPs
|
||||||
@app.post('/vpnips', summary="Set current user VPN IPs")
|
@app.post('/vpnips', summary="Set current user VPN IPs")
|
||||||
def vpnips(*, vpnconfig: VPNips, current_user: User = Depends(get_current_user)):
|
def vpnips(*, vpnconfig: VPNips, current_user: User = Depends(get_current_user)):
|
||||||
if current_user.permissions == "ro":
|
#if current_user.permissions == "ro":
|
||||||
return {'result': 'permission', 'reason': 'Read only user', 'route': 'vpnips'}
|
# return {'result': 'permission', 'reason': 'Read only user', 'route': 'vpnips'}
|
||||||
remoteip = vpnconfig.remoteip
|
remoteip = vpnconfig.remoteip
|
||||||
localip = vpnconfig.localip
|
localip = vpnconfig.localip
|
||||||
remoteip6 = vpnconfig.remoteip6
|
remoteip6 = vpnconfig.remoteip6
|
||||||
|
@ -2938,11 +2938,11 @@ def vpnips(*, vpnconfig: VPNips, current_user: User = Depends(get_current_user))
|
||||||
if localip6:
|
if localip6:
|
||||||
n.write('LOCALIP6=' + localip6 + "\n")
|
n.write('LOCALIP6=' + localip6 + "\n")
|
||||||
else:
|
else:
|
||||||
n.write('LOCALIP6=fe80::a0' + hex(userid)[2:] + ':1/126' + "\n")
|
n.write('LOCALIP6=fd00::a0' + hex(userid)[2:] + ':1/126' + "\n")
|
||||||
if remoteip6:
|
if remoteip6:
|
||||||
n.write('REMOTEIP6=' + remoteip6 + "\n")
|
n.write('REMOTEIP6=' + remoteip6 + "\n")
|
||||||
else:
|
else:
|
||||||
n.write('REMOTEIP6=fe80::a0' + hex(userid)[2:] + ':2/126' + "\n")
|
n.write('REMOTEIP6=fd00::a0' + hex(userid)[2:] + ':2/126' + "\n")
|
||||||
if ula:
|
if ula:
|
||||||
n.write('ULA=' + ula + "\n")
|
n.write('ULA=' + ula + "\n")
|
||||||
final_md5 = hashlib.md5(file_as_bytes(open('/etc/openmptcprouter-vps-admin/omr-6in4/user' + str(userid), 'rb'))).hexdigest()
|
final_md5 = hashlib.md5(file_as_bytes(open('/etc/openmptcprouter-vps-admin/omr-6in4/user' + str(userid), 'rb'))).hexdigest()
|
||||||
|
@ -2974,9 +2974,9 @@ def vpnips(*, vpnconfig: VPNips, current_user: User = Depends(get_current_user))
|
||||||
if not ('OMR_ADDR_USER' + str(userid) +'=' in line and not userid == 0) and not ('OMR_ADDR=' in line and userid == 0):
|
if not ('OMR_ADDR_USER' + str(userid) +'=' in line and not userid == 0) and not ('OMR_ADDR=' in line and userid == 0):
|
||||||
n.write(line)
|
n.write(line)
|
||||||
if not userid == 0:
|
if not userid == 0:
|
||||||
n.write('OMR_ADDR_USER' + str(userid) + '=fe80::a0' + hex(userid)[2:] + ':2/126' + '\n')
|
n.write('OMR_ADDR_USER' + str(userid) + '=fd00::a0' + hex(userid)[2:] + ':2/126' + '\n')
|
||||||
elif userid == 0:
|
elif userid == 0:
|
||||||
n.write('OMR_ADDR=fe80::a0' + hex(userid)[2:] + ':2/126' + '\n')
|
n.write('OMR_ADDR=fd00::a0' + hex(userid)[2:] + ':2/126' + '\n')
|
||||||
|
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
move(tmpfile, '/etc/shorewall6/params.vpn')
|
move(tmpfile, '/etc/shorewall6/params.vpn')
|
||||||
|
|
Loading…
Reference in a new issue