summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-sysadm/attachments/20110502
diff options
context:
space:
mode:
Diffstat (limited to 'zarb-ml/mageia-sysadm/attachments/20110502')
-rw-r--r--zarb-ml/mageia-sysadm/attachments/20110502/2ccc0bef/attachment-0001.pl38
-rw-r--r--zarb-ml/mageia-sysadm/attachments/20110502/2ccc0bef/attachment.pl38
2 files changed, 76 insertions, 0 deletions
diff --git a/zarb-ml/mageia-sysadm/attachments/20110502/2ccc0bef/attachment-0001.pl b/zarb-ml/mageia-sysadm/attachments/20110502/2ccc0bef/attachment-0001.pl
new file mode 100644
index 000000000..5d9c5c10d
--- /dev/null
+++ b/zarb-ml/mageia-sysadm/attachments/20110502/2ccc0bef/attachment-0001.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Net::LDAP;
+use File::Slurp;
+my $people_ou = "ou=People,dc=mageia,dc=org";
+
+my $login = "uid=$ARGV[0],$people_ou";
+
+print "enter password for $login : ";
+my $password = <STDIN>;
+chomp($password);
+
+my $ldap = Net::LDAP->new( 'ldap.mageia.org',
+ scheme => "ldaps");
+
+my $mesg = $ldap->bind( $login, password => $password );
+
+foreach my $auth (glob('/home/*/.ssh/authorized_keys')) {
+ $auth =~ m|/home/(.*)/.ssh|;
+ my $username = $1;
+ foreach my $key (read_file($auth)) {
+ chomp($key);
+ next if $key =~ /^$/;
+ $mesg = $ldap->modify( "uid=$username,$people_ou",
+ changes => [
+ add => [
+ sshPublicKey => "$key"
+ ],
+ ]);
+ }
+}
+print "\n";
+# pour tout les users
+# faire un cat du fichier
+# pour chaque ligne
+# ajouter un champ
+
diff --git a/zarb-ml/mageia-sysadm/attachments/20110502/2ccc0bef/attachment.pl b/zarb-ml/mageia-sysadm/attachments/20110502/2ccc0bef/attachment.pl
new file mode 100644
index 000000000..5d9c5c10d
--- /dev/null
+++ b/zarb-ml/mageia-sysadm/attachments/20110502/2ccc0bef/attachment.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Net::LDAP;
+use File::Slurp;
+my $people_ou = "ou=People,dc=mageia,dc=org";
+
+my $login = "uid=$ARGV[0],$people_ou";
+
+print "enter password for $login : ";
+my $password = <STDIN>;
+chomp($password);
+
+my $ldap = Net::LDAP->new( 'ldap.mageia.org',
+ scheme => "ldaps");
+
+my $mesg = $ldap->bind( $login, password => $password );
+
+foreach my $auth (glob('/home/*/.ssh/authorized_keys')) {
+ $auth =~ m|/home/(.*)/.ssh|;
+ my $username = $1;
+ foreach my $key (read_file($auth)) {
+ chomp($key);
+ next if $key =~ /^$/;
+ $mesg = $ldap->modify( "uid=$username,$people_ou",
+ changes => [
+ add => [
+ sshPublicKey => "$key"
+ ],
+ ]);
+ }
+}
+print "\n";
+# pour tout les users
+# faire un cat du fichier
+# pour chaque ligne
+# ajouter un champ
+