Commit 93e4773f authored by Franco Fichtner's avatar Franco Fichtner

firmware: for now, push crypto settings to "System: Settings: General"

parent de984e2f
......@@ -787,9 +787,47 @@ EOD;
return $retval;
}
function system_firmware_configure()
{
global $config;
$pkg_mirror = 'http://pkg.opnsense.org';
$pkg_flavour = 'latest';
if (!file_exists('/usr/local/etc/pkg/repos/OPNsense.conf.sample')) {
return;
}
if (isset($config['system']['firmware']['flavour'])) {
$pkg_flavour = $config['system']['firmware']['flavour'];
}
if (isset($config['system']['firmware']['mirror'])) {
$pkg_mirror = $config['system']['firmware']['mirror'];
}
$pkg_sample = file_get_contents('/usr/local/etc/pkg/repos/OPNsense.conf.sample');
$pkg_sample = explode(PHP_EOL, $pkg_sample);
$pkg_config = '';
foreach ($pkg_sample as $pkg_line) {
if (!strlen($pkg_line)) {
continue;
} elseif (!strncasecmp($pkg_line, ' url:', 6)) {
$pkg_line = sprintf(
' url: "pkg+%s/${ABI}/%s",',
$pkg_mirror,
$pkg_flavour
);
}
$pkg_config .= $pkg_line . PHP_EOL;
}
file_put_contents('/usr/local/etc/pkg/repos/OPNsense.conf', $pkg_config);
}
function system_webgui_start()
{
global $config, $g;
global $config;
chdir('/usr/local/www');
......@@ -799,37 +837,6 @@ function system_webgui_start()
$key = "";
$ca = "";
/* XXX migrate this to a more appropriate place */
if (file_exists('/usr/local/etc/pkg/repos/OPNsense.conf.sample')) {
$pkg_flavour = 'latest';
if (isset($config['system']['firmware']['flavour'])) {
$pkg_flavour = $config['system']['firmware']['flavour'];
}
$pkg_mirror = 'http://pkg.opnsense.org';
if (isset($config['system']['firmware']['mirror'])) {
$pkg_mirror = $config['system']['firmware']['mirror'];
}
/* upgrade pkg(8) mirror info */
$pkg_sample = file_get_contents('/usr/local/etc/pkg/repos/OPNsense.conf.sample');
$pkg_sample = explode(PHP_EOL, $pkg_sample);
$pkg_config = '';
foreach ($pkg_sample as $pkg_line) {
if (!strlen($pkg_line)) {
continue;
} elseif (!strncasecmp($pkg_line, ' url:', 6)) {
$pkg_line = sprintf(
' url: "pkg+%s/${ABI}/%s",',
$pkg_mirror,
$pkg_flavour
);
}
$pkg_config .= $pkg_line . PHP_EOL;
}
file_put_contents('/usr/local/etc/pkg/repos/OPNsense.conf', $pkg_config);
}
/* non-standard port? */
if (isset($config['system']['webgui']['port']) && $config['system']['webgui']['port'] <> "")
$portarg = "{$config['system']['webgui']['port']}";
......
......@@ -45,6 +45,18 @@ function get_locale_list()
return $locales;
}
function get_flavour_list()
{
$flavours = array();
$flavours['libressl'] = 'LibreSSL';
$flavours['latest'] = 'OpenSSL';
asort($flavours);
return $flavours;
}
$pconfig['hostname'] = $config['system']['hostname'];
$pconfig['domain'] = $config['system']['domain'];
list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['system']['dnsserver'];
......@@ -62,6 +74,9 @@ $pconfig['timeupdateinterval'] = $config['system']['time-update-interval'];
$pconfig['timeservers'] = $config['system']['timeservers'];
$pconfig['theme'] = $config['system']['theme'];
$pconfig['language'] = $config['system']['language'];
if ($isset($config['system']['firmware']['flavour'])) {
$pconfig['firmware_flavour'] = $config['system']['firmware']['flavour'];
}
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
......@@ -173,11 +188,23 @@ if ($_POST) {
update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']);
if($_POST['language'] && $_POST['language'] != $config['system']['language']) {
if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
$config['system']['language'] = $_POST['language'];
set_language($config['system']['language']);
}
if (!isset($config['system']['firmware'])) {
$config['system']['firmware'] = array();
}
if ($_POST['firmware_flavour']) {
$config['system']['firmware']['flavour'] = $_POST['firmware_flavour'];
} else {
if (isset($config['system']['firmware']['flavour'])) {
unset($config['system']['firmware']['flavour']);
}
}
system_firmware_configure();
update_if_changed("System Theme", $config['theme'], $_POST['theme']);
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
......@@ -460,11 +487,30 @@ include("head.inc");
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?php echo gettext("Language");?></td>
<td width="22%" valign="top" class="vncell"><?=gettext("Cryptography");?></td>
<td width="78%" class="vtable">
<select name="firmware_flavour" class="selectpicker" data-style="btn-default" data-width="auto">
<?php
foreach(get_flavour_list() as $fcode => $fdesc) {
$selected = ' selected="selected"';
if ($fcode != $pconfig['firmware_flavour']) {
$selected = '';
}
echo "<option value=\"{$fcode}\"{$selected}>{$fdesc}</option>";
}
?>
</select>
<strong>
<?=gettext("Choose the cryptography library to be used by the system."); ?>
</strong>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Language");?></td>
<td width="78%" class="vtable">
<select name="language" class="selectpicker" data-style="btn-default" data-width="auto">
<?php
foreach(get_locale_list() as $lcode => $ldesc) {
foreach (get_locale_list() as $lcode => $ldesc) {
$selected = ' selected="selected"';
if($lcode != $pconfig['language'])
$selected = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment