1
0

0017-S2S-TLS-Convert-SSL.txt-to-Markdown-and-update-infor.patch 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. From b04ed224cf95c0f31849d3683412cb937cc00efc Mon Sep 17 00:00:00 2001
  2. From: Alexander Barton <alex@barton.de>
  3. Date: Mon, 8 Jan 2024 18:31:30 +0100
  4. Subject: [PATCH 17/20] S2S-TLS: Convert SSL.txt to Markdown and update
  5. information given
  6. No longer describe creating self-signed certificates or using "stunnel",
  7. as both is not recommended.
  8. (cherry picked from commit b826fad15871f73435328b1d77fd364838389adb)
  9. ---
  10. INSTALL.md | 2 +-
  11. doc/Makefile.am | 2 +-
  12. doc/SSL.md | 80 +++++++++++++++++++++++++++++++++++
  13. doc/SSL.txt | 108 ------------------------------------------------
  14. 4 files changed, 82 insertions(+), 110 deletions(-)
  15. create mode 100644 doc/SSL.md
  16. delete mode 100644 doc/SSL.txt
  17. --- a/INSTALL.md
  18. +++ b/INSTALL.md
  19. @@ -347,7 +347,7 @@
  20. - `--with-gnutls[=<path>]`
  21. Enable support for SSL/TLS using OpenSSL or GnuTLS libraries.
  22. - See `doc/SSL.txt` for details.
  23. + See `doc/SSL.md` for details.
  24. - IPv6:
  25. --- a/doc/Makefile.am
  26. +++ b/doc/Makefile.am
  27. @@ -33,7 +33,7 @@
  28. README-Interix.txt \
  29. RFC.txt \
  30. Services.txt \
  31. - SSL.txt
  32. + SSL.md
  33. doc_templates = sample-ngircd.conf.tmpl
  34. --- /dev/null
  35. +++ b/doc/SSL.md
  36. @@ -0,0 +1,80 @@
  37. +# [ngIRCd](https://ngircd.barton.de) - SSL/TLS Encrypted Connections
  38. +
  39. +ngIRCd supports SSL/TLS encrypted connections using the *OpenSSL* or *GnuTLS*
  40. +libraries. Both encrypted server-server links as well as client-server links
  41. +are supported.
  42. +
  43. +SSL is a compile-time option which is disabled by default. Use one of these
  44. +options of the ./configure script to enable it:
  45. +
  46. +- `--with-openssl`: enable SSL support using OpenSSL.
  47. +- `--with-gnutls`: enable SSL support using GnuTLS.
  48. +
  49. +You can check the output of `ngircd --version` to validate if your executable
  50. +includes support for SSL or not: "+SSL" must be listed in the feature flags.
  51. +
  52. +You also need a SSL key and certificate, for example using Let's Encrypt, which
  53. +is out of the scope of this document.
  54. +
  55. +From a feature point of view, ngIRCds support for both libraries is
  56. +comparable. The only major difference (at this time) is that ngIRCd with GnuTLS
  57. +does not support password protected private keys.
  58. +
  59. +## Configuration
  60. +
  61. +SSL-encrypted connections and plain-text connects can't run on the same network
  62. +port (which is a limitation of the IRC protocol); therefore you have to define
  63. +separate port(s) in your `[SSL]` block in the configuration file.
  64. +
  65. +A minimal configuration for *accepting* SSL-encrypted client & server
  66. +connections looks like this:
  67. +
  68. +``` ini
  69. +[SSL]
  70. +CertFile = /etc/ssl/certs/my-fullchain.pem
  71. +KeyFile = /etc/ssl/certs/my-privkey.pem
  72. +Ports = 6697, 6698
  73. +```
  74. +
  75. +In this case, the server only deals with *incoming* connections and never has to
  76. +validate SSL certificates itself, and therefore no "Certificate Authorities" are
  77. +needed.
  78. +
  79. +If you want to use *outgoing* SSL-connections to other servers, you need to add:
  80. +
  81. +``` ini
  82. +[SSL]
  83. +...
  84. +CAFile = /etc/ssl/certs/ca-certificates.crt
  85. +DHFile = /etc/ngircd/dhparams.pem
  86. +
  87. +[SERVER]
  88. +...
  89. +SSLConnect = yes
  90. +```
  91. +
  92. +The `CAFile` option configures a file listing all the certificates of the
  93. +trusted Certificate Authorities.
  94. +
  95. +The Diffie-Hellman parameters file `dhparams.pem` can be created like this:
  96. +
  97. +- OpenSSL: `openssl dhparam -2 -out /etc/ngircd/dhparams.pem 4096`
  98. +- GnuTLS: `certtool --generate-dh-params --bits 4096 --outfile /etc/ngircd/dhparams.pem`
  99. +
  100. +Note that enabling `SSLConnect` not only enforces SSL-encrypted links for
  101. +*outgoing* connections to other servers, but for *incoming* connections as well:
  102. +If a server configured with `SSLConnect = yes` tries to connect on a plain-text
  103. +connection, it won't be accepted to prevent data leakage! Therefore you should
  104. +set this for *all* servers you expect to use SSL-encrypted connections!
  105. +
  106. +## Accepting untrusted Remote Certificates
  107. +
  108. +If you are using self-signed certificates or otherwise invalid certificates,
  109. +which ngIRCd would reject by default, you can force ngIRCd to skip certificate
  110. +validation on a per-server basis and continue establishing outgoing connections
  111. +to the respective peer by setting `SSLVerify = no` in the `[SERVER]` block of
  112. +this remote server in your configuration.
  113. +
  114. +But please think twice before doing so: the established connection is still
  115. +encrypted but the remote site is *not verified at all* and man-in-the-middle
  116. +attacks are possible!
  117. --- a/doc/SSL.txt
  118. +++ /dev/null
  119. @@ -1,108 +0,0 @@
  120. -
  121. - ngIRCd - Next Generation IRC Server
  122. -
  123. - (c)2001-2008 Alexander Barton,
  124. - alex@barton.de, http://www.barton.de/
  125. -
  126. - ngIRCd is free software and published under the
  127. - terms of the GNU General Public License.
  128. -
  129. - -- SSL.txt --
  130. -
  131. -
  132. -ngIRCd supports SSL/TLSv1 encrypted connections using the OpenSSL or GnuTLS
  133. -libraries. Both encrypted server-server links as well as client-server links
  134. -are supported.
  135. -
  136. -SSL is a compile-time option which is disabled by default. Use one of these
  137. -options of the ./configure script to enable it:
  138. -
  139. - --with-openssl enable SSL support using OpenSSL
  140. - --with-gnutls enable SSL support using GnuTLS
  141. -
  142. -You also need a key/certificate, see below for how to create a self-signed one.
  143. -
  144. -From a feature point of view, ngIRCds support for both libraries is
  145. -comparable. The only major difference (at this time) is that ngircd with gnutls
  146. -does not support password protected private keys.
  147. -
  148. -Configuration
  149. -~~~~~~~~~~~~~
  150. -
  151. -To enable SSL connections a separate port must be configured: it is NOT
  152. -possible to handle unencrypted and encrypted connections on the same port!
  153. -This is a limitation of the IRC protocol ...
  154. -
  155. -You have to set (at least) the following configuration variables in the
  156. -[SSL] section of ngircd.conf(5): Ports, KeyFile, and CertFile.
  157. -
  158. -Now IRC clients are able to connect using SSL on the configured port(s).
  159. -(Using port 6697 for encrypted connections is common.)
  160. -
  161. -To enable encrypted server-server links, you have to additionally set
  162. -SSLConnect to "yes" in the corresponding [SERVER] section.
  163. -
  164. -
  165. -Creating a self-signed certificate
  166. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  167. -
  168. -OpenSSL:
  169. -
  170. -Creating a self-signed certificate and key:
  171. - $ openssl req -newkey rsa:2048 -x509 -keyout server-key.pem -out server-cert.pem -days 1461
  172. -Create DH parameters (optional):
  173. - $ openssl dhparam -2 -out dhparams.pem 4096
  174. -
  175. -GnuTLS:
  176. -
  177. -Creating a self-signed certificate and key:
  178. - $ certtool --generate-privkey --bits 2048 --outfile server-key.pem
  179. - $ certtool --generate-self-signed --load-privkey server-key.pem --outfile server-cert.pem
  180. -Create DH parameters (optional):
  181. - $ certtool --generate-dh-params --bits 4096 --outfile dhparams.pem
  182. -
  183. -
  184. -Alternate approach using stunnel(1)
  185. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  186. -
  187. -Alternatively (or if you are using ngIRCd compiled without support
  188. -for GnuTLS/OpenSSL), you can use external programs/tools like stunnel(1) to
  189. -get SSL encrypted connections:
  190. -
  191. - <http://stunnel.mirt.net/>
  192. - <http://www.stunnel.org/>
  193. -
  194. -Stefan Sperling (stefan at binarchy dot net) mailed the following text as a
  195. -short "how-to", thanks Stefan!
  196. -
  197. -=== snip ===
  198. - ! This guide applies to stunnel 4.x !
  199. -
  200. - Put this in your stunnel.conf:
  201. -
  202. - [ircs]
  203. - accept = 6667
  204. - connect = 6668
  205. -
  206. - This makes stunnel listen for incoming connections
  207. - on port 6667 and forward decrypted data to port 6668.
  208. - We call the connection 'ircs'. Stunnel will use this
  209. - name when logging connection attempts via syslog.
  210. - You can also use the name in /etc/hosts.{allow,deny}
  211. - if you run tcp-wrappers.
  212. -
  213. - To make sure ngircd is listening on the port where
  214. - the decrypted data arrives, set
  215. -
  216. - Ports = 6668
  217. -
  218. - in your ngircd.conf.
  219. -
  220. - Start stunnel and restart ngircd.
  221. -
  222. - That's it.
  223. - Don't forget to activate ssl support in your irc client ;)
  224. - The main drawback of this approach compared to using builtin ssl
  225. - is that from ngIRCds point of view, all ssl-enabled client connections will
  226. - originate from the host running stunnel.
  227. -=== snip ===
  228. --- a/doc/Makefile.in
  229. +++ b/doc/Makefile.in
  230. @@ -248,7 +248,7 @@
  231. README-Interix.txt \
  232. RFC.txt \
  233. Services.txt \
  234. - SSL.txt
  235. + SSL.md
  236. doc_templates = sample-ngircd.conf.tmpl
  237. generated_docs = sample-ngircd.conf