Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setupVars for pivpnNET, subnetClass and ALLOWED_IPS via unattended setup #1279

Merged

Conversation

DerDanilo
Copy link
Contributor

@DerDanilo DerDanilo commented Mar 15, 2021

Support setupVars for pivpnNET, subnetClass and ALLOWED_IPS via unattended setup.

  • OpenVPN --> pivpnNET and subnetClass
  • Wireguard --> pivpnNET, subnetClass and ALLOWED_IPS

Fix part of #1273

@DerDanilo
Copy link
Contributor Author

DerDanilo commented Mar 15, 2021

I am not completely sure that it's early enough to define subnetClass in the function installPiVPN() since I removed it from the top of the script to have it at the actual place were it can be defined. This makes the check easier if it was pre-defined without the need to add another var.

	# Allow custom subnetClass via unattend setupVARs file. Use default if not provided.
	if [ -z "$subnetClass" ]; then
		subnetClass="24"
	fi

Update: According to travis it seems fine.

@orazioedoardo
Copy link
Member

orazioedoardo commented Mar 15, 2021

Can't test the pull request(s) however I can tell that these lines are used to set the static IP settings when using unattended on Raspbian.

@DerDanilo
Copy link
Contributor Author

Can't text the pull request(s) however I can tell that these lines are used to set the static IP settings when using unattended on Raspbian.

What does "Can't text the..." mean?

Are those vars required when setting up wireguard VPN or not? I went through the code and checked all references. They only seem to be required in connection with OpenVPN. So not needed with Wireguard.

@orazioedoardo
Copy link
Member

What does "Can't text the..." mean?

Test, actually.

Are those vars required when setting up wireguard VPN or not? I went through the code and checked all references. They only seem to be required in connection with OpenVPN. So not needed with Wireguard.

Look at this function.

@DerDanilo
Copy link
Contributor Author

Thanks. I checked this function before and could not see why those values should be required by wireguard.

The genegrated setupVars.conf file does not contain them either. If I understand the reconfigure=false flag correctly the script should fail if those vars are required.

I can remove the commit regarding those vars. But I'd like to keep the example files correct if possible.

If I understand those vars correctly they allow to specify the local subnet, including mask and the default gw that the VPN server should use itself? DHCP is not required for Wireguard at all, that is why I am asking.

root@v:~# cat /etc/pivpn/wireguard/setupVars.conf
PLAT=Debian
OSCN=buster
USING_UFW=0
IPv4dev=eth0
install_user=wgadmin
install_home=/home/wgadmin
VPN=wireguard
pivpnPORT=1194
pivpnMTU=1280
pivpnDNS1=192.168.25.248
pivpnDNS2=192.168.25.249
pivpnHOST=v.mydomain.com
INPUT_CHAIN_EDITED=0
FORWARD_CHAIN_EDITED=1
pivpnPROTO=udp
pivpnDEV=wg0
pivpnNET=10.10.0.0
subnetClass=24
ALLOWED_IPS="10.10.0.0/24, 192.168.25.0/24"
UNATTUPG=1
INSTALLED_PACKAGES=(iptables-persistent qrencode qrencode iptables-persistent qrencode)

@orazioedoardo
Copy link
Member

The genegrated setupVars.conf file does not contain them either.

Because you tested the script on Debian, it does on Raspian.

If I understand those vars correctly they allow to specify the local subnet, including mask and the default gw that the VPN server should use itself?

Yes

Switch target branch to test please.

@DerDanilo DerDanilo changed the base branch from master to test March 16, 2021 12:39
@DerDanilo
Copy link
Contributor Author

Because you tested the script on Debian, it does on Raspian.

So if one should use those vars we can leave them in the example file. Maybe we should extend the documentation and explain what those vars are for.

Switch target branch to test please.

Done

@DerDanilo
Copy link
Contributor Author

How do we get this merged now? In my test installations it was working fine.

@coolapso
Copy link
Member

Please resolve the conflicts on your base branch please, seems to be related with the merge of one of your merge requests.

@DerDanilo
Copy link
Contributor Author

DerDanilo commented Mar 29, 2021

Please resolve the conflicts on your base branch please, seems to be related with the merge of one of your merge requests.

Apparently it was caused by the other merge request I pushed. Will check this soon and get it fixed.

@DerDanilo
Copy link
Contributor Author

Sorry for the delay. Was busy and then forgot about it. Hope it's fine now and can get merged soon.

@coolapso coolapso merged commit bf7c459 into pivpn:test Apr 21, 2021
@DerDanilo DerDanilo deleted the support_setupvars_for_wg_net_and_allowed_ips branch June 5, 2021 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants