-
Notifications
You must be signed in to change notification settings - Fork 0
/
sslircd.rb
44 lines (38 loc) · 1.08 KB
/
sslircd.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Contributer: Michael.Guymon
# URL http://code.google.com/u/michael.guymon/
#
# Example for running ircd with ssl enabled.
# requires rsa.key and cert.pem to be created by the administrator.
require 'ircd'
require 'irc_client_service'
require 'netutils'
require 'openssl'
include NetUtils
begin
pkey = OpenSSL::PKey::RSA.new(File.open("rsa.key").read)
cert = OpenSSL::X509::Certificate.new(File.open("cert.pem").read)
s = IRCServer.new( :Port => 6667,
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
:SSLCertificate => cert,
:SSLPrivateKey => pkey,
:SSLCertName => [ [ "CN",WEBrick::Utils::getservername ] ] )
while arg = ARGV.shift
case arg
when /-v/
$verbose = true
end
end
trap("INT"){
s.carp "killing #{$$}"
system("kill -9 #{$$}")
s.shutdown
}
p = Thread.new {
s.do_ping()
}
s.start
rescue Exception => e
p e
carp e
end