├── Makefile ├── README.md ├── files ├── pkg-deinstall.in ├── pkg-install.in └── usr │ └── local │ ├── pkg │ ├── zerotier.inc │ └── zerotier.xml │ ├── share │ └── pfSense-pkg-zerotier │ │ └── info.xml │ └── www │ ├── zerotier.php │ ├── zerotier_controller.php │ ├── zerotier_controller_network.php │ ├── zerotier_networks.php │ └── zerotier_peers.php ├── pkg-descr ├── pkg-plist └── zerotier /Makefile: -------------------------------------------------------------------------------- 1 | # $FreeBSD$ 2 | 3 | PORTNAME= pfSense-pkg-zerotier 4 | PORTVERSION= 0.00.1 5 | CATEGORIES= net 6 | MASTER_SITES= # empty 7 | DISTFILES= # empty 8 | EXTRACT_ONLY= # empty 9 | 10 | MAINTAINER= grmoore18@gmail.com 11 | COMMENT= pfSense package zerotier 12 | 13 | LICENSE= APACHE20 14 | 15 | RUN_DEPENDS= ${LOCALBASE}/sbin/zerotier-one:net/zerotier 16 | 17 | NO_BUILD= yes 18 | NO_MTREE= yes 19 | 20 | SUB_FILES= pkg-install pkg-deinstall 21 | SUB_LIST= PORTNAME=${PORTNAME} 22 | 23 | do-extract: 24 | ${MKDIR} ${WRKSRC} 25 | 26 | do-install: 27 | ${MKDIR} ${STAGEDIR}${PREFIX}/pkg 28 | ${MKDIR} ${STAGEDIR}${PREFIX}/www 29 | ${MKDIR} ${STAGEDIR}${DATADIR} 30 | ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/zerotier.xml \ 31 | ${STAGEDIR}${PREFIX}/pkg 32 | ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/zerotier.inc \ 33 | ${STAGEDIR}${PREFIX}/pkg 34 | ${INSTALL_DATA} ${FILESDIR}${DATADIR}/info.xml \ 35 | ${STAGEDIR}${DATADIR} 36 | ${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/zerotier.php \ 37 | ${STAGEDIR}${PREFIX}/www 38 | ${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/zerotier_networks.php \ 39 | ${STAGEDIR}${PREFIX}/www 40 | ${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/zerotier_peers.php \ 41 | ${STAGEDIR}${PREFIX}/www 42 | ${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/zerotier_controller.php \ 43 | ${STAGEDIR}${PREFIX}/www 44 | ${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/zerotier_controller_network.php \ 45 | ${STAGEDIR}${PREFIX}/www 46 | @${REINPLACE_CMD} -i '' -e "s|%%PKGVERSION%%|${PKGVERSION}|" \ 47 | ${STAGEDIR}${DATADIR}/info.xml 48 | 49 | .include 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pfSense-pkg-zerotier 2 | pfSense package to support zerotier. 3 | 4 | ## Pre-reqs 5 | 1. FreeBSD 12.2 Workstation with pkg, git, and gmake 6 | 7 | ## Build 8 | 1. `git clone https://github.com/pfsense/FreeBSD-ports.git` 9 | 2. add `ALLOW_UNSUPPORTED_SYSTEM=YES` to /etc/make.conf 10 | 3. Copy these files to FreeBSD-ports/net/pfSense-pkg-zerotier 11 | 4. Run `make clean ; make package` 12 | 5. scp work/pkg/pfSense-pkg-zerotier-0.00.1.txz to pfsense 13 | 14 | ## Install 15 | 1. Run `pkg add http://pkg.freebsd.org/freebsd:12:x86:64/latest/All/zerotier-1.8.6.txz` 16 | 2. Run `pkg add pfsense-pkg-zerotier-0.00.1.txz` 17 | 18 | ## ToDo 19 | - [ ] Re-write controller functionality to match API changes 20 | - [ ] Interface creation 21 | -------------------------------------------------------------------------------- /files/pkg-deinstall.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/local/bin/php -f /etc/rc.packages %%PORTNAME%% ${2} 4 | -------------------------------------------------------------------------------- /files/pkg-install.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "${2}" != "POST-INSTALL" ]; then 4 | exit 0 5 | fi 6 | 7 | /usr/local/bin/php -f /etc/rc.packages %%PORTNAME%% ${2} 8 | -------------------------------------------------------------------------------- /files/usr/local/pkg/zerotier.inc: -------------------------------------------------------------------------------- 1 | address; 195 | $network_id = $controller_id.$networkID; 196 | $post_data = json_encode($network); 197 | $curl = curl_init("http://localhost:9993/controller/network/".$network_id); 198 | curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); 199 | curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); 200 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 201 | curl_setopt($curl, CURLOPT_HTTPHEADER, array( 202 | 'Content-Type: application/json', 203 | 'Content-Length: ' . strlen($post_data), 204 | 'X-ZT1-Auth: ' . $auth_secret 205 | ) 206 | ); 207 | 208 | $curl_out = curl_exec($curl); 209 | curl_close($curl); 210 | $output = json_decode($curl_out); 211 | } 212 | return $output; 213 | } 214 | function zerotier_controller_deletenetwork($id) { 215 | $auth_secret = file_get_contents('/var/db/zerotier-one/authtoken.secret'); 216 | $output = []; 217 | if (is_service_running("zerotier")) { 218 | exec("/usr/local/bin/curl -X DELETE --header \"X-ZT1-Auth: ${auth_secret}\" http://localhost:9993/controller/network/${id}", $json); 219 | $output = json_decode(implode('', $json)); 220 | } 221 | return $output; 222 | } 223 | 224 | function zerotier_controller_network_members($network) { 225 | global $id; 226 | $auth_secret = file_get_contents('/var/db/zerotier-one/authtoken.secret'); 227 | $output = []; 228 | $members = []; 229 | 230 | if (is_service_running("zerotier")) { 231 | 232 | $curl = curl_init("http://localhost:9993/controller/network/".$network."/member"); 233 | curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET"); 234 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 235 | curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 236 | curl_setopt($curl, CURLOPT_HTTPHEADER, array( 237 | 'X-ZT1-Auth: ' . $auth_secret 238 | ) 239 | ); 240 | 241 | $curl_out = curl_exec($curl); 242 | curl_close($curl); 243 | $members = json_decode($curl_out); 244 | 245 | 246 | foreach($members as $key => $value) { 247 | unset($curl); 248 | unset($response); 249 | $curl = curl_init("http://localhost:9993/controller/network/".$network."/member/".$key); 250 | curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET"); 251 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 252 | curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 253 | curl_setopt($curl, CURLOPT_HTTPHEADER, array( 254 | 'X-ZT1-Auth: ' . $auth_secret 255 | ) 256 | ); 257 | 258 | $response = curl_exec($curl); 259 | curl_close($curl); 260 | $output[] = json_decode($response); 261 | } 262 | } 263 | return $output; 264 | } 265 | function zerotier_controller_member_toggle($network, $member, $key) { 266 | $auth_secret = file_get_contents('/var/db/zerotier-one/authtoken.secret'); 267 | $output = []; 268 | 269 | 270 | if (is_service_running("zerotier")) { 271 | $curl = curl_init("http://localhost:9993/controller/network/".$network."/member/".$member); 272 | curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET"); 273 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 274 | curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 275 | curl_setopt($curl, CURLOPT_HTTPHEADER, array( 276 | 'X-ZT1-Auth: ' . $auth_secret 277 | ) 278 | ); 279 | 280 | $response = curl_exec($curl); 281 | curl_close($curl); 282 | $current = json_decode($response, true); 283 | $new = !($current[$key]); 284 | 285 | $post_data = json_encode([$key => $new]); 286 | $curl = curl_init("http://localhost:9993/controller/network/".$network."/member/".$member); 287 | curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); 288 | curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); 289 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 290 | curl_setopt($curl, CURLOPT_HTTPHEADER, array( 291 | 'Content-Type: application/json', 292 | 'Content-Length: ' . strlen($post_data), 293 | 'X-ZT1-Auth: ' . $auth_secret 294 | ) 295 | ); 296 | 297 | $response = curl_exec($curl); 298 | curl_close($curl); 299 | $output[] = json_decode($response); 300 | } 301 | return $output; 302 | } 303 | // Interface Functions 304 | 305 | function zt_get_pfsense_interface_info($portDeviceName): pfInterface { 306 | $ifList = get_configured_interface_list_by_realif(true); 307 | $ifDesc = get_configured_interface_with_descr(true); 308 | 309 | if($ifList[$portDeviceName]) { 310 | return new pfInterface($ifList[$portDeviceName], $ifDesc[$ifList[$portDeviceName]]); 311 | } 312 | else { 313 | return new pfInterface(); 314 | } 315 | 316 | } 317 | 318 | class pfInterface { 319 | public $interface; 320 | public $description; 321 | 322 | public function __construct(string $interface = "", string $description = "") 323 | { 324 | $this->interface = $interface; 325 | $this->description = $description; 326 | } 327 | } 328 | 329 | // Helper Functions 330 | 331 | /** 332 | * get_status_class 333 | * 334 | * @param string $status 335 | * @return string 336 | */ 337 | function get_status_class(string $status) : string { 338 | $label = ''; 339 | switch ($status) { 340 | case 'OK': 341 | $label = 'success'; 342 | break; 343 | case 'ACCESS_DENIED': 344 | case 'NOT_FOUND': 345 | $label = 'danger'; 346 | break; 347 | case 'REQUESTING_CONFIGURATION': 348 | $label = 'info'; 349 | break; 350 | default: 351 | $label = 'default'; 352 | break; 353 | } 354 | 355 | return $label; 356 | } 357 | ?> -------------------------------------------------------------------------------- /files/usr/local/pkg/zerotier.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | zerotier 6 | Zerotier 7 | /usr/local/pkg/zerotier.inc 8 | 9 | Zerotier 10 |
VPN
11 | /zerotier.php 12 |
13 | 14 | zerotier 15 | zerotier.sh 16 | zerotier-one 17 | Zerotier Daemon 18 | true 19 | 20 | 21 | 22 | zerotier_install(); 23 | 24 | 25 | zerotier_deinstall(); 26 | 27 | 28 | 29 | 30 | 31 | zerotier_sync(); 32 | 33 | 34 | 35 | 36 | zerotier_kill(); 37 | 38 |
39 | -------------------------------------------------------------------------------- /files/usr/local/share/pfSense-pkg-zerotier/info.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zerotier 5 | https://www.zerotier.com 6 | 7 | 9 | 10 | https://forum.pfsense.org/ 11 | %%PKGVERSION%% 12 | zerotier.xml 13 | 14 | 15 | -------------------------------------------------------------------------------- /files/usr/local/www/zerotier.php: -------------------------------------------------------------------------------- 1 | 62 |
63 |

Address: address); ?>

64 |
65 |
66 |
version) ?>
67 |
68 |
69 |
70 | 71 | addInput(new Form_Checkbox( 76 | 'enable', 77 | 'Enable', 78 | 'Enable zerotier client and controller.', 79 | $enable['mode'] 80 | )); 81 | $form->add($section); 82 | $section = new Form_Section('Enable Experimental Options'); 83 | $section->addInput(new Form_Checkbox( 84 | 'enableExperimental', 85 | 'Enable', 86 | 'Enable zerotier client and controller experimental fields.', 87 | $enable['experimental'] 88 | ))->setHelp('This will enable all experimental field options to be displayed and proccessed.'); 89 | $form->add($section); 90 | print($form); 91 | include("foot.inc"); 92 | ?> 93 | -------------------------------------------------------------------------------- /files/usr/local/www/zerotier_controller.php: -------------------------------------------------------------------------------- 1 | TRUE]; 52 | } 53 | $zerotier_network['multicastLimit'] = (integer) $_POST['multicastLimit']; 54 | $zerotier_network['routes'] = []; 55 | $zerotier_network['rules'] = []; 56 | $zerotier_network['ipAssignmentPools'] = []; 57 | $zerotier_network['allowPassiveBridging'] = false; 58 | 59 | if (!isset($_POST['allowAnyProtocol'])) { 60 | if (isset($_POST['AllowIPv4'])) { 61 | $zerotier_network['rules'][] = (object)['etherType' => 2048, 'not' => true, 'or' => false, 'type' => 'MATCH_ETHERTYPE']; 62 | $zerotier_network['rules'][] = (object)['etherType' => 2054, 'not' => true, 'or' => false, 'type' => 'MATCH_ETHERTYPE']; 63 | $zerotier_network['rules'][] = (object)[ 'type' => 'ACTION_ACCEPT']; 64 | } 65 | if (isset($_POST['AllowIPv6'])) { 66 | $zerotier_network['rules'][] = (object)['etherType' => 34525, 'not' => true, 'or' => false, 'type' => 'MATCH_ETHERTYPE']; 67 | $zerotier_network['rules'][] = (object)[ 'type' => 'ACTION_ACCEPT']; 68 | } 69 | } 70 | else { 71 | $zerotier_network['rules'][] = (object)[ 'type' => 'ACTION_ACCEPT']; 72 | } 73 | 74 | if ($zerotier_network['v4AssignMode'] == 'zt') { 75 | $zerotier_network['ipAssignmentPools'][] = ['ipRangeStart' => $_POST['ipRangeStartv4'], 'ipRangeEnd' => $_POST['ipRangeEndv4']]; 76 | } 77 | if ($zerotier_network['v6AssignMode'] == 'zt') { 78 | $zerotier_network['ipAssignmentPools'][] = ['ipRangeStart' => $_POST['ipRangeStartv6'], 'ipRangeEnd' => $_POST['ipRangeEndv6']]; 79 | } 80 | 81 | foreach (explode(',',$_POST['Routes']) as $route) { 82 | $zerotier_network['routes'][] = ['target' => $route, 'via'=> NULL]; 83 | } 84 | 85 | if ($config['installedpackages']['zerotier']['config'][0]['experimental']) { 86 | $zerotier_network['allowPassiveBridging'] = $_POST['allowPassiveBridging'] == 'on' ? TRUE : FALSE; 87 | } 88 | 89 | $out = zerotier_controller_createnetwork($zerotier_network, $id); 90 | 91 | header("Location: zerotier_controller.php"); 92 | exit; 93 | } 94 | if ($act=="new" || $act=="edit"): 95 | $zerotier_network = []; 96 | $zerotier_network["private"] = TRUE; 97 | $zerotier_network["enableBroadcast"] = TRUE; 98 | $zerotier_network['v4AssignMode'] = 0; 99 | $zerotier_network['v6AssignMode'] = 1; 100 | $zerotier_network["AllowIPv4"] = 1; 101 | $zerotier_network['multicastLimit'] = 32; 102 | 103 | $form = new Form(); 104 | $section = new Form_Section('Create Network'); 105 | $section->addInput(new Form_Input( 106 | 'NetworkID', 107 | 'Network ID', 108 | 'text', 109 | $zerotier_network['NetworkID'], 110 | ['min' => '0'] 111 | ))->setHelp("A 6 digit ID that is appended to the server address. Leave blank to use a random ID."); 112 | $section->addInput(new Form_Input( 113 | 'Name', 114 | '*Name', 115 | 'text', 116 | $zerotier_network['name'], 117 | ['min' => '0'] 118 | ))->setHelp("A short name for this network."); 119 | $section->addInput(new Form_Checkbox( 120 | 'private', 121 | '*Private', 122 | 'Enable access control on this network.', 123 | $zerotier_network["private"] 124 | ))->setHelp('Set this option to enable access control.'); 125 | $section->addInput(new Form_Checkbox( 126 | 'enableBroadcast', 127 | '*Enable Broadcast', 128 | 'Ethernet ff:ff:ff:ff:ff:ff allowed?', 129 | $zerotier_network["private"] 130 | ))->setHelp('Set this option to enable Ethernet Broadcast (ff:ff:ff:ff:ff:ff allowed?)'); 131 | $section->addInput(new Form_Select( 132 | 'v4AssignMode', 133 | '*IPv4 Assign Mode', 134 | $zerotier_network['v4AssignMode'], 135 | ['zt'], 136 | TRUE 137 | ))->addClass('multiselect'); 138 | 139 | $group = new Form_Group('*Range'); 140 | 141 | $group->add(new Form_IpAddress( 142 | 'ipRangeStartv4', 143 | null, 144 | $zerotier_network['ipAssignmentPools']['ipRangeStart'], 145 | 'V4' 146 | ))->setHelp('From'); 147 | 148 | $group->add(new Form_IpAddress( 149 | 'ipRangeEndv4', 150 | null, 151 | $zerotier_network['ipAssignmentPools']['ipRangeEnd'], 152 | 'V4' 153 | ))->setHelp('To'); 154 | 155 | $section->add($group); 156 | $section->addInput(new Form_Select( 157 | 'v6AssignMode', 158 | '*IPv6 Assign Mode', 159 | $zerotier_network['v6AssignMode'], 160 | ['zt','6plane','rfc4193'], 161 | TRUE 162 | ))->addClass('multiselect'); 163 | $group = new Form_Group('Range'); 164 | 165 | $group->add(new Form_IpAddress( 166 | 'ipRangeStartv6', 167 | null, 168 | $zerotier_network['ipAssignmentPoolsv6']['ipRangeStart'], 169 | 'V6' 170 | ))->setHelp('From'); 171 | 172 | $group->add(new Form_IpAddress( 173 | 'ipRangeEndv6', 174 | null, 175 | $zerotier_network['ipAssignmentPoolsv6']['ipRangeEnd'], 176 | 'V6' 177 | ))->setHelp('To'); 178 | $section->add($group); 179 | if ($config['installedpackages']['zerotier']['config'][0]['experimental']) { 180 | $section->addInput(new Form_Checkbox( 181 | 'allowPassiveBridging', 182 | 'Allow Passive Bridging', 183 | 'Allow any member to bridge (very experimental)', 184 | $zerotier_network["allowPassiveBridging"] 185 | )); 186 | } 187 | $section->addInput(new Form_Input( 188 | 'multicastLimit', 189 | 'Multicast Limit', 190 | 'number', 191 | $zerotier_network['multicastLimit'], 192 | ['min' => '0'] 193 | ))->setHelp("Maximum recipients for a multicast packet."); 194 | $section->addInput(new Form_Input( 195 | 'Routes', 196 | 'Routes', 197 | 'text', 198 | $zerotier_network['Routes'], 199 | ['min' => '0'] 200 | ))->setHelp("Comma separated prefix list."); 201 | $section->addInput(new Form_Checkbox( 202 | 'allowAnyProtocol', 203 | 'Allow Any Protocol', 204 | 'This option overrides the other protocol selections.', 205 | $zerotier_network["allowAnyProtocol"] 206 | )); 207 | $section->addInput(new Form_Checkbox( 208 | 'AllowIPv4', 209 | 'Allow IPv4', 210 | 'Allow IPv4 and ARP frame types.', 211 | $zerotier_network["AllowIPv4"] 212 | )); 213 | $section->addInput(new Form_Checkbox( 214 | 'AllowIPv6', 215 | 'Allow IPv6', 216 | 'Allow IPv6 frame types.', 217 | $zerotier_network["AllowIPv6"] 218 | )); 219 | $form->add($section); 220 | print($form); 221 | else: 222 | ?> 223 |
224 |
225 |

Zerotier Controller Networks

226 |
227 |
228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 244 | 245 | 246 | 247 | 248 | 251 | 252 | 255 | 256 |
NetworkTypeMembersActions
id); print("
"); print("".$network->name.""); ?>
private ? 'PRIVATE' : 'PUBLIC'); ?>activeMemberCount . '/' . $network->authorizedMemberCount . '/' . $network->totalMemberCount); ?> 249 | 250 |
257 |
258 |
259 | 264 | 267 | -------------------------------------------------------------------------------- /files/usr/local/www/zerotier_controller_network.php: -------------------------------------------------------------------------------- 1 | $memberID, 'alias' => $alias ]; 95 | } 96 | else if ($alias != '' && $index !== False ) { 97 | $config['installedpackages']['zerotiercontroller']['config'][0]['member'][$index] = ['id'=> $memberID, 'alias' => $alias ]; 98 | } 99 | else { 100 | if(is_array($config['installedpackages']['zerotiercontroller']['config'][0]['member'])) 101 | { 102 | unset($config['installedpackages']['zerotiercontroller']['config'][0]['member'][$index]); 103 | } 104 | } 105 | write_config(); 106 | 107 | header("Location: zerotier_controller_network.php?Network=${networkID}"); 108 | exit; 109 | } 110 | if ($act=="new" || $act=="edit"): 111 | $memberID = $_POST['member']; 112 | $form = new Form(); 113 | $section = new Form_Section('Name Member'); 114 | $section->addInput(new Form_Input( 115 | 'Alias', 116 | 'Alias', 117 | 'text', 118 | NULL, 119 | ['min' => '0'] 120 | ))->setHelp("A short name to identify the member."); 121 | if ($act=="edit") { 122 | $form ->addGlobal(new Form_Input( 123 | 'Network', 124 | 'Network', 125 | 'hidden', 126 | $networkID, 127 | ['min' => '0'] 128 | )); 129 | $form ->addGlobal(new Form_Input( 130 | 'Member', 131 | 'member', 132 | 'hidden', 133 | $memberID, 134 | ['min' => '0'] 135 | )); 136 | } 137 | $form->add($section); 138 | print($form); 139 | else: 140 | $network = zerotier_controller_network($networkID); 141 | // print($networkID); 142 | // [TODO] Finish output of all pertinent data about network 143 | // print_r($network); 144 | ?> 145 |
146 |

Network: id); ?>

147 |
148 |
149 |
name) ?>
150 |
private) == TRUE ? 'Private' : 'Public' ?>
151 |
enableBroadcast) ? 'Yes' : 'No' ?>
152 |
multicastLimit) ?>
153 |
154 | ipAssignmentPools as $pool) {?> 155 | ipRangeStart) ?> — ipRangeEnd) ?>
156 | 159 |
160 |
161 |
162 |
163 |
164 |
165 |

Networks Members

166 |
167 |
168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 183 | 184 | 193 | 194 | 199 | 203 | 206 | 207 | 210 | 211 |
IdAddressAuthorizedBridgedActions
id); 185 | // print( 186 | // array_column([array_search($network->id,array_column($config['installedpackages']['zerotier']['config'][0]['networks'], 'networkID'), FALSE)]['members'], 'alias', 'memberID')[$member->id] 187 | // ); 188 | // print_r($config['installedpackages']['zerotier']['config'][0]['networks']); 189 | print('
'); 190 | print_r(array_column($config['installedpackages']['zerotiercontroller']['config'][0]['member'], 'alias', 'id')[''.$member->id][0]); 191 | ?> 192 |
', $member->ipAssignments)); ?>id&member=$member->id&value=authorize\" usepost title=\"Click to toggle Authorization\">");?> 196 | 197 | ")?> 198 | id&member=$member->id&value=bridge\" usepost title=\"Click to toggle Bridging\">");?> 200 | 201 | ")?> 202 | 204 | 205 |
212 |
213 |
214 | 222 | 225 | -------------------------------------------------------------------------------- /files/usr/local/www/zerotier_networks.php: -------------------------------------------------------------------------------- 1 | addInput(new Form_Input( 50 | 'Network', 51 | 'Network', 52 | 'text', 53 | $network, 54 | ['min' => '0'] 55 | ))->setHelp("A 16 digit ID."); 56 | if ($act=="edit") { 57 | $form ->addGlobal(new Form_Input( 58 | 'NetworkOriginal', 59 | 'Network', 60 | 'hidden', 61 | $network, 62 | ['min' => '0'] 63 | )); 64 | $btnUpdate = new Form_Button( 65 | 'Update', // name 66 | 'Update', // Label text 67 | NULL, 68 | 'fa-save' 69 | ); 70 | $btnUpdate->removeClass('btn-default')->addClass('btn-warning'); 71 | $form->addGlobal($btnUpdate); 72 | } 73 | $form->add($section); 74 | print($form); 75 | else: 76 | ?> 77 |
78 |
79 |

Zerotier Networks

80 |
81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 101 | 102 | 105 | 106 | 107 | 108 | 122 | 123 | 127 | 128 | 131 | 132 |
103 | status); ?> 104 | id); print("
"); print("".$network->name.""); ?>
type); ?>',array_reverse($network->assignedAddresses))); ?> 109 | portDeviceName)->interface)) { 111 | ?> 112 | Interface Assignments
portDeviceName); ?>
113 | 117 | portDeviceName)->interface)); ?>
portDeviceName); ?>
118 | 121 |
bridge ? "Yes" : "No"); ?> 124 | 125 | 126 |
133 |
134 |
135 | 140 | 144 | -------------------------------------------------------------------------------- /files/usr/local/www/zerotier_peers.php: -------------------------------------------------------------------------------- 1 | role == $b->role){ return 0 ; } 7 | return ($a->role < $b->role) ? 1 : -1; 8 | } 9 | 10 | $pgtitle = array(gettext("VPN"), gettext("Zerotier"), gettext("Peers")); 11 | $pglinks = array("", "pkg_edit.php?xml=zerotier.xml", "@self"); 12 | require("head.inc"); 13 | 14 | $tab_array = array(); 15 | $tab_array[] = array(gettext("Networks"), false, "zerotier_networks.php"); 16 | $tab_array[] = array(gettext("Peers"), true, "zerotier_peers.php"); 17 | $tab_array[] = array(gettext("Controller"), false, "zerotier_controller.php"); 18 | $tab_array[] = array(gettext("Configuration"), false, "zerotier.php"); 19 | add_package_tabs("Zerotier", $tab_array); 20 | display_top_tabs($tab_array); 21 | 22 | if (!is_service_running("zerotier")) { 23 | print_info_box(gettext("The Zerotier service is not running."), "warning", false); 24 | } 25 | 26 | ?> 27 |
28 |
29 |

Zerotier Peers

30 |
31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 58 | 59 |
ZT AddressPathLatencyVersionRole
address); ?>paths[0]->address); ?>latency); ?>version); ?>role); ?>
60 |
61 |
62 | 63 | -------------------------------------------------------------------------------- /pkg-descr: -------------------------------------------------------------------------------- 1 | Allows Zerotier networks to be joined. 2 | -------------------------------------------------------------------------------- /pkg-plist: -------------------------------------------------------------------------------- 1 | pkg/zerotier.xml 2 | pkg/zerotier.inc 3 | www/zerotier.php 4 | www/zerotier_networks.php 5 | www/zerotier_peers.php 6 | www/zerotier_controller.php 7 | www/zerotier_controller_network.php 8 | %%DATADIR%%/info.xml 9 | -------------------------------------------------------------------------------- /zerotier: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # $FreeBSD: head/net/zerotier/files/zerotier.in 454856 2017-11-24 23:17:50Z dbaio $ 4 | # 5 | # PROVIDE: zerotier 6 | # REQUIRE: FILESYSTEMS cleanvar 7 | # BEFORE: kld 8 | # KEYWORD: shutdown 9 | # 10 | # Add these lines to /etc/rc.conf.local or /etc/rc.conf 11 | # to enable this service: 12 | # 13 | # zerotier_enable (bool): Set to NO by default. 14 | # Set it to YES to enable zerotier. 15 | 16 | . /etc/rc.subr 17 | 18 | name=zerotier 19 | rcvar=zerotier_enable 20 | 21 | pidfile="/var/db/${name}-one/${name}-one.pid" 22 | 23 | load_rc_config ${name} 24 | 25 | : ${zerotier_enable:="YES"} 26 | command="/usr/local/sbin/${name}-one" 27 | 28 | command_args="-d" 29 | 30 | run_rc_command "$1" 31 | --------------------------------------------------------------------------------