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