diff -Nur e-smith-nutUPS-2.4.0.old8826/root/etc/e-smith/db/configuration/defaults/nut/AdminUser e-smith-nutUPS-2.4.0.bz8826/root/etc/e-smith/db/configuration/defaults/nut/AdminUser --- e-smith-nutUPS-2.4.0.old8826/root/etc/e-smith/db/configuration/defaults/nut/AdminUser 1970-01-01 01:00:00.000000000 +0100 +++ e-smith-nutUPS-2.4.0.bz8826/root/etc/e-smith/db/configuration/defaults/nut/AdminUser 2015-02-02 22:07:53.832289812 +0100 @@ -0,0 +1 @@ +disabled diff -Nur e-smith-nutUPS-2.4.0.old8826/root/etc/e-smith/db/configuration/migrate/nutPass e-smith-nutUPS-2.4.0.bz8826/root/etc/e-smith/db/configuration/migrate/nutPass --- e-smith-nutUPS-2.4.0.old8826/root/etc/e-smith/db/configuration/migrate/nutPass 2015-02-02 22:01:00.390892204 +0100 +++ e-smith-nutUPS-2.4.0.bz8826/root/etc/e-smith/db/configuration/migrate/nutPass 2015-02-02 22:06:52.485631128 +0100 @@ -4,4 +4,5 @@ my $nutrec = $DB->get('nut') || $DB->new_record('nut', {type => 'service'}); $nutrec->set_prop('MasterPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('MasterPass'); $nutrec->set_prop('SlavePass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('SlavePass'); + $nutrec->set_prop('AdminPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('AdminPass'); } diff -Nur e-smith-nutUPS-2.4.0.old8826/root/etc/e-smith/templates/etc/hosts.allow/upsd_admin_privileges e-smith-nutUPS-2.4.0.bz8826/root/etc/e-smith/templates/etc/hosts.allow/upsd_admin_privileges --- e-smith-nutUPS-2.4.0.old8826/root/etc/e-smith/templates/etc/hosts.allow/upsd_admin_privileges 1970-01-01 01:00:00.000000000 +0100 +++ e-smith-nutUPS-2.4.0.bz8826/root/etc/e-smith/templates/etc/hosts.allow/upsd_admin_privileges 2015-02-07 10:41:37.038033536 +0100 @@ -0,0 +1,11 @@ +{ +return "# The upsd admin is not allowed" if ($nut{AdminUser} ne 'enabled'); +return "# The upsd admin has no password" if (($nut{AdminPass} || '') eq ''); +return "# The upsd admin is not allowed when nut access is set to public" if $nut{access} eq 'public'; + +my $upsd = $DB->hosts_allow_spec('nut','upsd'); +$upsd =~ s|upsd:|upsd: admin op |; + +$OUT .= qq(#Allow the Admin User of upsd +$upsd : ALLOW) if ($nut{status} eq 'enabled'); +} diff -Nur e-smith-nutUPS-2.4.0.old8826/root/etc/e-smith/templates/etc/ups/upsd.users/upsd_administrative_privileges e-smith-nutUPS-2.4.0.bz8826/root/etc/e-smith/templates/etc/ups/upsd.users/upsd_administrative_privileges --- e-smith-nutUPS-2.4.0.old8826/root/etc/e-smith/templates/etc/ups/upsd.users/upsd_administrative_privileges 1970-01-01 01:00:00.000000000 +0100 +++ e-smith-nutUPS-2.4.0.bz8826/root/etc/e-smith/templates/etc/ups/upsd.users/upsd_administrative_privileges 2015-02-03 18:30:18.317396319 +0100 @@ -0,0 +1,14 @@ +{ + # create admin user for upsd to allow setting of + # UPS parameters via upsrw + + $OUT .= ""; + return unless (($nut{AdminUser} || 'disabled') eq 'enabled'); + return unless (($nut{AdminPass} || '') ne ''); + + $OUT .= "\n"; + $OUT .= " [admin]\n"; + $OUT .= " password = $nut{AdminPass}\n"; + $OUT .= " actions = set\n"; + $OUT .= " instcmds = all\n"; +}