]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/extra/m_ssl_openssl.cpp
Certificate stuff
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_openssl.cpp
1 #include <string>
2 #include <vector>
3
4 #include <openssl/ssl.h>
5 #include <openssl/err.h>
6
7 #include "inspircd_config.h"
8 #include "configreader.h"
9 #include "users.h"
10 #include "channels.h"
11 #include "modules.h"
12
13 #include "socket.h"
14 #include "hashcomp.h"
15 #include "inspircd.h"
16
17 #include "ssl_cert.h"
18
19 /* $ModDesc: Provides SSL support for clients */
20 /* $CompileFlags: -I/usr/include -I/usr/local/include */
21 /* $LinkerFlags: -L/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib -L/usr/lib -Wl,--rpath -Wl,/usr/lib -lssl */
22
23
24
25 enum issl_status { ISSL_NONE, ISSL_HANDSHAKING, ISSL_OPEN };
26 enum issl_io_status { ISSL_WRITE, ISSL_READ };
27
28 bool isin(int port, const std::vector<int> &portlist)
29 {
30         for(unsigned int i = 0; i < portlist.size(); i++)
31                 if(portlist[i] == port)
32                         return true;
33                         
34         return false;
35 }
36
37 char* get_error()
38 {
39         return ERR_error_string(ERR_get_error(), NULL);
40 }
41
42 class issl_session : public classbase
43 {
44 public:
45         SSL* sess;
46         issl_status status;
47         issl_io_status rstat;
48         issl_io_status wstat;
49
50         unsigned int inbufoffset;
51         char* inbuf;                    // Buffer OpenSSL reads into.
52         std::string outbuf;     // Buffer for outgoing data that OpenSSL will not take.
53         int fd;
54         
55         issl_session()
56         {
57                 rstat = ISSL_READ;
58                 wstat = ISSL_WRITE;
59         }
60 };
61
62 class ModuleSSLOpenSSL : public Module
63 {
64         
65         ConfigReader* Conf;
66         
67         CullList* culllist;
68         
69         std::vector<int> listenports;
70         
71         int inbufsize;
72         issl_session sessions[MAX_DESCRIPTORS];
73         
74         SSL_CTX* ctx;
75         
76         char* dummy;
77         
78         std::string keyfile;
79         std::string certfile;
80         std::string cafile;
81         // std::string crlfile;
82         std::string dhfile;
83         
84  public:
85         
86         ModuleSSLOpenSSL(InspIRCd* Me)
87                 : Module::Module(Me)
88         {
89                 
90
91                 culllist = new CullList(ServerInstance);
92                 
93                 // Not rehashable...because I cba to reduce all the sizes of existing buffers.
94                 inbufsize = ServerInstance->Config->NetBufferSize;
95                 
96                 /* Global SSL library initialization*/
97                 SSL_library_init();
98                 SSL_load_error_strings();
99                 
100                 /* Build our SSL context*/
101                 ctx = SSL_CTX_new( SSLv23_server_method() );
102
103                 // Needs the flag as it ignores a plain /rehash
104                 OnRehash("ssl");
105         }
106         
107         virtual void OnRehash(const std::string &param)
108         {
109                 if(param != "ssl")
110                         return;
111         
112                 Conf = new ConfigReader(ServerInstance);
113                         
114                 for(unsigned int i = 0; i < listenports.size(); i++)
115                 {
116                         ServerInstance->Config->DelIOHook(listenports[i]);
117                 }
118                 
119                 listenports.clear();
120                 
121                 for(int i = 0; i < Conf->Enumerate("bind"); i++)
122                 {
123                         // For each <bind> tag
124                         if(((Conf->ReadValue("bind", "type", i) == "") || (Conf->ReadValue("bind", "type", i) == "clients")) && (Conf->ReadValue("bind", "ssl", i) == "openssl"))
125                         {
126                                 // Get the port we're meant to be listening on with SSL
127                                 unsigned int port = Conf->ReadInteger("bind", "port", i, true);
128                                 if (ServerInstance->Config->AddIOHook(port, this))
129                                 {
130                                         // We keep a record of which ports we're listening on with SSL
131                                         listenports.push_back(port);
132                                 
133                                         ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", port);
134                                 }
135                                 else
136                                 {
137                                         ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port);
138                                 }
139                         }
140                 }
141                 
142                 std::string confdir(CONFIG_FILE);
143                 // +1 so we the path ends with a /
144                 confdir = confdir.substr(0, confdir.find_last_of('/') + 1);
145                 
146                 cafile  = Conf->ReadValue("openssl", "cafile", 0);
147                 // crlfile      = Conf->ReadValue("openssl", "crlfile", 0);
148                 certfile        = Conf->ReadValue("openssl", "certfile", 0);
149                 keyfile = Conf->ReadValue("openssl", "keyfile", 0);
150                 dhfile  = Conf->ReadValue("openssl", "dhfile", 0);
151                 
152                 // Set all the default values needed.
153                 if(cafile == "")
154                         cafile = "ca.pem";
155                         
156                 //if(crlfile == "")
157                 //      crlfile = "crl.pem";
158                         
159                 if(certfile == "")
160                         certfile = "cert.pem";
161                         
162                 if(keyfile == "")
163                         keyfile = "key.pem";
164                         
165                 if(dhfile == "")
166                         dhfile = "dhparams.pem";
167                         
168                 // Prepend relative paths with the path to the config directory.        
169                 if(cafile[0] != '/')
170                         cafile = confdir + cafile;
171                 
172                 //if(crlfile[0] != '/')
173                 //      crlfile = confdir + crlfile;
174                         
175                 if(certfile[0] != '/')
176                         certfile = confdir + certfile;
177                         
178                 if(keyfile[0] != '/')
179                         keyfile = confdir + keyfile;
180                         
181                 if(dhfile[0] != '/')
182                         dhfile = confdir + dhfile;
183
184                 /* Load our keys and certificates*/
185                 if(!SSL_CTX_use_certificate_chain_file(ctx, certfile.c_str()))
186                 {
187                         ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read certificate file %s", certfile.c_str());
188                 }
189
190                 if(!SSL_CTX_use_PrivateKey_file(ctx, keyfile.c_str(), SSL_FILETYPE_PEM))
191                 {
192                         ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read key file %s", keyfile.c_str());
193                 }
194
195                 /* Load the CAs we trust*/
196                 if(!SSL_CTX_load_verify_locations(ctx, cafile.c_str(), 0))
197                 {
198                         ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read CA list from ", cafile.c_str());
199                 }
200
201                 FILE* dhpfile = fopen(dhfile.c_str(), "r");
202                 DH* ret;
203
204                 if(dhpfile == NULL)
205                 {
206                         ServerInstance->Log(DEFAULT, "m_ssl_openssl.so Couldn't open DH file %s: %s", dhfile.c_str(), strerror(errno));
207                         throw ModuleException();
208                 }
209                 else
210                 {
211                         ret = PEM_read_DHparams(dhpfile, NULL, NULL, NULL);
212                 
213                         if(SSL_CTX_set_tmp_dh(ctx, ret) < 0)
214                         {
215                                 ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters");
216                         }
217                 }
218                 
219                 fclose(dhpfile);
220
221                 DELETE(Conf);
222         }
223
224         virtual ~ModuleSSLOpenSSL()
225         {
226                 SSL_CTX_free(ctx);
227                 delete culllist;
228         }
229         
230         virtual void OnCleanup(int target_type, void* item)
231         {
232                 if(target_type == TYPE_USER)
233                 {
234                         userrec* user = (userrec*)item;
235                         
236                         if(user->GetExt("ssl", dummy) && IS_LOCAL(user) && isin(user->GetPort(), listenports))
237                         {
238                                 // User is using SSL, they're a local user, and they're using one of *our* SSL ports.
239                                 // Potentially there could be multiple SSL modules loaded at once on different ports.
240                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Adding user %s to cull list", user->nick);
241                                 culllist->AddItem(user, "SSL module unloading");
242                         }
243                 }
244         }
245         
246         virtual void OnUnloadModule(Module* mod, const std::string &name)
247         {
248                 if(mod == this)
249                 {
250                         // We're being unloaded, kill all the users added to the cull list in OnCleanup
251                         int numusers = culllist->Apply();
252                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Killed %d users for unload of OpenSSL SSL module", numusers);
253                         
254                         for(unsigned int i = 0; i < listenports.size(); i++)
255                                 ServerInstance->Config->DelIOHook(listenports[i]);
256                 }
257         }
258         
259         virtual Version GetVersion()
260         {
261                 return Version(1, 0, 0, 0, VF_VENDOR);
262         }
263
264         void Implements(char* List)
265         {
266                 List[I_OnRawSocketAccept] = List[I_OnRawSocketClose] = List[I_OnRawSocketRead] = List[I_OnRawSocketWrite] = List[I_OnCleanup] = 1;
267                 List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = List[I_OnPostConnect] = 1;
268         }
269
270         virtual void OnRawSocketAccept(int fd, const std::string &ip, int localport)
271         {
272                 issl_session* session = &sessions[fd];
273         
274                 session->fd = fd;
275                 session->inbuf = new char[inbufsize];
276                 session->inbufoffset = 0;               
277                 session->sess = SSL_new(ctx);
278                 session->status = ISSL_NONE;
279         
280                 if(session->sess == NULL)
281                 {
282                         ServerInstance->Log(DEBUG, "m_ssl.so: Couldn't create SSL object: %s", get_error());
283                         return;
284                 }
285                 
286                 if(SSL_set_fd(session->sess, fd) == 0)
287                 {
288                         ServerInstance->Log(DEBUG, "m_ssl.so: Couldn't set fd for SSL object: %s", get_error());
289                         return;
290                 }
291
292                 Handshake(session);
293         }
294
295         virtual void OnRawSocketClose(int fd)
296         {
297                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketClose: %d", fd);
298                 CloseSession(&sessions[fd]);
299         }
300         
301         virtual int OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult)
302         {
303                 issl_session* session = &sessions[fd];
304                 
305                 if(!session->sess)
306                 {
307                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: No session to read from");
308                         readresult = 0;
309                         CloseSession(session);
310                         return 1;
311                 }
312                 
313                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead(%d, buffer, %u, %d)", fd, count, readresult);
314                 
315                 if(session->status == ISSL_HANDSHAKING)
316                 {
317                         if(session->rstat == ISSL_READ || session->wstat == ISSL_READ)
318                         {
319                                 // The handshake isn't finished and it wants to read, try to finish it.
320                                 if(Handshake(session))
321                                 {
322                                         // Handshake successfully resumed.
323                                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: successfully resumed handshake");
324                                 }
325                                 else
326                                 {
327                                         // Couldn't resume handshake.   
328                                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: failed to resume handshake");
329                                         return -1;
330                                 }
331                         }
332                         else
333                         {
334                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketRead: handshake wants to write data but we are currently reading");
335                                 return -1;                      
336                         }
337                 }
338                 
339                 // If we resumed the handshake then session->status will be ISSL_OPEN
340                                 
341                 if(session->status == ISSL_OPEN)
342                 {
343                         if(session->wstat == ISSL_READ)
344                         {
345                                 if(DoWrite(session) == 0)
346                                         return 0;
347                         }
348                         
349                         if(session->rstat == ISSL_READ)
350                         {
351                                 int ret = DoRead(session);
352                         
353                                 if(ret > 0)
354                                 {
355                                         if(count <= session->inbufoffset)
356                                         {
357                                                 memcpy(buffer, session->inbuf, count);
358                                                 // Move the stuff left in inbuf to the beginning of it
359                                                 memcpy(session->inbuf, session->inbuf + count, (session->inbufoffset - count));
360                                                 // Now we need to set session->inbufoffset to the amount of data still waiting to be handed to insp.
361                                                 session->inbufoffset -= count;
362                                                 // Insp uses readresult as the count of how much data there is in buffer, so:
363                                                 readresult = count;
364                                         }
365                                         else
366                                         {
367                                                 // There's not as much in the inbuf as there is space in the buffer, so just copy the whole thing.
368                                                 memcpy(buffer, session->inbuf, session->inbufoffset);
369                                                 
370                                                 readresult = session->inbufoffset;
371                                                 // Zero the offset, as there's nothing there..
372                                                 session->inbufoffset = 0;
373                                         }
374                                 
375                                         return 1;
376                                 }
377                                 else
378                                 {
379                                         return ret;
380                                 }
381                         }
382                 }
383                 
384                 return -1;
385         }
386         
387         virtual int OnRawSocketWrite(int fd, const char* buffer, int count)
388         {               
389                 issl_session* session = &sessions[fd];
390
391                 if(!session->sess)
392                 {
393                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: No session to write to");
394                         CloseSession(session);
395                         return 1;
396                 }
397                 
398                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: Adding %d bytes to the outgoing buffer", count);                
399                 session->outbuf.append(buffer, count);
400                 
401                 if(session->status == ISSL_HANDSHAKING)
402                 {
403                         // The handshake isn't finished, try to finish it.
404                         if(session->rstat == ISSL_WRITE || session->wstat == ISSL_WRITE)
405                         {
406                                 if(Handshake(session))
407                                 {
408                                         // Handshake successfully resumed.
409                                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: successfully resumed handshake");
410                                 }
411                                 else
412                                 {
413                                         // Couldn't resume handshake.   
414                                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: failed to resume handshake"); 
415                                 }
416                         }
417                         else
418                         {
419                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: OnRawSocketWrite: handshake wants to read data but we are currently writing");                    
420                         }
421                 }
422                 
423                 if(session->status == ISSL_OPEN)
424                 {
425                         if(session->rstat == ISSL_WRITE)
426                         {
427                                 DoRead(session);
428                         }
429                         
430                         if(session->wstat == ISSL_WRITE)
431                         {
432                                 return DoWrite(session);
433                         }
434                 }
435                 
436                 return 1;
437         }
438         
439         int DoWrite(issl_session* session)
440         {
441                 int ret = SSL_write(session->sess, session->outbuf.data(), session->outbuf.size());
442                 
443                 if(ret == 0)
444                 {
445                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Client closed the connection");
446                         CloseSession(session);
447                         return 0;
448                 }
449                 else if(ret < 0)
450                 {
451                         int err = SSL_get_error(session->sess, ret);
452                         
453                         if(err == SSL_ERROR_WANT_WRITE)
454                         {
455                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Not all SSL data written, need to retry: %s", get_error());
456                                 session->wstat = ISSL_WRITE;
457                                 return -1;
458                         }
459                         else if(err == SSL_ERROR_WANT_READ)
460                         {
461                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Not all SSL data written but the damn thing wants to read instead: %s", get_error());
462                                 session->wstat = ISSL_READ;
463                                 return -1;
464                         }
465                         else
466                         {
467                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Error writing SSL data: %s", get_error());
468                                 CloseSession(session);
469                                 return 0;
470                         }
471                 }
472                 else
473                 {
474                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoWrite: Successfully wrote %d bytes", ret);
475                         session->outbuf = session->outbuf.substr(ret);
476                         return ret;
477                 }
478         }
479         
480         int DoRead(issl_session* session)
481         {
482                 // Is this right? Not sure if the unencrypted data is garaunteed to be the same length.
483                 // Read into the inbuffer, offset from the beginning by the amount of data we have that insp hasn't taken yet.
484                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: SSL_read(sess, inbuf+%d, %d-%d)", session->inbufoffset, inbufsize, session->inbufoffset);
485                         
486                 int ret = SSL_read(session->sess, session->inbuf + session->inbufoffset, inbufsize - session->inbufoffset);
487
488                 if(ret == 0)
489                 {
490                         // Client closed connection.
491                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Client closed the connection");
492                         CloseSession(session);
493                         return 0;
494                 }
495                 else if(ret < 0)
496                 {
497                         int err = SSL_get_error(session->sess, ret);
498                                 
499                         if(err == SSL_ERROR_WANT_READ)
500                         {
501                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Not all SSL data read, need to retry: %s", get_error());
502                                 session->rstat = ISSL_READ;
503                                 return -1;
504                         }
505                         else if(err == SSL_ERROR_WANT_WRITE)
506                         {
507                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Not all SSL data read but the damn thing wants to write instead: %s", get_error());
508                                 session->rstat = ISSL_WRITE;
509                                 return -1;
510                         }
511                         else
512                         {
513                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Error reading SSL data: %s", get_error());
514                                 CloseSession(session);
515                                 return 0;
516                         }
517                 }
518                 else
519                 {
520                         // Read successfully 'ret' bytes into inbuf + inbufoffset
521                         // There are 'ret' + 'inbufoffset' bytes of data in 'inbuf'
522                         // 'buffer' is 'count' long
523                         
524                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Read %d bytes, now have %d waiting to be passed up", ret, ret + session->inbufoffset);
525
526                         session->inbufoffset += ret;
527
528                         return ret;
529                 }
530         }
531         
532         // :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
533         virtual void OnWhois(userrec* source, userrec* dest)
534         {
535                 // Bugfix, only send this numeric for *our* SSL users
536                 if(dest->GetExt("ssl", dummy) || (IS_LOCAL(dest) &&  isin(dest->GetPort(), listenports)))
537                 {
538                         source->WriteServ("320 %s %s :is using a secure connection", source->nick, dest->nick);
539                 }
540         }
541         
542         virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
543         {
544                 // check if the linking module wants to know about OUR metadata
545                 if(extname == "ssl")
546                 {
547                         // check if this user has an swhois field to send
548                         if(user->GetExt(extname, dummy))
549                         {
550                                 // call this function in the linking module, let it format the data how it
551                                 // sees fit, and send it on its way. We dont need or want to know how.
552                                 proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "ON");
553                         }
554                 }
555         }
556         
557         virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata)
558         {
559                 // check if its our metadata key, and its associated with a user
560                 if ((target_type == TYPE_USER) && (extname == "ssl"))
561                 {
562                         userrec* dest = (userrec*)target;
563                         // if they dont already have an ssl flag, accept the remote server's
564                         if (!dest->GetExt(extname, dummy))
565                         {
566                                 dest->Extend(extname, "ON");
567                         }
568                 }
569         }
570         
571         bool Handshake(issl_session* session)
572         {               
573                 int ret = SSL_accept(session->sess);
574       
575                 if(ret < 0)
576                 {
577                         int err = SSL_get_error(session->sess, ret);
578                                 
579                         if(err == SSL_ERROR_WANT_READ)
580                         {
581                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Handshake: Not completed, need to read again: %s", get_error());
582                                 session->rstat = ISSL_READ;
583                                 session->status = ISSL_HANDSHAKING;
584                         }
585                         else if(err == SSL_ERROR_WANT_WRITE)
586                         {
587                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Handshake: Not completed, need to write more data: %s", get_error());
588                                 session->wstat = ISSL_WRITE;
589                                 session->status = ISSL_HANDSHAKING;
590                                 MakePollWrite(session);
591                         }
592                         else
593                         {
594                                 ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Handshake: Failed, bailing: %s", get_error());
595                                 CloseSession(session);
596                         }
597
598                         return false;
599                 }
600                 else
601                 {
602                         // Handshake complete.
603                         ServerInstance->Log(DEBUG, "m_ssl_openssl.so: Handshake completed");
604                         
605                         // This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater.
606                         userrec* u = ServerInstance->FindDescriptor(session->fd);
607                         if (u)
608                         {
609                                 if (!u->GetExt("ssl", dummy))
610                                         u->Extend("ssl", "ON");
611                         }
612                         
613                         session->status = ISSL_OPEN;
614                         
615                         MakePollWrite(session);
616                         
617                         return true;
618                 }
619         }
620         
621         virtual void OnPostConnect(userrec* user)
622         {
623                 // This occurs AFTER OnUserConnect so we can be sure the
624                 // protocol module has propogated the NICK message.
625                 if ((user->GetExt("ssl", dummy)) && (IS_LOCAL(user)))
626                 {
627                         // Tell whatever protocol module we're using that we need to inform other servers of this metadata NOW.
628                         std::deque<std::string>* metadata = new std::deque<std::string>;
629                         metadata->push_back(user->nick);
630                         metadata->push_back("ssl");             // The metadata id
631                         metadata->push_back("ON");              // The value to send
632                         Event* event = new Event((char*)metadata,(Module*)this,"send_metadata");
633                         event->Send(ServerInstance);            // Trigger the event. We don't care what module picks it up.
634                         DELETE(event);
635                         DELETE(metadata);
636                 }
637         }
638         
639         void MakePollWrite(issl_session* session)
640         {
641                 OnRawSocketWrite(session->fd, NULL, 0);
642         }
643         
644         void CloseSession(issl_session* session)
645         {
646                 if(session->sess)
647                 {
648                         SSL_shutdown(session->sess);
649                         SSL_free(session->sess);
650                 }
651                 
652                 if(session->inbuf)
653                 {
654                         delete[] session->inbuf;
655                 }
656                 
657                 session->outbuf.clear();
658                 session->inbuf = NULL;
659                 session->sess = NULL;
660                 session->status = ISSL_NONE;
661         }
662
663         void VerifyCertificate(issl_session* session, userrec* user)
664         {
665
666
667
668
669         }
670 };
671
672 class ModuleSSLOpenSSLFactory : public ModuleFactory
673 {
674  public:
675         ModuleSSLOpenSSLFactory()
676         {
677         }
678         
679         ~ModuleSSLOpenSSLFactory()
680         {
681         }
682         
683         virtual Module * CreateModule(InspIRCd* Me)
684         {
685                 return new ModuleSSLOpenSSL(Me);
686         }
687 };
688
689
690 extern "C" void * init_module( void )
691 {
692         return new ModuleSSLOpenSSLFactory;
693 }