Commit f763c7cd authored by Franco Fichtner's avatar Franco Fichtner

config: reformat config.xml sample, some additions

parent 06723bcf
<?xml version="1.0"?> <?xml version="1.0"?>
<opnsense> <opnsense>
<trigger_initial_wizard/> <trigger_initial_wizard/>
<version>9.9</version> <version>11.2</version>
<lastchange></lastchange> <lastchange></lastchange>
<theme>opnsense</theme> <theme>opnsense</theme>
<sysctl> <sysctl>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
</user> </user>
<nextuid>2000</nextuid> <nextuid>2000</nextuid>
<nextgid>2000</nextgid> <nextgid>2000</nextgid>
<timezone>Etc/UTC</timezone> <timezone>Europe/Amsterdam</timezone>
<time-update-interval>300</time-update-interval> <time-update-interval>300</time-update-interval>
<timeservers>0.nl.pool.ntp.org</timeservers> <timeservers>0.nl.pool.ntp.org</timeservers>
<webgui> <webgui>
...@@ -219,7 +219,6 @@ ...@@ -219,7 +219,6 @@
</webgui> </webgui>
<disablenatreflection>yes</disablenatreflection> <disablenatreflection>yes</disablenatreflection>
<disableconsolemenu/> <disableconsolemenu/>
<!-- <harddiskstandby></harddiskstandby> -->
<disablesegmentationoffloading/> <disablesegmentationoffloading/>
<disablelargereceiveoffloading/> <disablelargereceiveoffloading/>
<ipv6allow/> <ipv6allow/>
...@@ -230,9 +229,6 @@ ...@@ -230,9 +229,6 @@
<interval>monthly</interval> <interval>monthly</interval>
</bogons> </bogons>
<kill_states/> <kill_states/>
<ssh>
<sshdkeyonly/>
</ssh>
</system> </system>
<interfaces> <interfaces>
<wan> <wan>
...@@ -241,7 +237,6 @@ ...@@ -241,7 +237,6 @@
<mtu></mtu> <mtu></mtu>
<ipaddr>dhcp</ipaddr> <ipaddr>dhcp</ipaddr>
<ipaddrv6>dhcp6</ipaddrv6> <ipaddrv6>dhcp6</ipaddrv6>
<!-- *or* ipv4-address *or* 'pppoe' *or* 'pptp' *or* 'bigpond' -->
<subnet></subnet> <subnet></subnet>
<gateway></gateway> <gateway></gateway>
<blockpriv/> <blockpriv/>
...@@ -251,11 +246,6 @@ ...@@ -251,11 +246,6 @@
<mediaopt></mediaopt> <mediaopt></mediaopt>
<dhcp6-duid></dhcp6-duid> <dhcp6-duid></dhcp6-duid>
<dhcp6-ia-pd-len>0</dhcp6-ia-pd-len> <dhcp6-ia-pd-len>0</dhcp6-ia-pd-len>
<!--
<wireless>
*see below (opt[n])*
</wireless>
-->
</wan> </wan>
<lan> <lan>
<enable/> <enable/>
...@@ -268,46 +258,8 @@ ...@@ -268,46 +258,8 @@
<mediaopt></mediaopt> <mediaopt></mediaopt>
<track6-interface>wan</track6-interface> <track6-interface>wan</track6-interface>
<track6-prefix-id>0</track6-prefix-id> <track6-prefix-id>0</track6-prefix-id>
<!--
<wireless>
*see below (opt[n])*
</wireless>
-->
</lan> </lan>
<!--
<opt[n]>
<enable/>
<descr></descr>
<if></if>
<ipaddr></ipaddr>
<subnet></subnet>
<media></media>
<mediaopt></mediaopt>
<bridge>lan|wan|opt[n]</bridge>
<wireless>
<mode>hostap *or* bss *or* ibss</mode>
<ssid></ssid>
<channel></channel>
<wep>
<enable/>
<key>
<txkey/>
<value></value>
</key>
</wep>
</wireless>
</opt[n]>
-->
</interfaces> </interfaces>
<!--
<vlans>
<vlan>
<tag></tag>
<if></if>
<descr></descr>
</vlan>
</vlans>
-->
<staticroutes> <staticroutes>
<!-- <!--
<route> <route>
...@@ -402,25 +354,6 @@ ...@@ -402,25 +354,6 @@
<nologdefaultblock/> <nologdefaultblock/>
--> -->
</syslog> </syslog>
<!--
<captiveportal>
<enable/>
<interface>lan|opt[n]</interface>
<idletimeout>minutes</idletimeout>
<timeout>minutes</timeout>
<page>
<htmltext></htmltext>
<errtext></errtext>
</page>
<httpslogin/>
<httpsname></httpsname>
<redirurl></redirurl>
<radiusip></radiusip>
<radiusport></radiusport>
<radiuskey></radiuskey>
<nomacfilter/>
</captiveportal>
-->
<nat> <nat>
<outbound> <outbound>
<mode>automatic</mode> <mode>automatic</mode>
......
...@@ -37,7 +37,6 @@ require_once("legacy_bindings.inc"); ...@@ -37,7 +37,6 @@ require_once("legacy_bindings.inc");
require_once('upgrade_config.inc'); require_once('upgrade_config.inc');
require_once("certs.inc"); require_once("certs.inc");
/* make a global alias table (for faster lookups) */ /* make a global alias table (for faster lookups) */
function alias_make_table($config) function alias_make_table($config)
{ {
...@@ -98,11 +97,19 @@ function parse_config() ...@@ -98,11 +97,19 @@ function parse_config()
* null * null
******/ ******/
/* convert configuration, if necessary */ /* convert configuration, if necessary */
function convert_config() { function convert_config()
{
global $config, $g; global $config, $g;
$now = date("H:i:s");
log_error(sprintf(gettext("Start Configuration upgrade at %s, set execution timeout to 15 minutes"), $now)); if (!isset($config['revision'])) {
//ini_set("max_execution_time", "900"); /* force a revision tag for proper handling in config history */
write_config('Factory configuration', false);
}
if ($config['version'] == $g['latest_config']) {
/* already at latest version */
return;
}
/* special case upgrades */ /* special case upgrades */
/* fix every minute crontab bogons entry */ /* fix every minute crontab bogons entry */
...@@ -118,8 +125,6 @@ function convert_config() { ...@@ -118,8 +125,6 @@ function convert_config() {
} }
} }
} }
if ($config['version'] == $g['latest_config'])
return; /* already at latest version */
// Save off config version // Save off config version
$prev_version = $config['version']; $prev_version = $config['version'];
...@@ -134,11 +139,9 @@ function convert_config() { ...@@ -134,11 +139,9 @@ function convert_config() {
$config['version'] = sprintf('%.1f', $next / 10); $config['version'] = sprintf('%.1f', $next / 10);
} }
$now = date("H:i:s"); if ($prev_version != $config['version']) {
log_error(sprintf(gettext("Ended Configuration upgrade at %s"), $now));
if ($prev_version != $config['version'])
write_config(sprintf(gettext('Upgraded config version level from %1$s to %2$s'), $prev_version, $config['version'])); write_config(sprintf(gettext('Upgraded config version level from %1$s to %2$s'), $prev_version, $config['version']));
}
} }
...@@ -318,7 +321,10 @@ function set_device_perms() { ...@@ -318,7 +321,10 @@ function set_device_perms() {
} }
function make_config_revision_entry($desc = null, $override_user = null) { function make_config_revision_entry($desc = null, $override_user = null)
{
global $config;
if (empty($override_user)) { if (empty($override_user)) {
if (empty($_SESSION["Username"])) { if (empty($_SESSION["Username"])) {
$username = getenv("USER"); $username = getenv("USER");
...@@ -330,22 +336,26 @@ function make_config_revision_entry($desc = null, $override_user = null) { ...@@ -330,22 +336,26 @@ function make_config_revision_entry($desc = null, $override_user = null) {
if (!empty($_SERVER['REMOTE_ADDR'])) { if (!empty($_SERVER['REMOTE_ADDR'])) {
$username .= '@' . $_SERVER['REMOTE_ADDR']; $username .= '@' . $_SERVER['REMOTE_ADDR'];
} }
} } else {
else {
$username = $override_user; $username = $override_user;
} }
$revision = array(); $revision = array();
if (time() > mktime(0, 0, 0, 9, 1, 2004)) /* make sure the clock settings are plausible */ $revision['username'] = $username;
$revision['time'] = time(); $revision['time'] = time();
if ($revision['time'] == $config['revision']['time']) {
/* avoid conflicting timestamps (a second is long) */
$revision['time'] = intval($revision['time']) + 1;
}
if ($desc == null || $desc == 'Unknown') {
$revision['description'] = sprintf(gettext("%s made unknown change"), $_SERVER['SCRIPT_NAME']);
} else {
$revision['description'] = $desc;
}
/* Log the running script so it's not entirely unlogged what changed */
if ($desc == "Unknown")
$desc = sprintf(gettext("%s made unknown change"), $_SERVER['SCRIPT_NAME']);
if (!empty($desc))
$revision['description'] = "{$username}: " . $desc;
$revision['username'] = $username;
return $revision; return $revision;
} }
......
...@@ -162,6 +162,7 @@ if (is_install_media()) { ...@@ -162,6 +162,7 @@ if (is_install_media()) {
echo "Loading configuration..."; echo "Loading configuration...";
global $config; global $config;
$config = parse_config(); $config = parse_config();
convert_config();
echo "done.\n"; echo "done.\n";
/* /*
...@@ -177,11 +178,6 @@ if (is_interface_mismatch()) { ...@@ -177,11 +178,6 @@ if (is_interface_mismatch()) {
led_kitt(); led_kitt();
} }
/* convert config and clean backups */
echo "Updating configuration...";
convert_config();
echo "done.\n";
/* read in /etc/sysctl.conf and set values if needed */ /* read in /etc/sysctl.conf and set values if needed */
echo "Setting up extended sysctls..."; echo "Setting up extended sysctls...";
system_setup_sysctl(); system_setup_sysctl();
......
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