Skip to content

Commit

Permalink
Add ircd-irc2 test server
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielOaks committed Mar 28, 2019
1 parent 95f9a1d commit 683947a
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 0 deletions.
104 changes: 104 additions & 0 deletions ircd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
FROM alpine:3.9 AS build-env

# install latest updates and configure alpine
RUN apk update
RUN apk upgrade
RUN apk add --no-cache build-base git

# get ircd
WORKDIR /tmp
RUN wget http://www.irc.org/ftp/irc/server/irc2.11.2p3.tgz
RUN tar -xzf irc2.11.2p3.tgz

# configure it
WORKDIR /tmp/irc2.11.2p3
RUN ./configure --prefix=/ircd-bin
# # IPv6 results in "No working P-line in ircd.conf" so we don't do it ¯\_(ツ)_/¯
# RUN ./configure --enable-ipv6 --prefix=/ircd-bin

# apply weird alpine patch
WORKDIR /tmp/irc2.11.2p3/ircd/
COPY ircd-alpine.patch /tmp/ircd-alpine.patch
RUN patch < /tmp/ircd-alpine.patch

# apply kline/xline-enabling patch
# we use git here because busybox's default patch seems kinda ew
WORKDIR /tmp/irc2.11.2p3/x86_64-unknown-linux-gnu
COPY ircd-kline.patch /tmp/ircd-kline.patch
RUN cp config.h config.h.old
RUN git apply /tmp/ircd-kline.patch

# building!
RUN make all
RUN make install

CMD /bin/sh



## run unreal
FROM alpine:3.9

# metadata
LABEL maintainer="[email protected]"
LABEL description="IRC Foundation IRCd-irc2 Testing Server"

# install latest updates and configure alpine
RUN apk update
RUN apk upgrade
RUN mkdir /lib/modules

# ircd ports
EXPOSE 4440/tcp 5550/tcp

# copy over the ircd
COPY --from=build-env /ircd-bin /ircd-bin
COPY ircd.conf /ircd-bin/etc/ircd.conf
COPY ircd.motd /ircd-bin/etc/ircd.motd

# launch
WORKDIR /ircd-bin
ENTRYPOINT ["/ircd-bin/sbin/ircd", "-t"]









FROM alpine:3.9

RUN apk update
RUN apk upgrade

WORKDIR /tmp
RUN wget http://www.irc.org/ftp/irc/server/irc2.11.2p3.tgz
RUN tar -xzf irc2.11.2p3.tgz

RUN apk add --no-cache build-base git

WORKDIR /tmp/irc2.11.2p3
RUN ./configure --prefix=/ircd-bin
# # IPv6 results in "No working P-line in ircd.conf" so we don't do it ¯\_(ツ)_/¯
# RUN ./configure --enable-ipv6 --prefix=/ircd-bin

WORKDIR /tmp/irc2.11.2p3/ircd/
COPY ircd-alpine.patch /tmp/ircd-alpine.patch
RUN patch < /tmp/ircd-alpine.patch

# we use git here because the default patch is horrific
WORKDIR /tmp/irc2.11.2p3/x86_64-unknown-linux-gnu
COPY ircd-kline.patch /tmp/ircd-kline.patch
RUN cp config.h config.h.old
RUN git apply /tmp/ircd-kline.patch

RUN make all
RUN make install

COPY ircd.conf /ircd-bin/etc/ircd.conf
COPY ircd.motd /ircd-bin/etc/ircd.motd

WORKDIR /ircd-bin
CMD /ircd-bin/sbin/ircd -t
11 changes: 11 additions & 0 deletions ircd/ircd-alpine.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- ircd/s_bsd.c.old 2010-08-14 05:58:46.000000000 +1000
+++ ircd/s_bsd.c 2019-03-28 00:19:14.000000000 +1000
@@ -812,7 +812,7 @@
#elif defined (__CYGWIN32__) || defined(__APPLE__)
(void)setpgrp();
#else
- (void)setpgrp(0, (int)getpid());
+ (void)setpgrp();
#endif
(void)fclose(stdin);
(void)close(0);
22 changes: 22 additions & 0 deletions ircd/ircd-kline.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/config.h.old b/config.h
index c852373..8402902 100644
--- a/config.h.old
+++ b/config.h
@@ -105,7 +105,7 @@
/*
* Define this if you want to have KLINE command for opers and services.
*/
-#undef KLINE
+#define KLINE

/*
* Define this if you want to have TKLINE and UNTKLINE commands
@@ -457,7 +457,7 @@
** This adds ability to ban users with specified realnames from
** connecting to the server. May be useful for various drones.
*/
-#undef XLINE
+#define XLINE

/*
** Define the reason users get as a rejection message.
162 changes: 162 additions & 0 deletions ircd/ircd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
############################
# M: [MANDATORY]. This line sets your server's name, description and port
# the server listens for UDP pings (used to determine the fastest link in a
# class when autoconnecting)
#
# M:<Server NAME>:<YOUR Internet IP#>:<Geographic Location>:<Port>:<SID>:
M:ircd.example.irc.com::Aus:4440:000A
#
############################
# A: [MANDATORY]. This line lists your administrative information
# (contact address, etc). To view this information, /admin (server) will
# show it to you.
#
# A:<Your Name/Location>:<Your E-Mail Addr>:<other info>::<network name>:
# Note that <network name> *must* be one word.
#
A:IRC Foundation:Dan <[email protected]>:Client Server::ExampleNet:
#
#
############################
# P: [MANDATORY]. This field allows the server to listen on various ports
# for connections. Any internet domain port that is below 1024 means the
# ircd has to be run as root, or from inetd. The server can listen to ports
# in the UNIX domain or the internet domain. If you wish to create a port
# in the UNIX domain you must compile with UNIXPORT defined in config.h.
#
# P:<YOUR Internet IP#>:<*>::<Port>:<Flags>
# P:<Directory>:<*>:<*>:<Port>:<Flags>
#
# Note that it's a good idea to open some more ports than 6667 for
# server-server connections and local clients in case some running wild
# client blocks the default 6667.
#
# The default, an internet domain socket on port 6667 listening on all
# ip addresses of the machine running ircd
P::::4440::
#
#
############################
# Y: [SUGGESTED]. These lines define connection classes. Connection
# classes allow you to fine-tune your client and server connections.
# Since the fields have different meanings for server and client classes
# you shouldn't mix them, and if you have lots of server connections (if
# you do have lots of servers you shouldn't be reading this file :-) each
# set of servers (defined arbitrarily by you) should have its own class.
# If you have clients coming in from lots of different sites, you may want
# to seperate them out into classes. For instance, you may want to put
# local users in one class, with remote users in another class. You may also
# want to put limits on some client classes (one client only for indials
# for example). In any larger network you definitely want to do this.
#
# For SERVER CLASSES, the fields are:
# Y:<Class>:<Ping Frequency>:<Connect freq>:<Max Links>:<SendQ>::
# 1 2 3 4 5 67
# 1 class number
# 2 ping frequency (in seconds)
# 3 connect frequency (in seconds)
# 4 maximum number of automatically initiated links in this class
# 5 sendq
# 6 unused for server classes
# 7 unused for server classes
#
# Sendq have the format <x>.<y>, where x defines sendq whereas y defines
# burst sendq. It is useful to have for example 1MB normal sendq and 20MB
# of burst sendq, which allows for quicker broken link detection.
#
# The class numbers are not arbitrary. In auto-connecting servers -- that is,
# servers that you have a port number (e.g. 6667) on the end of the C: line
# (see below) the higher the number the higher the priority in auto-connecting.
#
# Note that it is a good idea to have ping frequency the same at both ends
# of the link.
#
# This is a normal (uncompressed) server connection (normal as of January, 2005)
# Y:<Class>:<Ping Frequencys>:<Connect freq>:<Max Links>:<SendQ>::
Y:2:90:300:1:20000000::
#
#
# For CLIENT CLASSES, the fields are:
# Y:<Class>:<Ping Frequency>::<Max Links>:<SendQ>:<Local Limit>:<Global Limit>:
# 1 2 3 4 5 6 7
# 1 class number
# 2 ping frequency (in seconds)
# 3 unused for client classes
# 4 maximum number of links in this class (per I line)
# 5 sendQ for each client
# 6 maximum number of links from this [user@]host on the server
# 7 maximum number of links from this [user@]host on the net
#
# Local and global limits have the format <x>.<y> where x defines the maximum
# number of clients from the same host (IP) whereas y defines the maximum
# number of clients from the same user@host (IP) allowed to connect. the
# latter uses the identd replies to identify a user, falling back to an
# @host limit if no identd runs on the client and fails for identds generating
# dynamical answers.
#
# Note that any unset values default to zero which means 'unlimited', except
# for limits, where default is 1.1
#
# Y:<Class>:<Ping Frequency>::<Max Links>:<SendQ>:<Local Limit>:<Global Limit>:
# this is a class for multiuser systems allowing 10 local clients per host
Y:10:90::100:512000:10.2:32.2:
#
# This is a class for multiuser systems running a trustworthy identd
Y:11:90::100:512000:0.1:0.2:
#
# This is a class for single user systems (PCs, most indials, ...)
Y:12:90::100:512000:1.1:2.1:
#
# This is a class for remote systems you want to allow as fallback only
# (if you run an open server in a net you might really want this)
Y:13:90::1000:512000:0.0:0.0:
#
#
############################
# I: [MANDATORY]. The I: lines are client-authorization lines. Without
# these lines, no clients will be able to connect to your server.
# Wildcards ("*") are permitted. Passwords are also possible (clients can
# be configured to send passwords) but optional. 'I' allows full access,
# 'i' sets restricted mode which forbids nick changes and channel op status.
# Note that 'i' is deprecated and you should use <Flags> (see INSTALL).
#
# <TARGET Host Addr> accepts CIDR format.
#
# I:<TARGET Host Addr>:<Password>:<TARGET Hosts NAME>:<Port>:<Class>:<Flags>:
#
# NOTE that ircd matches on both fields and if <TARGET Hosts NAME>
# is not empty (even if "*"), the client is required to have DNS.
#
# This would allow access for any client reaching this line which doesn't
# already have at least one connection to the net. if you run an open server
# in a net this might be the right choice, talk to your uplinks first anyway.
# Note listing this i: line first, it will be checked *last*, meaning it is
# the "fall-through".
I:*@*::::13::
# With the password 'foobar'
#i:*@*:foobar:::13::
#
# this would allow access for any client coming from *.net, *.org, *.com or
# other 3 char TLD
#i:::*@*.???:13::
#
#
############################
# O: [OPTIONAL]. These lines define operator access. You do not need to
# have an operator to run a server. A well configured leaf site should not
# need an operator online, if its connections are well defined, the irc
# administrator can use 'kill -HUP' on the ircd to reload the configuration
# file.
#
# O:<TARGET Host NAME>:<Password>:<Nickname>:<Port>:<Class>:<Flags>:
#
# If the person in "Nickname" is not coming from the hostname defined in
# the first field then the person will get the error message "No O: lines
# for your host".
#
# Note that you don't need to use 'Nickname' to become operator, if you're
# using some other nick at that moment '/oper Nickname' will do also.
#
O:*:password:alice::13:
O:*:password:daniel::13:
#
1 change: 1 addition & 0 deletions ircd/ircd.motd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the MOTD

0 comments on commit 683947a

Please sign in to comment.