no options in lamdaemon.pl anymore

This commit is contained in:
katagia 2003-09-20 13:59:13 +00:00
parent 3794485199
commit f12bb6ca98
3 changed files with 17 additions and 35 deletions

View File

@ -8,14 +8,8 @@ thins to get it work.
(e.g. 127.0.0.1)
* Path to lamdaemon.pl, e.g. /srv/www/htdocs/lam/lib/lamdaemon.pl
2. Set up SSH
I don't know if this step is really needed but I had some
problems using Net::SSH without keys.
* Log in on remote host as $admin
* run "ssh-keygen -t dsa" to create all needed keys
if not yet done
3. Set up sudo
2. Set up sudo
The perlskript has to run as root (very ugly I know but
I haven't found any other solution). Therefor we need
a wrapper, sudo.
@ -31,8 +25,8 @@ thins to get it work.
This can be done by adding the following line:
Defaults:$admin !syslog
4. Set up perl
We need some external perl-modules, Quota and Net::LDAP
3. Set up perl
We need some external perl-modules, Quota and Net::SSH::Perl
Th install them, run:
perl -MCPAN -e shell
install Quota
@ -40,7 +34,7 @@ thins to get it work.
Please answer all questions to describe your system
Every additional needed module should be installed
automaticly
LDAP isn't used in perl anymore
LDAP isn't used by lamdaemon.pl anymore
I installed Math::Pari, a needed module, by hand.
I had many problems to install Math::Pari, a module needed
@ -55,9 +49,7 @@ thins to get it work.
* run make
* run make install
5. Set up lamdaemon.pl
Make all needed changes in lamdaemon.pl
Now everything should work fine
This is a very incomplete Documention for Alpha-Release only.

View File

@ -178,8 +178,7 @@ function getquotas($type,$user='+') { // Whis function will return the quotas fr
$towrite = $ldap_q[0].' '.$ldap_q[1].' '.$user.' quota get ';
if ($type=='user') $towrite = $towrite.'u';
else $towrite = $towrite.'g';
//exec("/usr/bin/ssh ".$_SESSION['config']->scriptServer." sudo ".$_SESSION['config']->scriptPath." $towrite", $vals);
exec("perl ".$_SESSION['config']->scriptPath." $towrite", $vals, $status);
exec("perl ../../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals, $status);
$vals = explode(':', $vals[0]);
for ($i=0; $i<sizeof($vals); $i++) {
$vals2 = explode(',', $vals[$i]);
@ -211,7 +210,7 @@ function setquotas($values,$type,$values_old=false) { // Whis function will set
}
$i++;
}
if ($i!=0) exec($_SESSION['config']->scriptPath." $towrite", $vals);
if ($i!=0) exec("perl ../../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
}
function remquotas($user, $type) { // Whis function will remove the quotas from the specified user.
@ -221,7 +220,7 @@ function remquotas($user, $type) { // Whis function will remove the quotas from
$towrite = $ldap_q[0].' '.$ldap_q[1].' '.$user.' quota set ';
if ($type=='user') $towrite = $towrite.'u ';
else $towrite = $towrite.'g ';
exec($_SESSION['config']->scriptPath." $towrite", $vals);
exec("perl ../../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
}
@ -230,7 +229,7 @@ function addhomedir($user) { // Create Homedirectory
// all other needed vars are taken from remotesystem getusrnam
$ldap_q = $_SESSION['ldap']->decrypt();
$towrite = $ldap_q[0].' '.$ldap_q[1].' '.$user.' home add';
exec($_SESSION['config']->scriptPath." $towrite", $vals);
exec("perl ../../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
}
function remhomedir($user) { // Remove Homedirectory
@ -238,7 +237,7 @@ function remhomedir($user) { // Remove Homedirectory
// all other needed vars are taken from remotesystem getusrnam
$ldap_q = $_SESSION['ldap']->decrypt();
$towrite = $ldap_q[0].' '.$ldap_q[1].' '.$user.' home rem';
exec($_SESSION['config']->scriptPath." $towrite", $vals);
exec("perl ../../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
}
function ldapreload($type) { // This function will load an array th cache ldap-requests

View File

@ -21,19 +21,8 @@
#
#
# LDAP Account Manager daemon to create and delete homedirecotries and quotas
######################################################
# Configure-Options
# change only variables starting from here
$server_ssh="127.0.0.1"; # IP or DNS of host to create homedirs, quota, ....
$server_ssh_ident = "/var/lib/wwwrun/.ssh/id_dsa"; # SSH-Key to use
$path = "/srv/www/htdocs/lam/lib/lamdaemon.pl"; # path to ldap on remote-host
$debug=true; # Show debug messages
# Don't change anything below this line
############################################################
use Quota; # Needed to get and set quotas
#use strict; # Use strict for security reasons
@ -192,14 +181,16 @@ if ($( == 0 ) {
print "$return\n";
}
else {
$hostname = shift @ARGV;
$remotepath = shift @ARGV;
use Net::SSH::Perl;
@username = split (',', $vals[0]);
@username = split (',', $ARGV[0]);
$username[0] =~ s/uid=//;
my $ssh = Net::SSH::Perl->new($server_ssh, options=>[
"IdentityFile $server_ssh_ident",
my $ssh = Net::SSH::Perl->new($hostname, options=>[
"IdentityFile /var/lib/wwwrun/.ssh/id_dsa",
"UserKnownHostsFile /dev/null"
]);
$ssh->login($username[0], $vals[1]);
($stdout, $stderr, $exit) = $ssh->cmd("sudo $path @ARGV");
$ssh->login($username[0], $ARGV[1]);
($stdout, $stderr, $exit) = $ssh->cmd("sudo $remotepath @ARGV");
print "$stdout";
}