NethServer / dev

NethServer issue tracker
https://github.com/NethServer/dev/issues
62 stars 20 forks source link

Public network in VPN field does not work #6881

Closed stephdl closed 6 months ago

stephdl commented 7 months ago

Steps to reproduce

Expected behavior

I expect an error to prevent to use this network, it is not a local private network

Actual behavior

The installation seems to succeed but when you try to install the samba account provider you have a failure certainly because it is not a private network but a public network

Components

core 2.5.3

See also

https://community.nethserver.org/t/ns8-create-domain-stuck-frozen/23004


thank Giancarlos Reyes Peralta

DavidePrincipi commented 6 months ago

In core 2.5.4-dev.1

DavidePrincipi commented 6 months ago

The validator correctly checks if the VPN network value is a private network.

However the code does not handle a specific failure case: if I set "host bits" an unhandled error is returned. I'd expect the UI displays a specific error message, like "Not a network address: host bits must not be set".

Traceback (most recent call last):
  File "/var/lib/nethserver/cluster/actions/create-cluster/50update", line 46, in <module>
    ip_address = str(ipaddress.ip_network(network).network_address + NODE_ID)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/ipaddress.py", line 74, in ip_network
    return IPv4Network(address, strict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/ipaddress.py", line 1517, in __init__
    raise ValueError('%s has host bits set' % self)
ValueError: 10.5.4.2/16 has host bits set
DavidePrincipi commented 6 months ago

VERIFIED

DavidePrincipi commented 6 months ago

Released

https://github.com/NethServer/ns8-core/releases/tag/2.5.4