Commit c9e2802f authored by Franco Fichtner's avatar Franco Fichtner

system: consolidate previous

* system_console_configure() is really system_login_configure()+
* make a template for sudoers config setting
* move auth template generation to single spot

(cherry picked from commit 2d450939)
(cherry picked from commit 24368104)
parent 526779bb
...@@ -618,6 +618,8 @@ ...@@ -618,6 +618,8 @@
/usr/local/opnsense/service/modules/processhandler.py /usr/local/opnsense/service/modules/processhandler.py
/usr/local/opnsense/service/modules/template.py /usr/local/opnsense/service/modules/template.py
/usr/local/opnsense/service/run_unittests.py /usr/local/opnsense/service/run_unittests.py
/usr/local/opnsense/service/templates/OPNsense/Auth/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/Auth/sudoers
/usr/local/opnsense/service/templates/OPNsense/Captiveportal/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Captiveportal/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/Captiveportal/captiveportal.conf /usr/local/opnsense/service/templates/OPNsense/Captiveportal/captiveportal.conf
/usr/local/opnsense/service/templates/OPNsense/Captiveportal/lighttpd-api-dispatcher.conf /usr/local/opnsense/service/templates/OPNsense/Captiveportal/lighttpd-api-dispatcher.conf
......
...@@ -1870,17 +1870,11 @@ function system_console_types() ...@@ -1870,17 +1870,11 @@ function system_console_types()
); );
} }
function system_console_configure() function system_login_configure()
{ {
global $config; global $config;
$sudo_conf = '/usr/local/etc/sudoers.d/opnsense'; configd_run('template reload OPNsense.Auth');
if (!empty($config['system']['sudo_allow_wheel'])) {
file_put_contents($sudo_conf, "%wheel ALL=(ALL) ALL\n");
} else {
@unlink($sudo_conf);
}
$serialspeed = (!empty($config['system']['serialspeed']) && is_numeric($config['system']['serialspeed'])) ? $config['system']['serialspeed'] : '115200'; $serialspeed = (!empty($config['system']['serialspeed']) && is_numeric($config['system']['serialspeed'])) ? $config['system']['serialspeed'] : '115200';
$serial_enabled = isset($config['system']['enableserial']); $serial_enabled = isset($config['system']['enableserial']);
......
...@@ -69,8 +69,8 @@ set_device_perms(); ...@@ -69,8 +69,8 @@ set_device_perms();
unmute_kernel_msgs(); unmute_kernel_msgs();
echo "done.\n"; echo "done.\n";
/* configure console menu */ /* configure login behaviour */
system_console_configure(); system_login_configure();
$setup_installer = is_install_media(); $setup_installer = is_install_media();
if ($setup_installer) { if ($setup_installer) {
......
...@@ -43,4 +43,4 @@ require_once 'system.inc'; ...@@ -43,4 +43,4 @@ require_once 'system.inc';
convert_config(true); convert_config(true);
system_firmware_configure(); system_firmware_configure();
system_console_configure(); system_login_configure();
...@@ -45,7 +45,7 @@ $config = parse_config(); ...@@ -45,7 +45,7 @@ $config = parse_config();
log_error("rc.reload_all: Reloading all configuration settings."); log_error("rc.reload_all: Reloading all configuration settings.");
system_firmware_configure(); system_firmware_configure();
system_console_configure(); system_login_configure();
system_timezone_configure(); system_timezone_configure();
system_hostname_configure(); system_hostname_configure();
system_hosts_generate(); system_hosts_generate();
......
sudoers:/usr/local/etc/sudoers.d/opnsense
{% if system.sudo_allow_wheel|default('0') == '1' %}
%wheel ALL=(ALL) ALL
{% endif %}
...@@ -243,7 +243,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -243,7 +243,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$savemsg .= sprintf("<br />" . gettext("One moment...redirecting to %s in 20 seconds."), $url); $savemsg .= sprintf("<br />" . gettext("One moment...redirecting to %s in 20 seconds."), $url);
} }
system_console_configure(); system_login_configure();
system_hosts_generate(); system_hosts_generate();
services_dhcpleases_configure(); services_dhcpleases_configure();
services_dnsmasq_configure(false); services_dnsmasq_configure(false);
......
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