-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakekeys
More file actions
executable file
·92 lines (62 loc) · 1.96 KB
/
makekeys
File metadata and controls
executable file
·92 lines (62 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
set -euo pipefail
# creates keys with Debian OpenSSL bug, you need to run
# fetchdwk first to get the binaries and libs.
# one of alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc
ARCH=amd64
# should be be32, le32 or le64
ADIR=le64
ALLBITS="1024 2048"
DOSSL=1
DOSSH=1
DODSA=1
PIDS=$(seq 0 32767)
#PIDS="17 39 5172 32767"
if [ -e o ]; then
echo "outdir o exists"
exit 1
fi
DOTRNDHOME=$(mktemp -d)
dd if=/dev/urandom of=$DOTRNDHOME/.rnd bs=1024 count=1
PWDP=$(pwd)
for bits in $ALLBITS; do
if [ $DOSSL -eq 1 ]; then
ODIR=o/rsa$bits/ssl/$ADIR/
mkdir -p $ODIR
for pid in $PIDS; do
echo Creating openssl keys for pid $pid , $bits RSA keys
export MAGICPID=$pid
LD_PRELOAD=$PWDP/getpidbin/getpid$ARCH.so LD_LIBRARY_PATH=$PWDP/dwk-$ARCH-etch/ \
HOME=/dev/null dwk-$ARCH-etch/openssl genrsa $bits \
>$ODIR/$pid-nornd-old.key
LD_PRELOAD=$PWDP/getpidbin/getpid$ARCH.so LD_LIBRARY_PATH=$PWDP/dwk-$ARCH-lenny/ \
HOME=/dev/null dwk-$ARCH-lenny/openssl genrsa $bits \
>$ODIR/$pid-nornd-new.key
LD_PRELOAD=$PWDP/getpidbin/getpid$ARCH.so LD_LIBRARY_PATH=$PWDP/dwk-$ARCH-lenny/ \
HOME=$DOTRNDHOME dwk-$ARCH-lenny/openssl genrsa $bits \
>$ODIR/$pid-rnd.key
done
fi
if [ $DOSSH -eq 1 ] && [ $bits -ge 768 ]; then
ODIR=o/rsa$bits/ssh/$ADIR/
mkdir -p $ODIR
for pid in $PIDS; do
echo Creating openssh keys for pid $pid , $bits RSA keys
export MAGICPID=$pid
LD_PRELOAD=$PWDP/getpidbin/getpid$ARCH.so LD_LIBRARY_PATH=$PWDP/dwk-$ARCH-lenny/ \
dwk-$ARCH-lenny/ssh-keygen -N '' -t rsa -b $bits \
-f $ODIR/$pid.key
done
fi
if [ $DODSA -eq 1 ] && [ $bits -eq 1024 ]; then
ODIR=o/dsa$bits/ssh/$ADIR/
mkdir -p $ODIR
for pid in $PIDS; do
echo Creating openssh keys for pid $pid , $bits DSA keys
export MAGICPID=$pid
LD_PRELOAD=$PWDP/getpidbin/getpid$ARCH.so LD_LIBRARY_PATH=$PWDP/dwk-$ARCH-lenny/ \
dwk-$ARCH-lenny/ssh-keygen -N '' -t dsa -b $bits \
-f $ODIR/$pid.key
done
fi
done