I don't know if someone is interested in such a thing, but I needed to encrypt the communication between IRC bouncer and Bot partyline, but in an easy and fast way. Instead of integrating a complex method of accepting and handling SSL-connections, I decided for stunnel, a SSL-wrapper for TCP protocols (http://www.stunnel.org).
I have extended the CTCP module of the eggdrop by a handler for CTCP "SCHAT", which will just return another connection port, which is handled by stunnel. I attached the patch for the ctcp.c (eggdrop version 1.6.18). Patch your eggdrop version with it and then you have to setup the parameter 'ctcp-client-ssl' in your eggdrop configuration:
Code: Select all
loadmodule ctcp
set ctcp-client-ssl [accept-port-of-stunnel]
The stunnel configuration should be like this:
Code: Select all
; Service-level configuration
[botname]
accept = [accept-port-of-stunnel]
connect = [listening-port-of-your-eggdrop]
This results in the following way to build up a SSL DCC-Chat connection:
1. Client sends a CTCP "SCHAT" to the bot (/CTCP YourBot SCHAT)
2. Since the psyBNC has pendings DCCs enabled, it accepts the CTCP reply from the bot and offers the Client to answer the DCC request:
Code: Select all
-> [YourBot] SCHAT
<-psyBNC> YourBot sent a DCC Chat Request. Use /DCCANSWER YourBot or
/DCCANSWER S=YourBot (SSL) to establish the connection ([Bot-IP]/[accept-port-of-stunnel]).
As you can see, the CTCP reply does not include the telnet port of the eggdrop - it includes the port configured by 'ctcp-client-ssl'
3. Client answers with /DCCANSWER S=YourBot and the connection is built up!
Congratulations!
Have fun with this!
naaina
And now the diff:
Code: Select all
35,36d34
< static int client_ssl = -1;
<
177,210d174
< static int ctcp_CHATSSL(char *nick, char *uhost, char *handle, char *object,
< char *keyword, char *text)
< {
< struct userrec *u = get_user_by_handle(userlist, handle);
< int atr = u ? u->flags : 0, i;
<
< if ((atr & (USER_PARTY | USER_XFER)) || ((atr & USER_OP) && !require_p)) {
<
< if (u_pass_match(u, "-")) {
< simple_sprintf(ctcp_reply, "%s\001ERROR no password set\001",
< ctcp_reply);
< return 1;
< }
<
< for (i = 0; i < dcc_total; i++) {
< if ((dcc[i].type->flags & DCT_LISTEN) &&
< (!strcmp(dcc[i].nick, "(telnet)") ||
< !strcmp(dcc[i].nick, "(users)"))) {
< /* Do me a favour and don't change this back to a CTCP reply,
< * CTCP replies are NOTICE's this has to be a PRIVMSG
< * -poptix 5/1/1997 */
< int port = client_ssl;
< if(port == -1) port = dcc[i].port;
< dprintf(DP_SERVER, "PRIVMSG %s :\001DCC CHAT chat %lu %u\001\n",
< nick, iptolong(natip[0] ? (IP) inet_addr(natip) : getmyip()),
< port);
< return 1;
< }
< }
< simple_sprintf(ctcp_reply, "%s\001ERROR no telnet port\001", ctcp_reply);
< }
< return 1;
< }
<
221d184
< {"SCHAT", "", ctcp_CHATSSL, NULL},
234d196
< {"ctcp-client-ssl", &client_ssl},