1 package FS::part_export::shellcommands_withdomain;
3 use vars qw(@ISA %info);
5 use FS::part_export::shellcommands;
7 @ISA = qw(FS::part_export::shellcommands);
9 tie my %options, 'Tie::IxHash',
10 'user' => { label=>'Remote username', default=>'root' },
11 'useradd' => { label=>'Insert command',
14 'useradd_stdin' => { label=>'Insert command STDIN',
16 #default=>"$_password\n$_password\n",
18 'useradd_no_queue' => { label => 'Run immediately',
21 'userdel' => { label=>'Delete command',
24 'userdel_stdin' => { label=>'Delete command STDIN',
28 'userdel_no_queue' => { label => 'Run immediately',
31 'usermod' => { label=>'Modify command',
34 'usermod_stdin' => { label=>'Modify command STDIN',
36 #default=>"$_password\n$_password\n",
38 'usermod_no_queue' => { label => 'Run immediately',
41 'usermod_pwonly' => { label=>'Disallow username, domain, uid, dir and RADIUS group changes',
44 'usermod_nousername' => { label=>'Disallow just username changes',
47 'suspend' => { label=>'Suspension command',
50 'suspend_stdin' => { label=>'Suspension command STDIN',
53 'suspend_no_queue' => { label => 'Run immediately',
56 'unsuspend' => { label=>'Unsuspension command',
59 'unsuspend_stdin' => { label=>'Unsuspension command STDIN',
62 'unsuspend_no_queue' => { label => 'Run immediately',
65 'crypt' => { label => 'Default password encryption',
66 type=>'select', options=>[qw(crypt md5)],
70 label => 'Treat any output from the command as an error',
73 'ignore_all_errors' => {
74 label => 'Ignore all errors from the command',
77 'ignored_errors' => { label => 'Regexes of specific errors to ignore, separated by newlines',
84 'desc' => 'Real-time export via remote SSH (vpopmail, ISPMan, MagicMail)',
85 'options' => \%options,
88 Run remote commands via SSH. username@domain (rather than just usernames) are
89 considered unique (also see shellcommands). You probably want this if the
90 commands you are running will accept a domain as a parameter, and will allow
91 the same username with different domains. You will need to
92 <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.9:Documentation:Administration:SSH_Keys">setup SSH for unattended operation</a>.
94 <BR><BR>Use these buttons for some useful presets:
96 <LI><INPUT TYPE="button" VALUE="vpopmail" onClick='
97 this.form.useradd.value = "/home/vpopmail/bin/vadduser $username\\\@$domain $quoted_password";
98 this.form.useradd_stdin.value = "";
99 this.form.userdel.value = "/home/vpopmail/bin/vdeluser $username\\\@$domain";
100 this.form.userdel_stdin.value="";
101 this.form.usermod.value = "/home/vpopmail/bin/vpasswd $new_username\\\@$new_domain $new_quoted_password";
102 this.form.usermod_stdin.value = "";
103 this.form.usermod_pwonly.checked = true;
105 <LI><INPUT TYPE="button" VALUE="ISPMan CLI" onClick='
106 this.form.useradd.value = "/usr/local/ispman/bin/ispman.addUser -d $domain -f $first -l $last -q $quota -p $quoted_password $username";
107 this.form.useradd_stdin.value = "";
108 this.form.userdel.value = "/usr/local/ispman/bin/ispman.delUser -d $domain $username";
109 this.form.userdel_stdin.value="";
110 this.form.usermod.value = "/usr/local/ispman/bin/ispman.passwd.user $new_username\\\@$new_domain $new_quoted_password";
111 this.form.usermod_stdin.value = "";
112 this.form.usermod_pwonly.checked = true;
114 <LI><INPUT TYPE="button" VALUE="MagicMail" onClick='
115 this.form.useradd.value = "/usr/bin/mm_create_email_service -e $svcnum -d $domain -u $username -p $quoted_password -f $first -l $last -m $svcnum -g EMAIL";
116 this.form.useradd_stdin.value = "";
117 this.form.useradd_no_queue.checked = 1;
118 this.form.userdel.value = "/usr/bin/mm_delete_user -e ${username}\\\@${domain}";
119 this.form.userdel_stdin.value = "";
120 this.form.suspend.value = "/usr/bin/mm_suspend_user -e ${username}\\\@${domain}";
121 this.form.suspend_stdin.value = "";
122 this.form.unsuspend.value = "/usr/bin/mm_activate_user -e ${username}\\\@${domain}";
123 this.form.unsuspend_stdin.value = "";
127 The following variables are available for interpolation (prefixed with
128 <code>new_</code> or <code>old_</code> for replace operations):
130 <LI><code>$username</code>
131 <LI><code>$domain</code>
132 <LI><code>$_password</code>
133 <LI><code>$quoted_password</code> - unencrypted password, already quoted for the shell (do not add additional quotes)
134 <LI><code>$crypt_password</code> - encrypted password, already quoted for the shell (do not add additional quotes)
135 <LI><code>$uid</code>
136 <LI><code>$gid</code>
137 <LI><code>$finger</code> - GECOS, already quoted for the shell (do not add additional quotes)
138 <LI><code>$first</code> - First name of GECOS, already quoted for the shell (do not add additional quotes)
139 <LI><code>$last</code> - Last name of GECOS, already quoted for the shell (do not add additional quotes)
140 <LI><code>$dir</code> - home directory
141 <LI><code>$shell</code>
142 <LI><code>$quota</code>
143 <LI><code>@radius_groups</code>
144 <LI><code>$reasonnum (when suspending)</code>
145 <LI><code>$reasontext (when suspending)</code>
146 <LI><code>$reasontypenum (when suspending)</code>
147 <LI><code>$reasontypetext (when suspending)</code>
148 <LI><code>$pkgnum</code>
149 <LI><code>$custnum</code>
150 <LI>All other fields in <b>svc_acct</b> are also available.
151 <LI>The following fields from <b>cust_main</b> are also available (except during replace): company, address1, address2, city, state, zip, county, daytime, night, fax, otaker, agent_custid, locale. When used on the command line (rather than STDIN), they will be quoted for the shell already (do not add additional quotes).
153 For the package changed command only, the following fields are also available:
155 <LI>$old_pkgnum and $new_pkgnum
156 <LI>$old_pkgpart and $new_pkgpart
157 <LI>$old_agent_pkgid and $new_agent_pkgid
158 <LI>$old_order_date and $new_order_date
159 <LI>$old_start_date and $new_start_date
160 <LI>$old_setup and $new_setup
161 <LI>$old_bill and $new_bill
162 <LI>$old_last_bill and $new_last_bill
163 <LI>$old_susp and $new_susp
164 <LI>$old_adjourn and $new_adjourn
165 <LI>$old_resume and $new_resume
166 <LI>$old_cancel and $new_cancel
167 <LI>$old_unancel and $new_unancel
168 <LI>$old_expire and $new_expire
169 <LI>$old_contract_end and $new_contract_end