]> jfr.im git - solanum.git/blame_incremental - tools/genssl.in
chmode: stop processing when too many modes
[solanum.git] / tools / genssl.in
... / ...
CommitLineData
1#!/bin/sh
2prefix="@prefix@"
3exec_prefix="@exec_prefix@"
4sysconfdir="@sysconfdir@"
5
6echo "Generating private key and CSR... "
7openssl req -new -newkey rsa:4096 -nodes -sha512 -out "${sysconfdir}"/ssl.csr -keyout "${sysconfdir}"/ssl.key
8
9echo "Self-signing certificate..."
10openssl x509 -req -sha512 -days 365 -in "${sysconfdir}"/ssl.csr -signkey "${sysconfdir}"/ssl.key -out "${sysconfdir}"/ssl.pem
11
12echo "Generating Diffie-Hellman file for secure SSL/TLS negotiation .. "
13openssl dhparam -out "${sysconfdir}"/dh.pem 2048
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";
28 ssl_cert = "${relative_sysconfdir}/ssl.pem";
29 ssl_dh_params = "${relative_sysconfdir}/dh.pem";
30
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
36Enjoy using ssl.
37EOF