Skip to content

Conversation

@divinehawk
Copy link

This pull requests adds in the four configurable options for Zerotier networks: allowManaged, allowGlobal, allowDefault, allowDNS.

Zerotier defaults are used for these options.

Referenced in: #4011

@divinehawk divinehawk force-pushed the master branch 2 times, most recently from 47791ad to de9a56c Compare June 6, 2025 18:49
@divinehawk
Copy link
Author

Amended pull request to include writing local.conf files. This is needed to preserve configuration when enabling/disabling (joining/leaving) a network.

@divinehawk
Copy link
Author

Please review when possible.

@dharrigan
Copy link
Member

Hi

Thank you kindly for your PR - however, I'm no longer actively maintaining the plugin (haven't for many years). In essence, it's sorta in an "orphaned state".

Perhaps someone at Opnsense can pick it up for reviewing this PR :-)

Hope that helps.

-=david=-

fichtner added a commit that referenced this pull request Dec 1, 2025
@fichtner
Copy link
Member

fichtner commented Dec 1, 2025

Hello @dharrigan Sir I hope you are good! I've added 5032208 to address your wish. :)

@divinehawk Although it's unmaintained we do accept PR's if you want to work on it. At the moment there is no plan to remove the plugin.

@fichtner fichtner self-assigned this Dec 1, 2025
$this->setZerotierNetwork($network->networkId, 'allowManaged', $network->allowManaged);
$this->setZerotierNetwork($network->networkId, 'allowGlobal', $network->allowGlobal);
$this->setZerotierNetwork($network->networkId, 'allowDefault', $network->allowDefault);
$this->setZerotierNetwork($network->networkId, 'allowDNS', $network->allowDNS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks rather odd, but the controller is also quite old

what is your goal here to directly apply this after config save?

$backend->configdRun("template reload OPNsense/zerotier");
$action = $enabled ? 'join' : 'leave';
return trim((new Backend())->configdRun("zerotier $action $networkId"));
return trim($backend->configdRun("zerotier $action $networkId"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this already was an unsafe call, check out configdpRun()


private function setZerotierNetwork($networkId, $setting, $value)
{
return trim((new Backend())->configdRun("zerotier set $networkId $setting $value"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also unsafe, check configdpRun()

<default></default>
<Required>N</Required>
</description>
<allowManaged type="BooleanField">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you add new required values with defaults the model version at the beginning of this file needs to be increased

@@ -1,2 +1,3 @@
zerotier:/etc/rc.conf.d/zerotier
local.conf:/var/db/zerotier-one/local.conf
networks-local.conf:/var/db/zerotier-one/networks.d/[OPNsense.zerotier.networks.network.%.networkId].local.conf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note these files generated with dynamic names can not be deleted...

@dharrigan
Copy link
Member

Hi @fichtner Thank you for picking this up. I wish I had more time for OPNSense - but at the moment, I'm working on other things. Perhaps 'tho in the future I can help out again :-)

Thanks again! :-)

-=david=-

fichtner added a commit that referenced this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants