diff options
Diffstat (limited to 'FS/FS/part_export/domain_shellcommands.pm')
-rw-r--r-- | FS/FS/part_export/domain_shellcommands.pm | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/FS/FS/part_export/domain_shellcommands.pm b/FS/FS/part_export/domain_shellcommands.pm index cf56033..0ba5617 100644 --- a/FS/FS/part_export/domain_shellcommands.pm +++ b/FS/FS/part_export/domain_shellcommands.pm @@ -1,11 +1,60 @@ package FS::part_export::domain_shellcommands; use strict; -use vars qw(@ISA); +use vars qw(@ISA %info); +use Tie::IxHash; use FS::part_export; @ISA = qw(FS::part_export); +tie my %options, 'Tie::IxHash', + 'user' => { label=>'Remote username', default=>'root' }, + 'useradd' => { label=>'Insert command', + default=>'', + }, + 'userdel' => { label=>'Delete command', + default=>'', + }, + 'usermod' => { label=>'Modify command', + default=>'', + }, +; + +%info = ( + 'svc' => 'svc_domain', + '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 +<a href="../docs/ssh.html">setup SSH for unattended operation</a>. +<BR><BR>Use these buttons for some useful presets: +<UL> + <LI> + <INPUT TYPE="button" VALUE="qmail catchall .qmail-domain-default maintenance" onClick=' + 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): +<UL> + <LI><code>$domain</code> + <LI><code>$qdomain</code> - domain with periods replaced by colons + <LI><code>$uid</code> - of catchall account + <LI><code>$gid</code> - of catchall account + <LI><code>$dir</code> - home directory of catchall account + <LI>All other fields in + <a href="../docs/schema.html#svc_domain">svc_domain</a> are also available. +</UL> +END +); + sub rebless { shift; } sub _export_insert { @@ -97,7 +146,7 @@ sub shellcommands_queue { } sub ssh_cmd { #subroutine, not method - use Net::SSH '0.07'; + use Net::SSH '0.08'; &Net::SSH::ssh_cmd( { @_ } ); } @@ -108,3 +157,5 @@ sub ssh_cmd { #subroutine, not method #sub shellcommands_delete { #subroutine, not method #} +1; + |