diff options
author | ivan <ivan> | 2004-03-25 08:55:09 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-03-25 08:55:09 +0000 |
commit | e53cf6b04ea8c6f10c331d46372c486128478df0 (patch) | |
tree | a0e7e31862cec2fa4cd4b91b49021526fed82947 /FS/FS/part_export | |
parent | cb3d16defa2515e178290fad49caaebcd8a05bf6 (diff) |
first pass at ISPMan integration
Diffstat (limited to 'FS/FS/part_export')
-rw-r--r-- | FS/FS/part_export/domain_shellcommands.pm | 7 | ||||
-rw-r--r-- | FS/FS/part_export/forward_shellcommands.pm | 6 | ||||
-rw-r--r-- | FS/FS/part_export/shellcommands.pm | 10 | ||||
-rw-r--r-- | FS/FS/part_export/shellcommands_withdomain.pm | 16 | ||||
-rw-r--r-- | FS/FS/part_export/www_shellcommands.pm | 30 |
5 files changed, 60 insertions, 9 deletions
diff --git a/FS/FS/part_export/domain_shellcommands.pm b/FS/FS/part_export/domain_shellcommands.pm index d8ae0c376..914589529 100644 --- a/FS/FS/part_export/domain_shellcommands.pm +++ b/FS/FS/part_export/domain_shellcommands.pm @@ -22,7 +22,7 @@ tie my %options, 'Tie::IxHash', %info = ( 'svc' => 'svc_domain', - 'desc' => 'Run remote commands via SSH, for domains.', + 'desc' => 'Run remote commands via SSH, for domains (qmail, ISPMan).', 'options' => \%options, 'notes' => <<'END' Run remote commands via SSH, for domains. You will need to @@ -34,6 +34,11 @@ Run remote commands via SSH, for domains. You will need to this.form.useradd.value = "[ \"$uid\" -a \"$gid\" -a \"$dir\" -a \"$qdomain\" ] && [ -e $dir/.qmail-$qdomain-default ] || { touch $dir/.qmail-$qdomain-default; chown $uid:$gid $dir/.qmail-$qdomain-default; }"; this.form.userdel.value = ""; this.form.usermod.value = ""; + <LI> + <INPUT TYPE="button" VALUE="ISPMan CLI" onClick=' + this.form.useradd.value = "/usr/local/ispman/bin/ispman.addDomain -d $domain changeme"; + this.form.userdel.value = "/usr/local/ispman/bin/ispman.deleteDomain -d $domain"; + this.form.usermod.value = ""; '> </UL> The following variables are available for interpolation (prefixed with <code>new_</code> or <code>old_</code> for replace operations): diff --git a/FS/FS/part_export/forward_shellcommands.pm b/FS/FS/part_export/forward_shellcommands.pm index 6908214d5..fe304350c 100644 --- a/FS/FS/part_export/forward_shellcommands.pm +++ b/FS/FS/part_export/forward_shellcommands.pm @@ -35,6 +35,12 @@ Run remote commands via SSH, for forwards. You will need to this.form.userdel.value = "rm /home/vpopmail/domains/$domain/$username/.qmail"; this.form.usermod.value = "mv /home/vpopmail/domains/$old_domain/$old_username/.qmail /home/vpopmail/domains/$new_domain/$new_username; [ \"$old_destination\" != \"$new_destination\" ] && { echo \"$new_destination\" > /home/vpopmail/domains/$new_domain/$new_username/.qmail; chown vpopmail:vchkpw /home/vpopmail/domains/$new_domain/$new_username/.qmail; }"; '> + <LI> + <INPUT TYPE="button" VALUE="ISPMan CLI" onClick=' + this.form.useradd.value = ""; + this.form.userdel.value = ""; + this.form.usermod.value = ""; + '> </UL> The following variables are available for interpolation (prefixed with <code>new_</code> or <code>old_</code> for replace operations): diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm index 0fc0cc9c6..1af5bb348 100644 --- a/FS/FS/part_export/shellcommands.pm +++ b/FS/FS/part_export/shellcommands.pm @@ -148,6 +148,8 @@ old_ for replace operations): <LI><code>$uid</code> <LI><code>$gid</code> <LI><code>$finger</code> - GECOS, already quoted for the shell (do not add additional quotes) + <LI><code>$first</code> - First name of GECOS, already quoted for the shell (do not add additional quotes) + <LI><code>$last</code> - Last name of GECOS, already quoted for the shell (do not add additional quotes) <LI><code>$dir</code> - home directory <LI><code>$shell</code> <LI><code>$quota</code> @@ -206,6 +208,10 @@ sub _export_command { $email = ''; } + $finger =~ /^(.*)\s+(\S+)$/ or $finger =~ /^((.*))$/; + ($first, $last ) = ( $1, $2 ); + $first = shell_quote $first; + $last = shell_quote $last; $finger = shell_quote $finger; $quoted_password = shell_quote $_password; $domain = $svc_acct->domain; @@ -239,6 +245,10 @@ sub _export_replace { ${"old_$_"} = $old->getfield($_) foreach $old->fields; ${"new_$_"} = $new->getfield($_) foreach $new->fields; } + $new_finger =~ /^(.*)\s+(\S+)$/ or $finger =~ /^((.*))$/; + ($new_first, $new_last ) = ( $1, $2 ); + $new_first = shell_quote $new_first; + $new_last = shell_quote $new_last; $new_finger = shell_quote $new_finger; $quoted_new__password = shell_quote $new__password; #old, wrong? $new_quoted_password = shell_quote $new__password; #new, better? diff --git a/FS/FS/part_export/shellcommands_withdomain.pm b/FS/FS/part_export/shellcommands_withdomain.pm index 9dab281fc..8a56bab1c 100644 --- a/FS/FS/part_export/shellcommands_withdomain.pm +++ b/FS/FS/part_export/shellcommands_withdomain.pm @@ -48,7 +48,7 @@ tie my %options, 'Tie::IxHash', %info = ( 'svc' => 'svc_acct', - 'desc' => 'Real-time export via remote SSH (vpopmail, etc.)', + 'desc' => 'Real-time export via remote SSH (vpopmail, ISPMan)', 'options' => \%options, 'notes' => <<'END' Run remote commands via SSH. username@domain (rather than just usernames) are @@ -62,11 +62,21 @@ the same username with different domains. You will need to <LI><INPUT TYPE="button" VALUE="vpopmail" onClick=' this.form.useradd.value = "/home/vpopmail/bin/vadduser $username\\\@$domain $quoted_password"; this.form.useradd_stdin.value = ""; - this.form.userdel.value = "/home/vpopmail/bin/vdeluser $username\\\@$domain"; this.form.userdel_stdin.value=""; + this.form.userdel.value = "/home/vpopmail/bin/vdeluser $username\\\@$domain"; + this.form.userdel_stdin.value=""; this.form.usermod.value = "/home/vpopmail/bin/vpasswd $new_username\\\@$new_domain $new_quoted_password"; this.form.usermod_stdin.value = ""; this.form.usermod_pwonly.checked = true; '> + <LI><INPUT TYPE="button" VALUE="ISPMan CLI" onClick=' + this.form.useradd.value = "/usr/local/ispman/bin/ispman.addUser -d $domain -f $first -l $last -q $quota -p $quoted_password $username"; + this.form.useradd_stdin.value = ""; + this.form.userdel.value = "/usr/local/ispman/bin/ispman.delUser -d $domain $username"; + this.form.userdel_stdin.value=""; + this.form.usermod.value = "/usr/local/ispman/bin/ispman.passwd.user $username\\\@$domain $new_quoted_password"; + this.form.usermod_stdin.value = ""; + this.form.usermod_pwonly.checked = true; + '> </UL> The following variables are available for interpolation (prefixed with @@ -80,6 +90,8 @@ The following variables are available for interpolation (prefixed with <LI><code>$uid</code> <LI><code>$gid</code> <LI><code>$finger</code> - GECOS, already quoted for the shell (do not add additional quotes) + <LI><code>$first</code> - First name of GECOS, already quoted for the shell (do not add additional quotes) + <LI><code>$last</code> - Last name of GECOS, already quoted for the shell (do not add additional quotes) <LI><code>$dir</code> - home directory <LI><code>$shell</code> <LI><code>$quota</code> diff --git a/FS/FS/part_export/www_shellcommands.pm b/FS/FS/part_export/www_shellcommands.pm index cc1983bf2..a272edab0 100644 --- a/FS/FS/part_export/www_shellcommands.pm +++ b/FS/FS/part_export/www_shellcommands.pm @@ -27,10 +27,28 @@ tie my %options, 'Tie::IxHash', 'notes' => <<'END' Run remote commands via SSH, for virtual web sites. You will need to <a href="../docs/ssh.html">setup SSH for unattended operation</a>. -<BR><BR>The following variables are available for interpolation (prefixed with +<BR><BR>Use these buttons for some useful presets: +<UL> + <LI> + <INPUT TYPE="button" VALUE="Maintain directories" onClick' + this.form.user.value = "root"; + this.form.useradd.value = "mkdir /var/www/$zone; chown $username /var/www/$zone; ln -s /var/www/$zone $homedir/$zone"; + this.form.userdel.value = "[ -n "$zone" ] && rm -rf /var/www/$zone; rm $homedir/$zone"; + this.form.usermod.value = "[ -n "$old_zone" ] && rm $old_homedir/$old_zone; [ "$old_zone" != "$new_zone" -a -n "$new_zone" ] && mv /var/www/$old_zone /var/www/$new_zone; [ "$old_username" != "$new_username" ] && chown -R $new_username /var/www/$new_zone; ln -s /var/www/$new_zone $new_homedir/$new_zone"; + '> + <LI> + <INPUT TYPE="button" VALUE="ISPMan CLI" onClick' + this.form.user.value = "root"; + this.form.useradd.value = "/usr/local/ispman/ispman.addvhost -d $domain $zone"; + this.form.userdel.value = "/usr/local/ispman/idpman.deletevhost -d $domain $zone"; + this.form.usermod.value = ""; + '> +</UL> +The following variables are available for interpolation (prefixed with <code>new_</code> or <code>old_</code> for replace operations): <UL> - <LI><code>$zone</code> + <LI><code>$zone</code> - fully-qualified zone of this virtual host + <LI><code>$domain</code> - base domain <LI><code>$username</code> <LI><code>$homedir</code> <LI>All other fields in <a href="../docs/schema.html#svc_www">svc_www</a> @@ -64,6 +82,7 @@ sub _export_command { } my $domain_record = $svc_www->domain_record; # or die ? my $zone = $domain_record->zone; # or die ? + my $domain = $domain_record->svc_domain->domain; my $svc_acct = $svc_www->svc_acct; # or die ? my $username = $svc_acct->username; my $homedir = $svc_acct->dir; # or die ? @@ -90,10 +109,8 @@ sub _export_replace { } my $old_domain_record = $old->domain_record; # or die ? my $old_zone = $old_domain_record->reczone; # or die ? - unless ( $old_zone =~ /\.$/ ) { - my $old_svc_domain = $old_domain_record->svc_domain; # or die ? - $old_zone .= '.'. $old_svc_domain->domain; - } + my $old_domain = $old_domain_record->svc_domain->domain; + $old_zone .= ".$old_domain" unless $old_zone =~ /\.$/; my $old_svc_acct = $old->svc_acct; # or die ? my $old_username = $old_svc_acct->username; @@ -101,6 +118,7 @@ sub _export_replace { my $new_domain_record = $new->domain_record; # or die ? my $new_zone = $new_domain_record->reczone; # or die ? + my $new_domain = $new_domain_record->svc_domain->domain; unless ( $new_zone =~ /\.$/ ) { my $new_svc_domain = $new_domain_record->svc_domain; # or die ? $new_zone .= '.'. $new_svc_domain->domain; |