~ubuntu-branches/debian/sid/ircd-hybrid/sid

« back to all changes in this revision

Viewing changes to tools/mkkeypair

  • Committer: Package Import Robot
  • Author(s): Dominic Hargreaves
  • Date: 2015-04-19 15:53:09 UTC
  • mfrom: (1.2.13)
  • Revision ID: package-import@ubuntu.com-20150419155309-06y59x2at2ax5ou3
Tags: 1:8.2.7+dfsg.1-1
* Remove Suggests: hybserv since it doesn't really work with
  ircd-hybrid 8 and above
* New upstream release
  - update debian/copyright with minor changes
  - update config files from new reference.conf
  - fixes DoS from localhost clients (Closes: #782859)
  - supports SSL certficate chaining (Closes: #769741)
* Debconf configuration script no longer ignores the result of
  upgrade questions (Closes: #779082)
* Don't display upgrade warnings on new installs (Closes: #782883)
* Add NEWS item about updated configuration

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
# $Id: mkkeypair 3076 2014-02-27 20:08:52Z michael $
3
 
#
4
 
# mkkeypair - short shell script to generate a OpenSSL RSA key suitable 
5
 
# for use with cryptlinks.
6
 
#
7
 
# (C) 2003 Joshua Kwan and the IRCD-Hybrid team
8
 
# See COPYING for the terms of copying.
9
 
 
10
 
if test -f rsa.key; then
11
 
        echo Moving old key out of the way to rsa.key.old
12
 
        mv rsa.key rsa.key.old
13
 
fi
14
 
 
15
 
if test -f rsa.pub; then
16
 
        echo Moving old public key out of the way to rsa.pub.old
17
 
        mv rsa.pub rsa.pub.old
18
 
fi
19
 
 
20
 
echo Generating random bytes
21
 
 
22
 
if test -c /dev/urandom; then
23
 
        RANDGEN=/dev/urandom
24
 
elif test -c /dev/random; then
25
 
        RANDGEN=/dev/random
26
 
else
27
 
        RANDGEN=input
28
 
fi
29
 
 
30
 
if test "$RANDGEN" = input; then
31
 
        echo "Your system doesn't have a suitable random data generator,"
32
 
        echo "so type 150 characters of gibberish here to simulate it."
33
 
        read -n 150 randomdata
34
 
        echo
35
 
        echo "$randomdata" > randdata
36
 
        sort < randdata >> randdata.1
37
 
        cat randdata.1 >> randdata
38
 
        rm -f randdata.1
39
 
else
40
 
        dd if=$RANDGEN of=randdata count=1 bs=2048
41
 
fi
42
 
 
43
 
echo Creating the private key.
44
 
openssl genrsa -rand randdata -out rsa.key 2048 || exit 1
45
 
chmod 600 rsa.key
46
 
echo Creating the public key from the private key.
47
 
openssl rsa -in rsa.key -out rsa.pub -pubout || exit 1
48
 
chmod 644 rsa.pub
49
 
 
50
 
echo
51
 
echo Private key now exists as rsa.key
52
 
echo Public key now exists as rsa.pub
53
 
 
54
 
rm -f randdata