sudoers fix

This commit is contained in:
Paolo Asperti 2016-09-15 00:29:58 +02:00
parent 9b9db0f626
commit cfe38a1321
3 changed files with 16 additions and 13 deletions

View File

@ -1,7 +1,7 @@
Summary: Helps client to join domain and maintain itself
Name: doraemon
Version: 2.0.0
Release: 1.ns6
Release: 2.ns6
URL: https://github.com/bglug-it/doraemon/
License: GPLv2+
Packager: Paolo Asperti <paolo@asperti.com>

View File

@ -1,6 +1,15 @@
#
# 50doraemon
#
srvmgr ALL=NOPASSWD: /bin/cat /home/amgmt/.ansible/vault.txt
{
$OUT = 'srvmgr ALL=NOPASSWD: /bin/cat ';
use esmith::ConfigDB;
my $confdb = esmith::ConfigDB->open;
my $backup = $confdb->get('doraemon') or die "No doraemon db entry found\n";
my $VaultPassFile = $backup->prop('VaultPassFile') || '/home/amgmt/.ansible/vault.txt';
my $ManagementKeyFile = $backup->prop('ManagementKeyFile') || '/home/amgmt/.ssh/id_rsa.pub';
my $DomainFile = $backup->prop('DomainFile') || '/etc/domain.yml';
$OUT = 'srvmgr ALL=NOPASSWD: /bin/cat ' . $VaultPassFile . '
srvmgr ALL=NOPASSWD: /bin/cat ' . $ManagementKeyFile .'
srvmgr ALL=NOPASSWD: /bin/cat ' . $DomainFile;
}

View File

@ -125,19 +125,13 @@ function pingHost($host, $timeout=1) {
function ROUTE_domain() {
global $config_db;
$theFile = $config_db->getProp(CONFIG_KEY,'DomainFile');
$content = file_get_contents($theFile);
if (false !== $content) {
echo $content;
}
passthru("/usr/bin/sudo /bin/cat $theFile");
}
function ROUTE_mgmtkey() {
global $config_db;
$theFile = $config_db->getProp(CONFIG_KEY,'ManagementKeyFile');
$content = file_get_contents($theFile);
if (false !== $content) {
echo $content;
}
passthru("/usr/bin/sudo /bin/cat $theFile");
}
function ROUTE_epoptes_srv() {