46 lines
1.3 KiB
Bash
46 lines
1.3 KiB
Bash
|
#! /usr/bin/env bash
|
||
|
|
||
|
BDIR="/sgoinfre/public"
|
||
|
YAKAS="anselm_j aurier_j baud_a beneul_a bounth_j bourg_m bourge_c chotar_a covola_b crepea_b escoba_c farbos_a godard_m houdeb_k huyghe_k kiffer_r lannel_r le-dan_c meny_n metivi_h mirzai_v sanche_g sellem_t seure-_a sztern_k tarral_m tavare_m thach_a vermor_c yeh_j"
|
||
|
ACUS="lefort_f derboi_a challe_a cleyma_s provos_b gourve_l pelleg_c tram_v grand_x lepage_a johann_t tissey_j beaudu_s genite_n thierr_j frotti_b lopez_b launet_a rodrig_b wils_r chen_a mercie_d cokela_s derboi_c boisse_r lecuye_c freche_j amirau_k rouaul_c zanott_b latrou_v pre_q"
|
||
|
|
||
|
DEST=`mktemp -d`
|
||
|
|
||
|
valid()
|
||
|
{
|
||
|
if [ -f "$1" ]
|
||
|
then
|
||
|
TYPE=`file "$1" | cut -d " " -f 2-`
|
||
|
case "$TYPE" in
|
||
|
"ASCII text, with very long lines")
|
||
|
if [ `ssh-keygen -l -f "$1" | cut -d " " -f 1` == 4096 ]
|
||
|
then
|
||
|
cp "$1" "$DEST/$2.pub"
|
||
|
echo ">>> Key found for $2"
|
||
|
else
|
||
|
echo "Too small key for $2"
|
||
|
fi
|
||
|
return 0
|
||
|
;;
|
||
|
"PEM RSA private key")
|
||
|
echo "WARNING: private key detected: $1"
|
||
|
return 2
|
||
|
;;
|
||
|
*)
|
||
|
echo "UNKNOWN file type: $1: $TYPE"
|
||
|
;;
|
||
|
esac
|
||
|
fi
|
||
|
return 1
|
||
|
}
|
||
|
|
||
|
for LOGIN in $YAKAS $ACUS
|
||
|
do
|
||
|
valid "$BDIR/$LOGIN/id_rsa" "$LOGIN"
|
||
|
valid "$BDIR/$LOGIN/id_rsa.pub" "$LOGIN"
|
||
|
valid "$BDIR/$LOGIN/$LOGIN" "$LOGIN"
|
||
|
valid "$BDIR/$LOGIN/$LOGIN.pub" "$LOGIN"
|
||
|
done
|
||
|
|
||
|
echo
|
||
|
echo "`ls $DEST | wc -l` valid keys copied to $DEST"
|