Statistiques
| Révision :

root / trunk / shell / generate-dsa-keys @ 49

Historique | Voir | Annoter | Télécharger (965 octet)

1 3 storres
#! /bin/bash
2 3 storres
#
3 3 storres
# Generate two files holding 1000 host dsa keys: one for the private
4 3 storres
# keys, the other for the public ones.
5 3 storres
#
6 3 storres
SSH_KEYS_DIR="./templates/sshkeys"
7 3 storres
# Remove all the keys.
8 3 storres
rm -f $SSH_KEYS_DIR/ssh_host_dsa_key
9 3 storres
rm -f $SSH_KEYS_DIR/ssh_host_dsa_key.pub
10 3 storres
rm -f $SSH_KEYS_DIR/dsa_key
11 3 storres
rm -f $SSH_KEYS_DIR/dsa_key.pub
12 3 storres
# Create the empty key list files
13 3 storres
touch $SSH_KEYS_DIR/ssh_host_dsa_key
14 3 storres
touch $SSH_KEYS_DIR/ssh_host_dsa_key.pub
15 3 storres
# Create the keys
16 3 storres
for i in `seq 1000`
17 3 storres
  do
18 3 storres
    echo "\n\n" | ssh-keygen -q -t dsa -f $SSH_KEYS_DIR/dsa_key
19 3 storres
    mv $SSH_KEYS_DIR/ssh_host_dsa_key $SSH_KEYS_DIR/prov
20 3 storres
    mv $SSH_KEYS_DIR/ssh_host_dsa_key.pub $SSH_KEYS_DIR/prov.pub
21 3 storres
    cat $SSH_KEYS_DIR/prov $SSH_KEYS_DIR/dsa_key >  $SSH_KEYS_DIR/ssh_host_dsa_key
22 3 storres
    rm $SSH_KEYS_DIR/prov
23 3 storres
    rm $SSH_KEYS_DIR/dsa_key
24 3 storres
    cat $SSH_KEYS_DIR/prov.pub $SSH_KEYS_DIR/dsa_key.pub >  $SSH_KEYS_DIR/ssh_host_dsa_key.pub
25 3 storres
    rm $SSH_KEYS_DIR/prov.pub
26 3 storres
    rm $SSH_KEYS_DIR/dsa_key.pub
27 3 storres
done