root / trunk / shell / generate-rsa-keys @ 19
Historique | Voir | Annoter | Télécharger (963 octet)
1 |
#! /bin/bash |
---|---|
2 |
|
3 |
# Generate two files holding 1000 host rsa 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_rsa_key |
9 |
rm -f $SSH_KEYS_DIR/ssh_host_rsa_key.pub |
10 |
rm -f $SSH_KEYS_DIR/rsa_key |
11 |
rm -f $SSH_KEYS_DIR/rsa_key.pub |
12 |
# Create the empty key list files |
13 |
touch $SSH_KEYS_DIR/ssh_host_rsa_key |
14 |
touch $SSH_KEYS_DIR/ssh_host_rsa_key.pub |
15 |
# Create the keys |
16 |
for i in `seq 1000` |
17 |
do |
18 |
echo "\n\n" | ssh-keygen -q -t rsa -f $SSH_KEYS_DIR/rsa_key |
19 |
mv $SSH_KEYS_DIR/ssh_host_rsa_key $SSH_KEYS_DIR/prov |
20 |
mv $SSH_KEYS_DIR/ssh_host_rsa_key.pub $SSH_KEYS_DIR/prov.pub |
21 |
cat $SSH_KEYS_DIR/prov $SSH_KEYS_DIR/rsa_key > $SSH_KEYS_DIR/ssh_host_rsa_key |
22 |
rm $SSH_KEYS_DIR/prov |
23 |
rm $SSH_KEYS_DIR/rsa_key |
24 |
cat $SSH_KEYS_DIR/prov.pub $SSH_KEYS_DIR/rsa_key.pub > $SSH_KEYS_DIR/ssh_host_rsa_key.pub |
25 |
rm $SSH_KEYS_DIR/prov.pub |
26 |
rm $SSH_KEYS_DIR/rsa_key.pub |
27 |
done |
28 |
|