[Spacewalk-list] Spacewalk web portal and ldap authentication

Brandon Perkins bperkins at redhat.com
Wed Apr 21 20:12:50 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Hooker, Jonathan wrote:
> Brandon,
> 
> Do you maybe have an example of that script that I could use as a starting point? Thanks!
> 
> Jonathan Hooker
> Desktop Support - Engineering
> Garmin International
> jonathan.hooker at garmin.com
> 
> -----Original Message-----
> From: spacewalk-list-bounces at redhat.com [mailto:spacewalk-list-bounces at redhat.com] On Behalf Of Brandon Perkins
> Sent: Tuesday, April 20, 2010 10:47 AM
> To: spacewalk-list at redhat.com
> Subject: Re: [Spacewalk-list] Spacewalk web portal and ldap authentication
> 
> 
> 
> Colin Coe wrote:
>> http://www.redhat.com/docs/en-US/Red_Hat_Network_Satellite/5.3/Installation_Guide/html/s1-maintenance-pam-auth.html
> 
>> You still need to 'create' the users in Spacewalk/Satellite and tick
>> the 'Use PAM' checkbox.
> 
>> CC
> 
> 
> Or, I *strongly* suggest using the frontend API to create these users:
> 
> http://www.redhat.com/docs/en-US/Red_Hat_Network_Satellite/5.3/API_Overview/html/handlers/UserHandler.html#create
> 
> When I need to create a bunch of users, I have a rudimentary perl script
> that takes all of the parameters as arguments, then I just have some fun
> with ypcat passwd, sed, awk, etc. and pipe through bash to get all my
> users created.  Way better than doing the web interface if you have ten
> or more users to create.  You just need to make sure to set:
> 
>         #  int usePamAuth - 1 if you wish to use PAM authentication for this
> user, 0 otherwise.
> 
> Thanks.
> Brandon

_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list

-
--------------------------------------------------------------------------------
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient. If you are not the intended
recipient, please be aware that any disclosure, copying, distribution or
use of this e-mail or any attachment is prohibited. If you have received
this e-mail in error, please contact the sender and delete all copies.

Thank you for your cooperation.

Very rudimentary, but here it is (APIHelper.pm is attached):

===================
#!/usr/bin/perl -w

use warnings;
use strict;

use English;
use Getopt::Long;
use Frontier::Client;
use APIHelper qw/get_frontier_connection/;

my $host        = 'https://satellite.example.com';
my $user        = 'spacewalkadmin';
my $password    = 'adminpassword';
my $target_user = '';
my $target_pass = '';
my $fname       = '';
my $lname       = '';
my $email       = '';

my $usage = <<EOF;
Usage: $PROGRAM_NAME --host HOSTNAME --user USERNAME --password PASSWORD
- --target TARGET_USERNAME --targetpass TARGET_PASSWORD --fname FIRST_NAME
- --lname LAST_NAME --email EMAIL
EOF

GetOptions(
    "host:s"       => \$host,
    "user:s"       => \$user,
    "password:s"   => \$password,
    "target=s"     => \$target_user,
    "targetpass=s" => \$target_pass,
    "fname=s"      => \$fname,
    "lname=s"      => \$lname,
    "email=s"      => \$email,
) or die $usage;

die $usage
  unless ( $host
    and $user
    and $password
    and $target_user
    and $target_pass
    and $fname
    and $lname
    and $email );

my $conn = get_frontier_connection($host);

## auth
my $session = $conn->call( 'auth.login', $user, $password );

my $success =
  $conn->call( 'user.create', $session, $target_user, $target_pass, $fname,
    $lname, $email, '1' );
print "Create Success: $success\n";

exit 0;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org/

iD8DBQFLz1xBhwQhj8l1t/cRAtYbAJ9vlNMRHenxQFWfhhiIbvbN8jNRkACeO97m
1ngZf5GjtHRNtFa2K9qZT/U=
=LLaM
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: APIHelper.pm
Type: application/x-perl
Size: 357 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20100421/a9019473/attachment.pl>


More information about the Spacewalk-list mailing list