root / trunk / shell / generate-rsa-keys @ 46
Historique | Voir | Annoter | Télécharger (963 octet)
1 | 3 | storres | #! /bin/bash |
---|---|---|---|
2 | 3 | storres | |
3 | 3 | storres | # Generate two files holding 1000 host rsa 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_rsa_key |
9 | 3 | storres | rm -f $SSH_KEYS_DIR/ssh_host_rsa_key.pub |
10 | 3 | storres | rm -f $SSH_KEYS_DIR/rsa_key |
11 | 3 | storres | rm -f $SSH_KEYS_DIR/rsa_key.pub |
12 | 3 | storres | # Create the empty key list files |
13 | 3 | storres | touch $SSH_KEYS_DIR/ssh_host_rsa_key |
14 | 3 | storres | touch $SSH_KEYS_DIR/ssh_host_rsa_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 rsa -f $SSH_KEYS_DIR/rsa_key |
19 | 3 | storres | mv $SSH_KEYS_DIR/ssh_host_rsa_key $SSH_KEYS_DIR/prov |
20 | 3 | storres | mv $SSH_KEYS_DIR/ssh_host_rsa_key.pub $SSH_KEYS_DIR/prov.pub |
21 | 3 | storres | cat $SSH_KEYS_DIR/prov $SSH_KEYS_DIR/rsa_key > $SSH_KEYS_DIR/ssh_host_rsa_key |
22 | 3 | storres | rm $SSH_KEYS_DIR/prov |
23 | 3 | storres | rm $SSH_KEYS_DIR/rsa_key |
24 | 3 | storres | cat $SSH_KEYS_DIR/prov.pub $SSH_KEYS_DIR/rsa_key.pub > $SSH_KEYS_DIR/ssh_host_rsa_key.pub |
25 | 3 | storres | rm $SSH_KEYS_DIR/prov.pub |
26 | 3 | storres | rm $SSH_KEYS_DIR/rsa_key.pub |
27 | 3 | storres | done |