bsdpot / pot

pot: another container framework for FreeBSD, based on jails, ZFS and pf
BSD 3-Clause "New" or "Revised" License
333 stars 31 forks source link

[BUG] Hardcoded default `POT_DNS_IP` causes error when changing `POT_NETWORK` #264

Open zilti opened 1 year ago

zilti commented 1 year ago

Describe the bug There seems to be a hardcoded default POT_DNS_IP which is 10.192.0.2. This breaks when the custom network range does not cover it.

To Reproduce Steps to reproduce the behavior:

  1. Set POT_NETWORK to 172.16.0.0/12 and POT_NETMASK to 255.240.0.0
  2. Run pot init
  3. See error [ERROR] DNS IP (10.192.0.2) outside the network range (172.16.0.0/12)

Expected behavior There is no default value for POT_DNS_IP and thus nothing breaks.

System configuration - if possible

POT_ZFS_ROOT=zroot/pot
POT_FS_ROOT=/opt/pot
POT_CACHE=/var/cache/pot
POT_TMP=/tmp
POT_MKTEMP_SUFFIX=.XXXXXXXX
POT_HOSTNAME_MAX_LENGTH=64
POT_NETWORK=172.16.0.0/12
POT_NETMASK=255.240.0.0
POT_GATEWAY=172.16.0.1

POT_EXTIF=vtnet0
POT_EXTRA_EXTIF=vtnet1
POT_NETWORK_vtnet1=10.0.0.0/8
#POT_DNS_NAME=
#POT_DNS_IP=
#POT_VPN_EXTIF=
#POT_VPN_NETWORKS=
grembo commented 1 year ago

@zilti This error messages comes from bsdpot/potnet:

# potnet config-check
16:59:50 [ERROR] DNS IP (10.192.0.2) outside the network range (172.16.0.0/12)

The actual configuration is in /usr/local/etc/pot/pot.default.conf

The default is reflected in the commented out line in pot.conf:

https://github.com/bsdpot/pot/blob/master/etc/pot/pot.conf.sample#L52

And can be changed there to fit the network:

[root@jailhost-b /usr/local/share/pot]# echo POT_DNS_IP=172.16.0.100 >>/usr/local/etc/pot/pot.conf
[root@jailhost-b /usr/local/share/pot]# potnet config-check
[root@jailhost-b /usr/local/share/pot]# 

So I think everything behaves like expected, doesn't it?

zilti commented 1 year ago

My expectation would be that there'd be no default for that variable at all, because if I understand the docs correctly, that approach (using a DNS pot) is deprecated anyway.

grembo commented 9 months ago

@zilti As you can see above, I opened a pull request to potnet that should make DNS IP optional without breaking backwards compatibility.