Revision b8fd0558
Added by Steve Beaver over 3 years ago
src/etc/inc/pkg-utils.inc | ||
---|---|---|
1492 | 1492 |
} |
1493 | 1493 |
|
1494 | 1494 |
/* Setup pkg.conf according current repo */ |
1495 |
function pkg_conf_setup() { |
|
1495 |
function pkg_conf_setup($repo_path) {
|
|
1496 | 1496 |
global $g; |
1497 | 1497 |
|
1498 | 1498 |
$pkg_conf_path = "/usr/local/etc/pkg.conf"; |
... | ... | |
1521 | 1521 |
); |
1522 | 1522 |
} |
1523 | 1523 |
|
1524 |
$auth_ca = "/etc/ssl/netgate-ca.pem"; |
|
1525 |
$auth_cert = "/etc/ssl/pfSense-repo-custom.cert"; |
|
1526 |
$auth_key = "/etc/ssl/pfSense-repo-custom.key"; |
|
1527 |
if (strpos($repo_path, "{$g['product_name']}-repo-custom") && |
|
1528 |
file_exists($auth_ca) && file_exists($auth_cert) && |
|
1529 |
file_exists($auth_key)) { |
|
1530 |
$pkg_conf[] = "PKG_ENV {\n"; |
|
1531 |
$pkg_conf[] = "\tSSL_CA_CERT_FILE=$auth_ca\n"; |
|
1532 |
$pkg_conf[] = "\tSSL_CLIENT_CERT_FILE=$auth_cert\n"; |
|
1533 |
$pkg_conf[] = "\tSSL_CLIENT_KEY_FILE=$auth_key\n"; |
|
1534 |
$pkg_conf[] = "}\n"; |
|
1535 |
} |
|
1536 |
|
|
1524 | 1537 |
file_put_contents($pkg_conf_path, $pkg_conf); |
1525 | 1538 |
} |
1526 | 1539 |
|
... | ... | |
1532 | 1545 |
@unlink("/usr/local/etc/pkg/repos/{$g['product_name']}.conf"); |
1533 | 1546 |
@symlink($path, "/usr/local/etc/pkg/repos/{$g['product_name']}.conf"); |
1534 | 1547 |
|
1535 |
pkg_conf_setup(); |
|
1548 |
pkg_conf_setup($path);
|
|
1536 | 1549 |
|
1537 | 1550 |
/* Update pfSense_version cache */ |
1538 | 1551 |
mwexec_bg("/etc/rc.update_pkg_metadata now"); |
... | ... | |
1544 | 1557 |
$idfile = "/var/db/uniqueid"; |
1545 | 1558 |
$repopath = "/usr/local/share/{$g['product_name']}/pkg/repos"; |
1546 | 1559 |
$configflename = "{$repopath}/{$g['product_name']}-repo-custom.conf"; |
1560 |
$cafilesrc = "/usr/local/share/{$g['product_name']}/ssl/netgate-ca.pem"; |
|
1561 |
$cafile = "/etc/ssl/netgate-ca.pem"; |
|
1547 | 1562 |
|
1548 | 1563 |
/* |
1549 | 1564 |
* Update the list of available repositories from the server. This will allow |
1550 |
* migration to another update repository should the existing one becomes
|
|
1565 |
* migration to another update repository should the existing one become |
|
1551 | 1566 |
* unavailable |
1552 | 1567 |
*/ |
1553 | 1568 |
function update_repos() { |
1554 |
global $g, $config, $idfile, $FQDN, $repopath; |
|
1569 |
global $g, $cafile, $cafilesrc, $config, $idfile, $FQDN, $repopath;
|
|
1555 | 1570 |
|
1556 | 1571 |
if (!file_exists($idfile) || !function_exists('curl_version')) { |
1557 | 1572 |
return; |
1558 | 1573 |
} |
1574 |
/* Copy the CA file to the proper place before start. */ |
|
1575 |
if (!file_exists($cafile) && file_exists($cafilesrc)) { |
|
1576 |
copy($cafilesrc, $cafile); |
|
1577 |
} |
|
1559 | 1578 |
/* |
1560 | 1579 |
* If the custom repository definition does not exist, or is more |
1561 | 1580 |
* than 24 hours old fetch a copy from the server |
... | ... | |
1651 | 1670 |
isset($repo['name']) && (strlen($repo['conf']) > 10)) { |
1652 | 1671 |
$basename = "{$repopath}/{$g['product_name']}-repo-custom."; |
1653 | 1672 |
|
1654 |
file_put_contents($basename . "conf", base64_decode(
|
|
1655 |
$repo['conf']));
|
|
1656 |
file_put_contents($basename . "descr", $repo['descr']);
|
|
1657 |
file_put_contents($basename . "abi", $repo['abi']);
|
|
1658 |
file_put_contents($basename . "altabi", $repo['altabi']);
|
|
1659 |
file_put_contents($basename . "name", $repo['name']);
|
|
1660 |
file_put_contents($basename . "help", $repo['help']); |
|
1673 |
if (!empty($repo['conf'])) {file_put_contents($basename . "conf", base64_decode($repo['conf']));}
|
|
1674 |
if (!empty($repo['descr'])) {file_put_contents($basename . "descr", $repo['descr']);}
|
|
1675 |
if (!empty($repo['abi'])) {file_put_contents($basename . "abi", $repo['abi']);}
|
|
1676 |
if (!empty($repo['altabi'])) {file_put_contents($basename . "altabi", $repo['altabi']);}
|
|
1677 |
if (!empty($repo['name'])) {file_put_contents($basename . "name", $repo['name']);}
|
|
1678 |
if (!empty($repo['help'])) {file_put_contents($basename . "help", $repo['help']);}
|
|
1679 |
|
|
1661 | 1680 |
|
1662 | 1681 |
// Save fingerprint file |
1663 | 1682 |
if (!empty($repo['fingerprint'])) { |
... | ... | |
1669 | 1688 |
|
1670 | 1689 |
file_put_contents($fppath, $repo['fingerprint']); |
1671 | 1690 |
} |
1691 |
|
|
1692 |
// Save the client Cert & key |
|
1693 |
if (!empty($repo['cert']) && !empty($repo['key'])) { |
|
1694 |
$certbasename = "/etc/ssl/{$g['product_name']}-repo-custom."; |
|
1695 |
file_put_contents($certbasename . "cert", $repo['cert']); |
|
1696 |
file_put_contents($certbasename . "key", $repo['key']); |
|
1697 |
chmod($certbasename . "key", 0600); |
|
1698 |
} |
|
1672 | 1699 |
} else { |
1673 | 1700 |
/* |
1674 | 1701 |
* If there was anything wrong with the custom repository |
src/etc/pfSense-rc | ||
---|---|---|
377 | 377 |
[ -z "$skip_packages" ] \ |
378 | 378 |
&& /usr/local/sbin/${product_name}-upgrade -y -U -b 2 |
379 | 379 |
|
380 |
# Copy default openssl config file |
|
380 |
# Copy default openssl config file and Netgate CA
|
|
381 | 381 |
[ -d /etc/ssl ] \ |
382 | 382 |
|| mkdir -p /etc/ssl |
383 | 383 |
[ -f /usr/local/share/${product_name}/ssl/openssl.cnf ] \ |
... | ... | |
386 | 386 |
ln -sf /etc/ssl/openssl.cnf \ |
387 | 387 |
/usr/local/openssl/openssl.cnf |
388 | 388 |
|
389 |
[ -f /usr/local/share/${product_name}/ssl/netgate-ca.pem ] \ |
|
390 |
&& cp -f /usr/local/share/${product_name}/ssl/netgate-ca.pem /etc/ssl |
|
391 |
|
|
389 | 392 |
# Run the php.ini setup file and populate |
390 | 393 |
# /usr/local/etc/php.ini |
391 | 394 |
/etc/rc.php_ini_setup 2>/tmp/php_errors.txt |
src/usr/local/pfSense/include/www/system_register.inc | ||
---|---|---|
1 |
<?php |
|
2 |
/* |
|
3 |
* system_register.inc |
|
4 |
* |
|
5 |
* part of pfSense plus (https://www.netgate.com) |
|
6 |
* Copyright (c) 2014-2022 Rubicon Communications, LLC (Netgate) |
|
7 |
* All rights reserved. |
|
8 |
*/ |
|
9 |
|
|
10 |
$FQDN = "https://ews.netgate.com/plus"; |
|
11 |
$idfile = "/var/db/uniqueid"; |
|
12 |
|
|
13 |
// Transmit the NDI and activation token so that user registration is recorded |
|
14 |
// $action = "check" determines if this instance is a candidate for registion |
|
15 |
// "register" performs the registration |
|
16 |
function activate_plus($action, $token) { |
|
17 |
global $g, $FQDN, $idfile; |
|
18 |
|
|
19 |
if (file_exists($idfile)) { |
|
20 |
if (function_exists('curl_version')) { |
|
21 |
$post = ['act' => $action, 'uid' => file_get_contents($idfile), 'token' => $token, 'product' => "CE"]; |
|
22 |
$url = $FQDN; |
|
23 |
|
|
24 |
$ch = curl_init(); |
|
25 |
curl_setopt($ch, CURLOPT_HEADER, 0); |
|
26 |
curl_setopt($ch, CURLOPT_VERBOSE, 0); |
|
27 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
28 |
curl_setopt($ch, CURLOPT_USERAGENT, $g['product_label'] . '/' . $g['product_version']); |
|
29 |
curl_setopt($ch, CURLOPT_URL, $url); |
|
30 |
curl_setopt($ch, CURLOPT_POST, true); |
|
31 |
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); |
|
32 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,4); |
|
33 |
$response = curl_exec($ch); |
|
34 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
35 |
curl_close($ch); |
|
36 |
|
|
37 |
if ($status == 200) { |
|
38 |
return trim($response); |
|
39 |
} |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
return "FAIL"; |
|
44 |
} |
|
45 |
?> |
src/usr/local/share/pfSense/ssl/netgate-ca.pem | ||
---|---|---|
1 |
-----BEGIN CERTIFICATE----- |
|
2 |
MIIGdjCCBF6gAwIBAgIUMHOwWSamn5M+UgESNeiPVzCtWeEwDQYJKoZIhvcNAQEL |
|
3 |
BQAwgZIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEPMA0GA1UEBwwGQXVz |
|
4 |
dGluMS4wLAYDVQQKDCVSdWJpY29uIENvbW11bmljYXRpb25zLCBMTEMgKE5ldGdh |
|
5 |
dGUpMRgwFgYDVQQLDA9OZXRnYXRlIHJvb3QgQ0ExGDAWBgNVBAMMD05ldGdhdGUg |
|
6 |
cm9vdCBDQTAgFw0yMTExMjMyMDM5MzFaGA8zMDIxMDMyNjIwMzkzMVowgZIxCzAJ |
|
7 |
BgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEPMA0GA1UEBwwGQXVzdGluMS4wLAYD |
|
8 |
VQQKDCVSdWJpY29uIENvbW11bmljYXRpb25zLCBMTEMgKE5ldGdhdGUpMRgwFgYD |
|
9 |
VQQLDA9OZXRnYXRlIHJvb3QgQ0ExGDAWBgNVBAMMD05ldGdhdGUgcm9vdCBDQTCC |
|
10 |
AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANNDuUCzYYKMqqIsnlfHqlhd |
|
11 |
NjS8p8wrvlIqMyOFLBWdGRzF3CP6AyJNlwHgbKPNmZluoWwqA28lmQmbS/sMK13q |
|
12 |
+UuH/l8r0oYQVizPWyY0dug9e7qhI+7fxHW4QOa0KbZfS227sFMEXuJNNagX2atP |
|
13 |
QTaWzmFoOqi546703a0ng6VhSDJUkseEqjJg/7SSKsVO3+2TIfDJGBjMsnU8kgzK |
|
14 |
DXbeQdCj6+rzNyI5zT3ijeNB1kPy6qGvj+NJ1xhdX0DG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Bso+TcUQqu50dodwFAMQoMB8GA1Ud |
|
61 |
IwQYMBaAFHK5cRaa6n7LTlfyogiuJtZdP9IsMA8GA1UdEwEB/wQFMAMBAf8wDgYD |
|
62 |
VR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQAhVNe5H5J0dt6SgPHgoLdQ |
|
63 |
g6Uhagl9+zlDdC+JyBTHroj5CG2nC6147HOOKeKZLm3OsTLDx0nxj/MGrc/Q9wmf |
|
64 |
5/YEGDuja3NPVAM3RR7+YRIIrEg7cbWoxdkQ4SkZ+I13ZoRKiOWR/pXH/LKM+JNY |
|
65 |
DyUb6XjZLYspqlU58QtmEy3kxPtVjPSmh/lG9wT7MYz3bq1msi2gCwZqStXiHZ9M |
|
66 |
0hvqqucOtqf9vWkQfGJN34Xi/HLUt8ZVeMS5uTW+hiJN3Mz0vE0V89hbHIP7lloB |
|
67 |
z7jrJV3uky2dQEA70yXK4Bv9z5RqEyfzvMgGfRhUSRn75sbYc8GJkJMVMDiuXkQE |
|
68 |
zqf+J40LMqhPl9Ox47hCkL4iSZH2gJI7H1xNZfrMJvbG7hf4t+Kukb/40648QXRz |
|
69 |
v2cPfQkfzp/Rg5OaBEa1cr73AzwiPXOrqhbA/bPFzk0rs5Yfr7nRZDC8BEtZE109 |
|
70 |
X1Mldd/k/Q/DUDYfd0KyE043QiZiYRC069OI4m2dB7mGepIimRz7bTMK2UCRbVuS |
|
71 |
UXCjjVzDwdvat4oyz6lfaUXmzZHTmK2CXg8KdapBNoN6ufLUjVtL0inQMUUsOR20 |
|
72 |
+jKm2YnRxTePtFdhaeAjAPmNEBt3iRqLBvx/mSJFznWn8a6EBikdJ2zgvr+7ASfv |
|
73 |
+TZYDL1cfSVwg+6H+PbP1g== |
|
74 |
-----END CERTIFICATE----- |
src/usr/local/www/head.inc | ||
---|---|---|
254 | 254 |
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml"); |
255 | 255 |
$system_menu[] = array(gettext("Routing"), "/system_gateways.php"); |
256 | 256 |
$system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php"); |
257 |
$system_menu[] = array(gettext("Register"), "/system_register.php"); |
|
258 |
|
|
257 | 259 |
if (!isAllowedPage("system_usermanager.php")) { |
258 | 260 |
$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php"); |
259 | 261 |
} else { |
... | ... | |
435 | 437 |
$help_menu[] = array(gettext("pfSense Book"), "https://redirects.netgate.com/book"); |
436 | 438 |
$help_menu[] = array(gettext("FreeBSD Handbook"), "https://redirects.netgate.com/fbsdhandbook"); |
437 | 439 |
$help_menu[] = array(gettext("User survey"), "https://redirects.netgate.com/survey_1"); |
440 |
$help_menu[] = array(gettext("Upgrade to pfSense Plus"), "https://redirects.netgate.com/upgrade"); |
|
438 | 441 |
$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0); |
439 | 442 |
} |
440 | 443 |
|
src/usr/local/www/system_register.php | ||
---|---|---|
1 |
<?php |
|
2 |
/* |
|
3 |
* system_register.php |
|
4 |
* |
|
5 |
* part of pfSense (https://www.pfsense.org) |
|
6 |
* Copyright (c) 2013-2016 Electric Sheep Fencing |
|
7 |
* Copyright (c) 2014-2022 Rubicon Communications, LLC (Netgate) |
|
8 |
* All rights reserved. |
|
9 |
* |
|
10 |
* originally based on m0n0wall (http://m0n0.ch/wall) |
|
11 |
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>. |
|
12 |
* All rights reserved. |
|
13 |
* |
|
14 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
15 |
* you may not use this file except in compliance with the License. |
|
16 |
* You may obtain a copy of the License at |
|
17 |
* |
|
18 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
19 |
* |
|
20 |
* Unless required by applicable law or agreed to in writing, software |
|
21 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
22 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
23 |
* See the License for the specific language governing permissions and |
|
24 |
* limitations under the License. |
|
25 |
*/ |
|
26 |
|
|
27 |
##|+PRIV |
|
28 |
##|*IDENT=page-system-register |
|
29 |
##|*NAME=System: Register |
|
30 |
##|*DESCR=Allow access to the 'System: Register' page. |
|
31 |
##|*MATCH=system_register.php* |
|
32 |
##|-PRIV |
|
33 |
|
|
34 |
require_once("guiconfig.inc"); |
|
35 |
require_once("system_register.inc"); |
|
36 |
|
|
37 |
include("head.inc"); |
|
38 |
|
|
39 |
// Possible helpblock messages |
|
40 |
$pgtitle = array(gettext("System"), gettext("Register")); |
|
41 |
|
|
42 |
$pghelp = sprintf(gettext('Thank you for choosing %1s%2s'), $g['product_label_html'], '<br /><br />'); |
|
43 |
|
|
44 |
$pghelp_notrequired = gettext("Your device does not require registration, we recognize it already." . |
|
45 |
" You may have already registered, or it may be a pre-registered Netgate appliance."); |
|
46 |
|
|
47 |
$pghelp_offline = gettext("The registration system is not currently available. Please check your network connection and try again."); |
|
48 |
|
|
49 |
$pghelp_ok = gettext('pfSense<sup>®</sup> Community Edition software may be upgraded to pfSense<sup>®</sup> Plus software by purchasing an upgrade from the Netgate store here: ' . |
|
50 |
'<a href="https://redirects.netgate.com/upgrade">Upgrade</a>' . |
|
51 |
'<br />Once your upgrade purchase is complete, you will receive an activation token by email.' . |
|
52 |
'Please paste that token into the field below, then click “Register”.' . |
|
53 |
'<br /><br>Registration ensures you have access to the services included with pfSense<sup>®</sup> Plus software.' . |
|
54 |
'<br />If you do not receive the activation token email within a few minutes of placing the order, please contact <a href="https://go.netgate.com">Netgate TAC</a>.'); |
|
55 |
|
|
56 |
$pghelp_exists = sprintf(gettext("This device has already been registered. " . |
|
57 |
"If you believe that to be incorrect, please contact Netgate TAC support for assistance by visiting %1s."), |
|
58 |
'<a href="go.netgate.com", target="_blank">go.netgate.com</a>'); |
|
59 |
|
|
60 |
$pghelp_notready = sprintf(gettext("The registration service is not available yet. Please watch %1s, %2s, %3s, for updates."), |
|
61 |
'<a href="https://www.netgate.com/blog/" target="_blank">our blog</a>', |
|
62 |
'<a href="https://twitter.com/NetgateUSA" target="_blank">Twitter</a>', |
|
63 |
'<a href="https://www.reddit.com/r/Netgate/" target="_blank">Reddit</a>' |
|
64 |
); |
|
65 |
|
|
66 |
$pghelp_success = gettext("Your firewall has been successfully registered. On your next visit to the System/Update page, select pfSense<sup>®</sup> Plus software from the list of repositories."); |
|
67 |
|
|
68 |
$pghelp_notfound = sprintf(gettext("This activation token is not valid. " . |
|
69 |
"Please contact Netgate TAC support for assistance by visiting %1s"), '<a href="https://go.netgate.com" target="_blank">go.netgate.com</a>'); |
|
70 |
|
|
71 |
$disabled = "disabled"; |
|
72 |
$activation_token = ""; |
|
73 |
$alert_color = 'info'; |
|
74 |
|
|
75 |
// On registration (POST), call the activate_plus() function to register the token and NDI with the server. |
|
76 |
// Otherwise call check_plus() to determine if this device is suitable for registration. |
|
77 |
// Choose from one of the above messages on return |
|
78 |
if ($_POST && $_REQUEST['Submit'] == 'Register') { |
|
79 |
$activation_token = $_REQUEST['activation_token']; |
|
80 |
|
|
81 |
if ( !empty($activation_token)) { |
|
82 |
unset($input_errors); |
|
83 |
|
|
84 |
$activation_token = str_replace(' ', '', trim($activation_token)); |
|
85 |
$activation_token = str_replace("\n", '', $activation_token); |
|
86 |
$activation_token = str_replace("\r", '', $activation_token); |
|
87 |
|
|
88 |
if (preg_match('/(^[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*$)/', $activation_token)) { |
|
89 |
makehelp(activate_plus("register", $activation_token)); |
|
90 |
} else { |
|
91 |
$input_errors[] = $activation_token . ' ' . gettext('is not a valid activation token!'); |
|
92 |
} |
|
93 |
} else { |
|
94 |
$input_errors[] = gettext('An activation token must be provided.'); |
|
95 |
} |
|
96 |
} else { |
|
97 |
makeHelp(activate_plus("check", "")); |
|
98 |
} |
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
if ($input_errors) { |
|
103 |
print_input_errors($input_errors); |
|
104 |
$disabled = ""; |
|
105 |
} |
|
106 |
|
|
107 |
print('<div class="infoblock blockopen">'); |
|
108 |
print_info_box($pghelp,$alert_color, false); |
|
109 |
print('</div>'); |
|
110 |
|
|
111 |
$form = new Form(false); |
|
112 |
|
|
113 |
$section = new Form_Section('Register ' . $g['product_label']); |
|
114 |
|
|
115 |
$section->addInput(new Form_Textarea( |
|
116 |
'activation_token', |
|
117 |
'*Activation token', |
|
118 |
$activation_token |
|
119 |
))->setAttribute($disabled, true) |
|
120 |
->setAttribute('rows', '10') |
|
121 |
->removeClass('form-control') |
|
122 |
->addClass('row-fluid col-sm-8'); |
|
123 |
|
|
124 |
$form->add($section); |
|
125 |
|
|
126 |
$form->addGlobal(new Form_Button( |
|
127 |
'Submit', |
|
128 |
'Register', |
|
129 |
null, |
|
130 |
'fa-registered' |
|
131 |
))->addClass('btn-primary')->setAttribute($disabled, true); |
|
132 |
|
|
133 |
print $form; |
|
134 |
|
|
135 |
// Display the appropriate message, color and input activation based on the web service response |
|
136 |
function makeHelp($res) { |
|
137 |
global $pghelp, $disabled, $pghelp_ok, $pghelp_offline, $alert_color; |
|
138 |
global $pghelp_notrequired, $pghelp_notready, $pghelp_success, $pghelp_notfound; |
|
139 |
|
|
140 |
switch ($res) { |
|
141 |
case "OK" : |
|
142 |
$pghelp .= $pghelp_ok; |
|
143 |
$disabled = ""; |
|
144 |
break; |
|
145 |
|
|
146 |
case "FAIL" : |
|
147 |
$pghelp .= $pghelp_offline; |
|
148 |
$alert_color = 'danger'; |
|
149 |
break; |
|
150 |
|
|
151 |
case "EXISTS" : |
|
152 |
$pghelp .= $pghelp_notrequired; |
|
153 |
$alert_color = 'warning'; |
|
154 |
break; |
|
155 |
|
|
156 |
case "NOTREADY" : |
|
157 |
$pghelp .= $pghelp_notready; |
|
158 |
$alert_color = 'warning'; |
|
159 |
break; |
|
160 |
|
|
161 |
case "REGOK" : |
|
162 |
$pghelp .= $pghelp_success; |
|
163 |
$alert_color = 'success'; |
|
164 |
break; |
|
165 |
|
|
166 |
case "NOTFOUND" : |
|
167 |
$pghelp .= $pghelp_notfound; |
|
168 |
$disabled = false; |
|
169 |
$alert_color = 'danger'; |
|
170 |
break; |
|
171 |
} |
|
172 |
} |
|
173 |
|
|
174 |
include("foot.inc"); |
|
175 |
?> |
Also available in: Unified diff
netgate-ca.pem is now in the base image at /usr/local/share/${product_name}/ssl/netgate-ca.pem