aboutsummaryrefslogtreecommitdiffstats
path: root/certs
diff options
context:
space:
mode:
Diffstat (limited to 'certs')
-rw-r--r--certs/Makefile30
-rw-r--r--certs/localhost.crt22
-rw-r--r--certs/localhost.key15
-rw-r--r--certs/openssl.cnf52
4 files changed, 119 insertions, 0 deletions
diff --git a/certs/Makefile b/certs/Makefile
new file mode 100644
index 00000000..f3854c5f
--- /dev/null
+++ b/certs/Makefile
@@ -0,0 +1,30 @@
+.DEFAULT: localhost.crt
+keysize=2048
+
+# How to:
+# First, `make yourhost.cnf` which creates a openssl config file.
+# Then edit this file and fill in the details you want it to have,
+# and add or change hosts and components it should cover.
+# Then `make yourhost.key` to create your private key, you can
+# include keysize=number to change the size of the key.
+# Then you can either `make yourhost.csr` to generate a certificate
+# signing request that you can submit to a CA, or `make yourhost.crt`
+# to generate a self signed certificate.
+
+.PRECIOUS: %.cnf %.key
+
+# To request a cert
+%.csr: %.cnf %.key
+ openssl req -new -key $(lastword $^) -out $@ -utf8 -config $(firstword $^)
+
+# Self signed
+%.crt: %.cnf %.key
+ openssl req -new -x509 -nodes -key $(lastword $^) -days 365 \
+ -sha1 -out $@ -utf8 -config $(firstword $^)
+
+%.cnf:
+ sed 's,example\.com,$*,g' openssl.cnf > $@
+
+%.key:
+ openssl genrsa $(keysize) > $@
+ @chmod 400 $@
diff --git a/certs/localhost.crt b/certs/localhost.crt
new file mode 100644
index 00000000..5156d307
--- /dev/null
+++ b/certs/localhost.crt
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDojCCAwugAwIBAgIJAPO1OI+vmUi8MA0GCSqGSIb3DQEBBQUAMIGTMQswCQYD
+VQQGEwJHQjETMBEGA1UECBMKSmFiYmVybGFuZDETMBEGA1UEChMKUHJvc29keSBJ
+TTE8MDoGA1UECxQzaHR0cDovL3Byb3NvZHkuaW0vZG9jL2FkdmFuY2VkX3NzbF90
+bHMjY2VydGlmaWNhdGVzMRwwGgYDVQQDExNFeGFtcGxlIGNlcnRpZm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key b/certs/localhost.key
new file mode 100644
index 00000000..93fae5ed
--- /dev/null
+++ b/certs/localhost.key
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICWwIBAAKBgQDeZ+cu/gO1elmeZ//p+Hqox4kPqdFw9QWANuN+QIMyhEfopZqw
+hb+fWllSIt40tGAd4KDJrkpPDy7/KYv64xCmIcw6IrqFvy784yuaVc2xTDZZFuSN
+LeC6429pTJMW0K/wf5NO0Q5SSSUU5q9o+De7zKM51RW40GOnUQL97L2GRQIDAQAB
+AoGAYaWw5Pr12en8CwaSX8GO6SeiT9Q5dqS9Y4u12iqs77MQd16uSi6O8YITkXJp
+qS5AvR1wutvhGFEMS0+Me/zRw62OFc2VVrKmX6eqgRMR8d/+SZjqzUxb4pNIAPQU
+dHbQzqGXermf6UWm6Cbi7vN0diohd8Qoj98PeWfRQrXju0kCQQD3OXD2SEevEhNe
+g4YTREsyUkZV1etkldhAeDAJzlitCQdQF5zE9Wt/Ahv0BKlLTaz3mvSDwrI+lXYQ
+1iDzOrXrAkEA5kzu1A3Y2gclyRupTg7crgp+afh1fLKCIVUaFdOYgwQDX90YnnIq
+TaY4uQ8Eutoixha4ZM4/bJq17YjjY1O4jwJAZMEHNYftlv7h3/HwMWfy0XZQbej5
+vwuGj3er9EMhRpvYXB7TaD2w6pkcdU11BViJtntzTUOKyxC0hlYOJbJ2swJAOL3N
+vhtnSVine6RAE4Zf4tWdDdj0gXOt0i6YjbYjhmwvtKfR0AAK4jTJFvdXT/48wReJ
++PRD9issFck7VRakiwJAPTgFUTsFCR1ZPcuCPHSCK/wz2NFma/O5Eqm0qTIbNUfw
+3qDRyUuKbyr3bAc+K+asN5ok2PAnhiRUIpu146M17w==
+-----END RSA PRIVATE KEY-----
diff --git a/certs/openssl.cnf b/certs/openssl.cnf
new file mode 100644
index 00000000..091409c4
--- /dev/null
+++ b/certs/openssl.cnf
@@ -0,0 +1,52 @@
+oid_section = new_oids
+
+[ new_oids ]
+
+# RFC 6120 section 13.7.1.4. defines this OID
+xmppAddr = 1.3.6.1.5.5.7.8.5
+
+# RFC 4985 defines this OID
+SRVName = 1.3.6.1.5.5.7.8.7
+
+[ req ]
+
+default_bits = 4096
+default_keyfile = example.com.key
+distinguished_name = distinguished_name
+req_extensions = v3_extensions
+x509_extensions = v3_extensions
+
+# ask about the DN?
+prompt = no
+
+[ distinguished_name ]
+
+commonName = example.com
+countryName = GB
+localityName = The Internet
+organizationName = Your Organisation
+organizationalUnitName = XMPP Department
+emailAddress = xmpp@example.com
+
+[ v3_extensions ]
+
+# for certificate requests (req_extensions)
+# and self-signed certificates (x509_extensions)
+
+basicConstraints = CA:FALSE
+keyUsage = digitalSignature,keyEncipherment
+extendedKeyUsage = serverAuth,clientAuth
+subjectAltName = @subject_alternative_name
+
+[ subject_alternative_name ]
+
+# See http://tools.ietf.org/html/rfc6120#section-13.7.1.2 for more info.
+
+DNS.0 = example.com
+otherName.0 = xmppAddr;FORMAT:UTF8,UTF8:example.com
+otherName.1 = SRVName;IA5STRING:_xmpp-client.example.com
+otherName.2 = SRVName;IA5STRING:_xmpp-server.example.com
+
+DNS.1 = conference.example.com
+otherName.3 = xmppAddr;FORMAT:UTF8,UTF8:conference.example.com
+otherName.4 = SRVName;IA5STRING:_xmpp-server.conference.example.com