From: Ismaël Bouya Date: Fri, 19 Oct 2018 14:12:50 +0000 (+0200) Subject: Add ldap ssha script X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=b3ac23bb9960207194de901275f33a72b0779690;p=perso%2FImmae%2FProjets%2FPuppet.git Add ldap ssha script --- diff --git a/modules/base_installation/files/scripts/ldap_ssha b/modules/base_installation/files/scripts/ldap_ssha new file mode 100755 index 0000000..cdbea1b --- /dev/null +++ b/modules/base_installation/files/scripts/ldap_ssha @@ -0,0 +1,13 @@ +#! /usr/bin/perl +use strict; +use Digest::SHA qw(sha1); +use MIME::Base64; + +print 'Password: '; +system ( "stty -echo"); +my $secret = ; +chomp $secret; +my $salt; +$salt .= ('.','/',0..9,'A'..'Z','a'..'z')[rand 64] foreach(1..8); + +print "\nHashed string for LDAP:\nuserPassword: {SSHA}" . encode_base64(sha1($secret . $salt) . $salt, '') . "\n"; diff --git a/modules/role/manifests/caldance.pp b/modules/role/manifests/caldance.pp index b7948e6..63dda1f 100644 --- a/modules/role/manifests/caldance.pp +++ b/modules/role/manifests/caldance.pp @@ -9,4 +9,15 @@ class role::caldance ( include "profile::monitoring" ensure_packages(["python-pip", "python-virtualenv", "python-django"]) + + # pour le script de génération de mdp + ensure_packages(["perl-digest-sha1"]) + + file { "/usr/local/bin/ldap_ssha": + owner => "root", + group => "root", + mode => "0755", + source => "puppet:///modules/base_installation/scripts/ldap_ssha", + require => Package["perl-digest-sha1"], + } }