]> jfr.im git - solanum.git/blame - tools/genssl.in
Just use 4k RSA certificates while at it
[solanum.git] / tools / genssl.in
CommitLineData
c74836dc
NPB
1#!/bin/sh
2prefix="@prefix@"
3exec_prefix="@exec_prefix@"
4sysconfdir="@sysconfdir@"
5
b858bc54 6echo "Generating private key and CSR... "
3c55c3a3 7openssl req -new -newkey rsa:4096 -nodes -sha512 -out "${sysconfdir}"/ssl.csr -keyout "${sysconfdir}"/ssl.key
b858bc54
PG
8
9echo "Self-signing certificate..."
10openssl x509 -req -sha512 -days 365 -in "${sysconfdir}"/ssl.csr -signkey "${sysconfdir}"/ssl.key -out "${sysconfdir}"/ssl.pem
c74836dc
NPB
11
12echo "Generating Diffie-Hellman file for secure SSL/TLS negotiation .. "
5fd2dd95 13openssl dhparam -out "${sysconfdir}"/dh.pem 2048
c74836dc
NPB
14
15# If sysconfdir is relative to prefix, make the path relative. I.e.,
16# prefix=/usr and sysconfdir=/etc -> relative_sysconfdir=/etc,
17# prefix=/home/binki/chary and sysconfdir=/home/binki/chary/etc ->
18# relative_sysconfdir=etc
19relative_sysconfdir="${sysconfdir#${prefix%/}/}"
20relative_sysconfdir="${relative_sysconfdir%/}"
21
22cat <<EOF
23
24
25Now change these lines in the IRCd config file:
26
27 ssl_private_key = "${relative_sysconfdir}/ssl.key";
b858bc54 28 ssl_cert = "${relative_sysconfdir}/ssl.pem";
c74836dc
NPB
29 ssl_dh_params = "${relative_sysconfdir}/dh.pem";
30
b858bc54
PG
31If you want to get your certificate signed by a certificate authority,
32submit the ssl.csr file to your CA, then replace ssl.pem with the
33certificate returned to you. You may need to include your CA's
34intermediate certificates in signing order.
35
c74836dc
NPB
36Enjoy using ssl.
37EOF