]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/extra/m_ssl_gnutls.cpp
Just to mess with om's head, remove helperfuncs.h from everywhere
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_gnutls.cpp
1 #include <string>
2 #include <vector>
3
4 #include <gnutls/gnutls.h>
5
6 #include "inspircd_config.h"
7 #include "configreader.h"
8 #include "users.h"
9 #include "channels.h"
10 #include "modules.h"
11
12 #include "socket.h"
13 #include "hashcomp.h"
14 #include "inspircd.h"
15
16 /* $ModDesc: Provides SSL support for clients */
17 /* $CompileFlags: `libgnutls-config --cflags` */
18 /* $LinkerFlags: `libgnutls-config --libs` `perl ../gnutls_rpath.pl` */
19
20
21
22 enum issl_status { ISSL_NONE, ISSL_HANDSHAKING_READ, ISSL_HANDSHAKING_WRITE, ISSL_HANDSHAKEN, ISSL_CLOSING, ISSL_CLOSED };
23
24 bool isin(int port, const std::vector<int> &portlist)
25 {
26         for(unsigned int i = 0; i < portlist.size(); i++)
27                 if(portlist[i] == port)
28                         return true;
29                         
30         return false;
31 }
32
33 class issl_session : public classbase
34 {
35 public:
36         gnutls_session_t sess;
37         issl_status status;
38         std::string outbuf;
39         int inbufoffset;
40         char* inbuf;
41         int fd;
42 };
43
44 class ModuleSSLGnuTLS : public Module
45 {
46         
47         ConfigReader* Conf;
48
49         char* dummy;
50         
51         CullList* culllist;
52         
53         std::vector<int> listenports;
54         
55         int inbufsize;
56         issl_session sessions[MAX_DESCRIPTORS];
57         
58         gnutls_certificate_credentials x509_cred;
59         gnutls_dh_params dh_params;
60         
61         std::string keyfile;
62         std::string certfile;
63         std::string cafile;
64         std::string crlfile;
65         int dh_bits;
66         
67  public:
68         
69         ModuleSSLGnuTLS(InspIRCd* Me)
70                 : Module::Module(Me)
71         {
72                 
73
74                 culllist = new CullList(ServerInstance);
75                 
76                 // Not rehashable...because I cba to reduce all the sizes of existing buffers.
77                 inbufsize = ServerInstance->Config->NetBufferSize;
78                 
79                 gnutls_global_init(); // This must be called once in the program
80
81                 if(gnutls_certificate_allocate_credentials(&x509_cred) != 0)
82                         ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials");
83
84                 // Guessing return meaning
85                 if(gnutls_dh_params_init(&dh_params) < 0)
86                         ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters");
87
88                 // Needs the flag as it ignores a plain /rehash
89                 OnRehash("ssl");
90                 
91                 // Void return, guess we assume success
92                 gnutls_certificate_set_dh_params(x509_cred, dh_params);
93         }
94         
95         virtual void OnRehash(const std::string &param)
96         {
97                 if(param != "ssl")
98                         return;
99         
100                 Conf = new ConfigReader(ServerInstance);
101                 
102                 for(unsigned int i = 0; i < listenports.size(); i++)
103                 {
104                         ServerInstance->Config->DelIOHook(listenports[i]);
105                 }
106                 
107                 listenports.clear();
108                 
109                 for(int i = 0; i < Conf->Enumerate("bind"); i++)
110                 {
111                         // For each <bind> tag
112                         if(((Conf->ReadValue("bind", "type", i) == "") || (Conf->ReadValue("bind", "type", i) == "clients")) && (Conf->ReadValue("bind", "ssl", i) == "gnutls"))
113                         {
114                                 // Get the port we're meant to be listening on with SSL
115                                 unsigned int port = Conf->ReadInteger("bind", "port", i, true);
116                                 if (ServerInstance->Config->AddIOHook(port, this))
117                                 {
118                                         // We keep a record of which ports we're listening on with SSL
119                                         listenports.push_back(port);
120                                 
121                                         ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", port);
122                                 }
123                                 else
124                                 {
125                                         ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port);
126                                 }
127                         }
128                 }
129                 
130                 std::string confdir(CONFIG_FILE);
131                 // +1 so we the path ends with a /
132                 confdir = confdir.substr(0, confdir.find_last_of('/') + 1);
133                 
134                 cafile  = Conf->ReadValue("gnutls", "cafile", 0);
135                 crlfile = Conf->ReadValue("gnutls", "crlfile", 0);
136                 certfile        = Conf->ReadValue("gnutls", "certfile", 0);
137                 keyfile = Conf->ReadValue("gnutls", "keyfile", 0);
138                 dh_bits = Conf->ReadInteger("gnutls", "dhbits", 0, false);
139                 
140                 // Set all the default values needed.
141                 if(cafile == "")
142                         cafile = "ca.pem";
143                         
144                 if(crlfile == "")
145                         crlfile = "crl.pem";
146                         
147                 if(certfile == "")
148                         certfile = "cert.pem";
149                         
150                 if(keyfile == "")
151                         keyfile = "key.pem";
152                         
153                 if((dh_bits != 768) && (dh_bits != 1024) && (dh_bits != 2048) && (dh_bits != 3072) && (dh_bits != 4096))
154                         dh_bits = 1024;
155                         
156                 // Prepend relative paths with the path to the config directory.        
157                 if(cafile[0] != '/')
158                         cafile = confdir + cafile;
159                 
160                 if(crlfile[0] != '/')
161                         crlfile = confdir + crlfile;
162                         
163                 if(certfile[0] != '/')
164                         certfile = confdir + certfile;
165                         
166                 if(keyfile[0] != '/')
167                         keyfile = confdir + keyfile;
168                 
169                 if(gnutls_certificate_set_x509_trust_file(x509_cred, cafile.c_str(), GNUTLS_X509_FMT_PEM) < 0)
170                         ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file: %s", cafile.c_str());
171                         
172                 if(gnutls_certificate_set_x509_crl_file (x509_cred, crlfile.c_str(), GNUTLS_X509_FMT_PEM) < 0)
173                         ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file: %s", crlfile.c_str());
174                 
175                 // Guessing on the return value of this, manual doesn't say :|
176                 if(gnutls_certificate_set_x509_key_file (x509_cred, certfile.c_str(), keyfile.c_str(), GNUTLS_X509_FMT_PEM) < 0)
177                         ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 certificate and key files: %s and %s", certfile.c_str(), keyfile.c_str());   
178                         
179                 // This may be on a large (once a day or week) timer eventually.
180                 GenerateDHParams();
181                 
182                 DELETE(Conf);
183         }
184         
185         void GenerateDHParams()
186         {
187                 // Generate Diffie Hellman parameters - for use with DHE
188                 // kx algorithms. These should be discarded and regenerated
189                 // once a day, once a week or once a month. Depending on the
190                 // security requirements.
191                 
192                 if(gnutls_dh_params_generate2(dh_params, dh_bits) < 0)
193                         ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits)", dh_bits);
194         }
195         
196         virtual ~ModuleSSLGnuTLS()
197         {
198                 gnutls_dh_params_deinit(dh_params);
199                 gnutls_certificate_free_credentials(x509_cred);
200                 gnutls_global_deinit();
201                 delete culllist;
202         }
203         
204         virtual void OnCleanup(int target_type, void* item)
205         {
206                 if(target_type == TYPE_USER)
207                 {
208                         userrec* user = (userrec*)item;
209                         
210                         if(user->GetExt("ssl", dummy) && isin(user->GetPort(), listenports))
211                         {
212                                 // User is using SSL, they're a local user, and they're using one of *our* SSL ports.
213                                 // Potentially there could be multiple SSL modules loaded at once on different ports.
214                                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Adding user %s to cull list", user->nick);
215                                 culllist->AddItem(user, "SSL module unloading");
216                         }
217                 }
218         }
219         
220         virtual void OnUnloadModule(Module* mod, const std::string &name)
221         {
222                 if(mod == this)
223                 {
224                         // We're being unloaded, kill all the users added to the cull list in OnCleanup
225                         int numusers = culllist->Apply();
226                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Killed %d users for unload of GnuTLS SSL module", numusers);
227                         
228                         for(unsigned int i = 0; i < listenports.size(); i++)
229                                 ServerInstance->Config->DelIOHook(listenports[i]);
230                 }
231         }
232         
233         virtual Version GetVersion()
234         {
235                 return Version(1, 0, 0, 0, VF_VENDOR);
236         }
237
238         void Implements(char* List)
239         {
240                 List[I_OnRawSocketAccept] = List[I_OnRawSocketClose] = List[I_OnRawSocketRead] = List[I_OnRawSocketWrite] = List[I_OnCleanup] = 1;
241                 List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = List[I_OnGlobalConnect] = 1;
242         }
243
244         virtual void OnRawSocketAccept(int fd, const std::string &ip, int localport)
245         {
246                 issl_session* session = &sessions[fd];
247         
248                 session->fd = fd;
249                 session->inbuf = new char[inbufsize];
250                 session->inbufoffset = 0;
251         
252                 gnutls_init(&session->sess, GNUTLS_SERVER);
253
254                 gnutls_set_default_priority(session->sess); // Avoid calling all the priority functions, defaults are adequate.
255                 gnutls_credentials_set(session->sess, GNUTLS_CRD_CERTIFICATE, x509_cred);
256                 gnutls_certificate_server_set_request(session->sess, GNUTLS_CERT_REQUEST); // Request client certificate if any.
257                 gnutls_dh_set_prime_bits(session->sess, dh_bits);
258                 
259                 /* This is an experimental change to avoid a warning on 64bit systems about casting between integer and pointer of different sizes
260                  * This needs testing, but it's easy enough to rollback if need be
261                  * Old: gnutls_transport_set_ptr(session->sess, (gnutls_transport_ptr_t) fd); // Give gnutls the fd for the socket.
262                  * New: gnutls_transport_set_ptr(session->sess, &fd); // Give gnutls the fd for the socket.
263                  *
264                  * With testing this seems to...not work :/
265                  */
266                 
267                 gnutls_transport_set_ptr(session->sess, (gnutls_transport_ptr_t) fd); // Give gnutls the fd for the socket.
268                 
269                 Handshake(session);
270         }
271
272         virtual void OnRawSocketClose(int fd)
273         {
274                 ServerInstance->Log(DEBUG, "OnRawSocketClose: %d", fd);
275                 CloseSession(&sessions[fd]);
276         }
277         
278         virtual int OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult)
279         {
280                 issl_session* session = &sessions[fd];
281                 
282                 if(!session->sess)
283                 {
284                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: No session to read from");
285                         readresult = 0;
286                         CloseSession(session);
287                         return 1;
288                 }
289                 
290                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead(%d, buffer, %u, %d)", fd, count, readresult);
291                 
292                 if(session->status == ISSL_HANDSHAKING_READ)
293                 {
294                         // The handshake isn't finished, try to finish it.
295                         
296                         if(Handshake(session))
297                         {
298                                 // Handshake successfully resumed.
299                                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: successfully resumed handshake");
300                         }
301                         else
302                         {
303                                 // Couldn't resume handshake.   
304                                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: failed to resume handshake");
305                                 return -1;
306                         }
307                 }
308                 else if(session->status == ISSL_HANDSHAKING_WRITE)
309                 {
310                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: handshake wants to write data but we are currently reading");
311                         return -1;
312                 }
313                 
314                 // If we resumed the handshake then session->status will be ISSL_HANDSHAKEN.
315                 
316                 if(session->status == ISSL_HANDSHAKEN)
317                 {
318                         // Is this right? Not sure if the unencrypted data is garaunteed to be the same length.
319                         // Read into the inbuffer, offset from the beginning by the amount of data we have that insp hasn't taken yet.
320                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: gnutls_record_recv(sess, inbuf+%d, %d-%d)", session->inbufoffset, inbufsize, session->inbufoffset);
321                         
322                         int ret = gnutls_record_recv(session->sess, session->inbuf + session->inbufoffset, inbufsize - session->inbufoffset);
323
324                         if(ret == 0)
325                         {
326                                 // Client closed connection.
327                                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Client closed the connection");
328                                 readresult = 0;
329                                 CloseSession(session);
330                                 return 1;
331                         }
332                         else if(ret < 0)
333                         {
334                                 if(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
335                                 {
336                                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Not all SSL data read: %s", gnutls_strerror(ret));
337                                         return -1;
338                                 }
339                                 else
340                                 {
341                                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Error reading SSL data: %s", gnutls_strerror(ret));
342                                         readresult = 0;
343                                         CloseSession(session);
344                                 }
345                         }
346                         else
347                         {
348                                 // Read successfully 'ret' bytes into inbuf + inbufoffset
349                                 // There are 'ret' + 'inbufoffset' bytes of data in 'inbuf'
350                                 // 'buffer' is 'count' long
351                                 
352                                 unsigned int length = ret + session->inbufoffset;
353                 
354                                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Read %d bytes, now have %d waiting to be passed up", ret, length);
355                                                 
356                                 if(count <= length)
357                                 {
358                                         memcpy(buffer, session->inbuf, count);
359                                         // Move the stuff left in inbuf to the beginning of it
360                                         memcpy(session->inbuf, session->inbuf + count, (length - count));
361                                         // Now we need to set session->inbufoffset to the amount of data still waiting to be handed to insp.
362                                         session->inbufoffset = length - count;
363                                         // Insp uses readresult as the count of how much data there is in buffer, so:
364                                         readresult = count;
365                                 }
366                                 else
367                                 {
368                                         // There's not as much in the inbuf as there is space in the buffer, so just copy the whole thing.
369                                         memcpy(buffer, session->inbuf, length);
370                                         // Zero the offset, as there's nothing there..
371                                         session->inbufoffset = 0;
372                                         // As above
373                                         readresult = length;
374                                 }
375                         }
376                 }
377                 else if(session->status == ISSL_CLOSING)
378                 {
379                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: session closing...");
380                         readresult = 0;
381                 }
382                 
383                 return 1;
384         }
385         
386         virtual int OnRawSocketWrite(int fd, const char* buffer, int count)
387         {               
388                 issl_session* session = &sessions[fd];
389                 const char* sendbuffer = buffer;
390
391                 if(!session->sess)
392                 {
393                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: No session to write to");
394                         CloseSession(session);
395                         return 1;
396                 }
397                 
398                 if(session->status == ISSL_HANDSHAKING_WRITE)
399                 {
400                         // The handshake isn't finished, try to finish it.
401                         
402                         if(Handshake(session))
403                         {
404                                 // Handshake successfully resumed.
405                                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: successfully resumed handshake");
406                         }
407                         else
408                         {
409                                 // Couldn't resume handshake.   
410                                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: failed to resume handshake"); 
411                         }
412                 }
413                 else if(session->status == ISSL_HANDSHAKING_READ)
414                 {
415                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: handshake wants to read data but we are currently writing");
416                 }
417
418                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Adding %d bytes to the outgoing buffer", count);         
419                 session->outbuf.append(sendbuffer, count);
420                 sendbuffer = session->outbuf.c_str();
421                 count = session->outbuf.size();
422
423                 if(session->status == ISSL_HANDSHAKEN)
424                 {       
425                         int ret = gnutls_record_send(session->sess, sendbuffer, count);
426                 
427                         if(ret == 0)
428                         {
429                                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Client closed the connection");
430                                 CloseSession(session);
431                         }
432                         else if(ret < 0)
433                         {
434                                 if(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
435                                 {
436                                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Not all SSL data written: %s", gnutls_strerror(ret));
437                                 }
438                                 else
439                                 {
440                                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Error writing SSL data: %s", gnutls_strerror(ret));
441                                         CloseSession(session);                                  
442                                 }
443                         }
444                         else
445                         {
446                                 ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Successfully wrote %d bytes", ret);
447                                 session->outbuf = session->outbuf.substr(ret);
448                         }
449                 }
450                 else if(session->status == ISSL_CLOSING)
451                 {
452                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: session closing...");
453                 }
454                 
455                 return 1;
456         }
457         
458         // :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
459         virtual void OnWhois(userrec* source, userrec* dest)
460         {
461                 // Bugfix, only send this numeric for *our* SSL users
462                 if(dest->GetExt("ssl", dummy) || (IS_LOCAL(dest) &&  isin(dest->GetPort(), listenports)))
463                 {
464                         source->WriteServ("320 %s %s :is using a secure connection", source->nick, dest->nick);
465                 }
466         }
467         
468         virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
469         {
470                 // check if the linking module wants to know about OUR metadata
471                 if(extname == "ssl")
472                 {
473                         // check if this user has an swhois field to send
474                         if(user->GetExt(extname, dummy))
475                         {
476                                 // call this function in the linking module, let it format the data how it
477                                 // sees fit, and send it on its way. We dont need or want to know how.
478                                 proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "ON");
479                         }
480                 }
481         }
482         
483         virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata)
484         {
485                 // check if its our metadata key, and its associated with a user
486                 if ((target_type == TYPE_USER) && (extname == "ssl"))
487                 {
488                         userrec* dest = (userrec*)target;
489                         // if they dont already have an ssl flag, accept the remote server's
490                         if (!dest->GetExt(extname, dummy))
491                         {
492                                 dest->Extend(extname, "ON");
493                         }
494                 }
495         }
496         
497         bool Handshake(issl_session* session)
498         {               
499                 int ret = gnutls_handshake(session->sess);
500       
501       if(ret < 0)
502                 {
503                         if(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
504                         {
505                                 // Handshake needs resuming later, read() or write() would have blocked.
506                                 
507                                 if(gnutls_record_get_direction(session->sess) == 0)
508                                 {
509                                         // gnutls_handshake() wants to read() again.
510                                         session->status = ISSL_HANDSHAKING_READ;
511                                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (reading) later, error string: %s", gnutls_strerror(ret));
512                                 }
513                                 else
514                                 {
515                                         // gnutls_handshake() wants to write() again.
516                                         session->status = ISSL_HANDSHAKING_WRITE;
517                                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (writing) later, error string: %s", gnutls_strerror(ret));
518                                         MakePollWrite(session); 
519                                 }
520                         }
521                         else
522                         {
523                                 // Handshake failed.
524                                 CloseSession(session);
525                            ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake failed, error string: %s", gnutls_strerror(ret));
526                            session->status = ISSL_CLOSING;
527                         }
528                         
529                         return false;
530                 }
531                 else
532                 {
533                         // Handshake complete.
534                         ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake completed");
535                         
536                         // This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater.
537                         userrec* extendme = ServerInstance->FindDescriptor(session->fd);
538                         if (extendme)
539                         {
540                                 if (!extendme->GetExt("ssl", dummy))
541                                         extendme->Extend("ssl", "ON");
542                         }
543
544                         // Change the seesion state
545                         session->status = ISSL_HANDSHAKEN;
546                         
547                         // Finish writing, if any left
548                         MakePollWrite(session);
549                         
550                         return true;
551                 }
552         }
553
554         virtual void OnGlobalConnect(userrec* user)
555         {
556                 // This occurs AFTER OnUserConnect so we can be sure the
557                 // protocol module has propogated the NICK message.
558                 if ((user->GetExt("ssl", dummy)) && (IS_LOCAL(user)))
559                 {
560                         // Tell whatever protocol module we're using that we need to inform other servers of this metadata NOW.
561                         std::deque<std::string>* metadata = new std::deque<std::string>;
562                         metadata->push_back(user->nick);
563                         metadata->push_back("ssl");             // The metadata id
564                         metadata->push_back("ON");              // The value to send
565                         Event* event = new Event((char*)metadata,(Module*)this,"send_metadata");
566                         event->Send(ServerInstance);            // Trigger the event. We don't care what module picks it up.
567                         DELETE(event);
568                         DELETE(metadata);
569                 }
570         }
571         
572         void MakePollWrite(issl_session* session)
573         {
574                 OnRawSocketWrite(session->fd, NULL, 0);
575         }
576         
577         void CloseSession(issl_session* session)
578         {
579                 if(session->sess)
580                 {
581                         gnutls_bye(session->sess, GNUTLS_SHUT_WR);
582                         gnutls_deinit(session->sess);
583                 }
584                 
585                 if(session->inbuf)
586                 {
587                         delete[] session->inbuf;
588                 }
589                 
590                 session->outbuf.clear();
591                 session->inbuf = NULL;
592                 session->sess = NULL;
593                 session->status = ISSL_NONE;
594         }
595 };
596
597 class ModuleSSLGnuTLSFactory : public ModuleFactory
598 {
599  public:
600         ModuleSSLGnuTLSFactory()
601         {
602         }
603         
604         ~ModuleSSLGnuTLSFactory()
605         {
606         }
607         
608         virtual Module * CreateModule(InspIRCd* Me)
609         {
610                 return new ModuleSSLGnuTLS(Me);
611         }
612 };
613
614
615 extern "C" void * init_module( void )
616 {
617         return new ModuleSSLGnuTLSFactory;
618 }