3 # $Id: freeside-adduser,v 1.8 2002-09-27 05:36:29 ivan Exp $
6 use vars qw($opt_h $opt_b $opt_c $opt_s);
10 my $FREESIDE_CONF = "/usr/local/etc/freeside";
13 die &usage if $opt_c && ! $opt_h;
14 my $user = shift or die &usage;
17 my @args = ( 'htpasswd' );
18 push @args, '-b' if $opt_b;
19 push @args, '-c' if $opt_c;
20 push @args, $opt_h, $user;
21 push @args, shift if $opt_b;
22 system(@args) == 0 or die "htpasswd failed: $?";
25 my $secretfile = $opt_s || 'secrets';
27 open(MAPSECRETS,">>$FREESIDE_CONF/mapsecrets")
28 and flock(MAPSECRETS,LOCK_EX)
29 or die "can't open $FREESIDE_CONF/mapsecrets: $!";
30 print MAPSECRETS "$user $secretfile\n";
31 close MAPSECRETS or die "can't close $FREESIDE_CONF/mapsecrets: $!";
34 die "Usage:\n\n freeside-adduser [ -h htpasswd_file [ -c ] [ -b ] ] [ -s secretfile ] username"
39 freeside-adduser - Command line interface to add (freeside) users.
43 freeside-adduser [ -h htpasswd_file [ -c ] ] [ -s secretfile ] username
47 Adds a user to the Freeside billing system. This is for adding users (internal
48 sales/tech folks) to the web interface, not for adding customer accounts.
50 -h: Also call htpasswd for this user with the given filename
52 -c: Passed to htpasswd(1)
54 -s: Specify an alternate secret file
56 -b: same as htpasswd(1), probably insecure, not recommended
60 L<htpasswd>(1), base Freeside documentation