17 Commits
i2p ... 0.0.05

Author SHA1 Message Date
idk
d4bdf43bfe Bump for re-release 2021-12-13 13:25:38 -05:00
idk
c792d21e93 Fix index 2021-12-13 13:23:28 -05:00
idk
48a91b87cb Fix index 2021-12-13 10:01:29 -05:00
idk
4045bbb373 fix updateurl 2021-12-11 21:09:39 -05:00
idk
a22f7d20d5 fix updateurl 2021-12-11 21:07:46 -05:00
idk
66473209bd upgrade 2021-12-11 19:28:35 -05:00
idk
7bffda6818 give it a page too 2021-12-11 15:38:45 -05:00
idk
73fe81d8d1 give it a page too 2021-12-11 15:18:06 -05:00
idk
a5c2783e8f give it a page too 2021-12-11 15:12:54 -05:00
idk
7eee870172 Add some gitignore stuff 2021-12-11 15:01:28 -05:00
idk
c960f84603 Add some gitignore stuff 2021-12-11 15:00:30 -05:00
idk
04475f172e Fix some build stuff 2021-12-11 14:58:25 -05:00
idk
d9c72ac9ee Release enginnering, this one's nice and generic, probably reusable 2021-12-11 13:56:06 -05:00
idk
c63c6c659e just terrarium for ShellService name 2021-11-07 20:08:45 -05:00
idk
91ad6cf100 Switch to using SIGINT for restarts 2021-11-07 17:08:58 -05:00
idk
6ff4194c85 fork from catbox 2021-10-21 16:20:32 -04:00
idk
491b82d735 Merge branch 'i2p' into 'master'
I2p

See merge request idk/terrarium!1
2021-10-21 20:07:37 +00:00
7 changed files with 267 additions and 22 deletions

5
.gitignore vendored
View File

@@ -1,3 +1,8 @@
*.swp
/catbox
/test-net
*.crt
*.crl
*.pem
terrarium
terrarium.exe

120
Makefile Normal file
View File

@@ -0,0 +1,120 @@
VERSION=0.0.05
CGO_ENABLED=0
export CGO_ENABLED=0
GOOS?=$(shell uname -s | tr A-Z a-z)
GOARCH?="amd64"
ARG=-v -tags netgo -ldflags '-w -extldflags "-static"'
BINARY=terrarium
SIGNER=hankhill19580@gmail.com
CONSOLEPOSTNAME=IRC
USER_GH=eyedeekay
build: dep
go build $(ARG) -tags="netgo" -o $(BINARY)-$(GOOS)-$(GOARCH) ./cmd/$(BINARY)
make su3
clean:
rm -f $(BINARY)-plugin plugin $(BINARY)-*zip -r
rm -f *.su3 *.zip $(BINARY)-$(GOOS)-$(GOARCH) $(BINARY)-*
all: windows linux osx bsd
windows:
GOOS=windows GOARCH=amd64 make build su3
GOOS=windows GOARCH=386 make build su3
linux:
GOOS=linux GOARCH=amd64 make build su3
GOOS=linux GOARCH=arm64 make build su3
GOOS=linux GOARCH=386 make build su3
osx:
GOOS=darwin GOARCH=amd64 make build su3
GOOS=darwin GOARCH=arm64 make build su3
bsd:
GOOS=freebsd GOARCH=amd64 make build su3
GOOS=openbsd GOARCH=amd64 make build su3
dep:
cp "$(HOME)/Workspace/GIT_WORK/i2p.i2p/build/shellservice.jar" conf/lib/shellservice.jar -v
su3:
i2p.plugin.native -name=$(BINARY)-$(GOOS)-$(GOARCH) \
-signer=$(SIGNER) \
-version "$(VERSION)" \
-author=$(SIGNER) \
-autostart=true \
-clientname=$(BINARY)-$(GOOS)-$(GOARCH) \
-consolename="$(BINARY) - $(CONSOLEPOSTNAME)" \
-consoleurl="http://127.0.0.1:8084" \
-name="$(BINARY)-$(GOOS)-$(GOARCH)" \
-delaystart="1" \
-desc="`cat desc`" \
-exename=$(BINARY)-$(GOOS)-$(GOARCH) \
-icondata=icon/icon.png \
-updateurl="http://idk.i2p/terrarium/$(BINARY)-$(GOOS)-$(GOARCH).su3" \
-website="http://idk.i2p/terrarium/" \
-command="$(BINARY)-$(GOOS)-$(GOARCH) -conf \"\$$PLUGIN/catbox-i2p.conf\"" \
-license=MIT \
-res=conf/
unzip -o $(BINARY)-$(GOOS)-$(GOARCH).zip -d $(BINARY)-$(GOOS)-$(GOARCH)-zip
sum:
sha256sum $(BINARY)-$(GOOS)-$(GOARCH).su3
version:
gothub release -u eyedeekay -r terrarium -t "$(VERSION)" -d "`cat desc`"; true
upload:
gothub upload -u eyedeekay -r terrarium -t "$(VERSION)" -f $(BINARY)-$(GOOS)-$(GOARCH).su3 -n $(BINARY)-$(GOOS)-$(GOARCH).su3 -l "`sha256sum $(BINARY)-$(GOOS)-$(GOARCH).su3`"
upload-windows:
GOOS=windows GOARCH=amd64 make upload
GOOS=windows GOARCH=386 make upload
upload-linux:
GOOS=linux GOARCH=amd64 make upload
GOOS=linux GOARCH=arm64 make upload
GOOS=linux GOARCH=386 make upload
upload-osx:
GOOS=darwin GOARCH=amd64 make upload
GOOS=darwin GOARCH=arm64 make upload
upload-bsd:
GOOS=freebsd GOARCH=amd64 make upload
GOOS=openbsd GOARCH=amd64 make upload
upload-all: upload-windows upload-linux upload-osx upload-bsd
download-su3s:
GOOS=windows GOARCH=amd64 make download-single-su3
GOOS=windows GOARCH=386 make download-single-su3
GOOS=linux GOARCH=amd64 make download-single-su3
GOOS=linux GOARCH=arm64 make download-single-su3
GOOS=linux GOARCH=386 make download-single-su3
GOOS=darwin GOARCH=amd64 make download-single-su3
GOOS=darwin GOARCH=arm64 make download-single-su3
GOOS=freebsd GOARCH=amd64 make download-single-su3
GOOS=openbsd GOARCH=amd64 make download-single-su3
download-single-su3:
wget -N -c "https://github.com/$(USER_GH)/$(BINARY)/releases/download/$(VERSION)/$(BINARY)-$(GOOS)-$(GOARCH).su3"
release: clean all version upload-all
index:
@echo "<!DOCTYPE html>" > index.html
@echo "<html>" >> index.html
@echo "<head>" >> index.html
@echo " <title>$(BINARY) - $(CONSOLEPOSTNAME)</title>" >> index.html
@echo " <link rel=\"stylesheet\" type=\"text/css\" href =\"/style.css\" />" >> index.html
@echo "</head>" >> index.html
@echo "<body>" >> index.html
pandoc README.md >> index.html
@echo "</body>" >> index.html
@echo "</html>" >> index.html

View File

@@ -1,12 +1,17 @@
![terrarium](doc/terrarium-with-text.png)
# ![terrarium](doc/terrarium-with-text.png)
[![Build
Status](https://travis-ci.org/eyedeekay/terrarium.svg)](https://travis-ci.org/eyedeekay/terrarium)
[![Go Report
Card](https://goreportcard.com/badge/i2pgit.org/idk/terrarium)](https://goreportcard.com/report/i2pgit.org/idk/terrarium)
terrarium is an IRC server with a focus on being small and understandable. The
goal is security.
terrarium is an IRC server with a focus on being small and understandable,
originally forked from [horgh/catbox](https://github.com/horgh/catbox). The
goal is to create an easy-to-configure I2P IRC server which is highly stable
and secure, while retaining the ability to link with non-I2P IRC servers using
TLS in order to bridge anonymous and non-anonymous chat. For now, Bridged
servers are not anonymous, this may change in the future as I evaluate the
feasibility of outproxies or Tor.
# Features
@@ -18,17 +23,32 @@ goal is security.
* TLS
terrarium implements enough of [RFC 1459](https://tools.ietf.org/html/rfc1459)
to be recognisable as IRC and be minimally functional. I likely won't add
much more and don't intend it to be complete. If I don't think something is
required it likely won't be here.
to be recognisable as IRC and be minimally functional. It will intentionally
omit unnecessary features. Priority features are those which enable moderation
and provide more flexible security.
# Plugin Installation URL's
[A guide to installing I2P plugins can be found on the I2P web site.](https://geti2p.net/en/docs/plugins)
### Inside I2P
- [Windows (In-I2P)](http://idk.i2p/terrarium/terrarium-windows-amd64.su3)
- [Linux (In-I2P)](http://idk.i2p/terrarium/terrarium-linux-amd64.su3)
### Outside I2P
- [Windows](https://github.com/terrarium/blizzard/releases)
- [Linux](https://github.com/terrarium/blizzard/releases)
# Installation
1. Download terrarium from the Releases tab on GitHub, or build from source
1. Clone the software from [i2pgit.org](https://i2pgit.org/idk/terrarium)
(`git clone https://i2pgit.org/idk/terrarium go/src/i2pgit.org/idk/terrarium && cd go/src/i2pgit.org/idk/terrarium`).
2. Build from source
(`go build`).
2. Configure terrarium through config files. There are example configs in the
3. Configure terrarium through config files. There are example configs in the
`conf` directory. All settings are optional and have defaults.
3. Run it, e.g. `./terrarium -conf terrarium.conf`. You might run it via systemd
4. Run it, e.g. `./terrarium -conf terrarium.conf`. You might run it via systemd
via a service such as:
```
@@ -73,9 +93,18 @@ Clients connect to the network hostname and verify against it. Servers
connect to each other by server hostname and verify against it.
## I2P
An example I2P configuration can be found in:
`conf/catbox-i2p.conf`
That's all the docs I have for now
# Why the name?
My domain name is summercat.com, cats love boxes, and a tribute to
ircd-ratbox, the IRC daemon I used in the past.
It was forked from an IRC server called catbox which had a focus on simplicity
and understandability. It now has the ability to connect to other IRC servers
through I2P Tunnels. Clearnet is to I2P Tunnels is sort of like Catbox is to
Terrarium.
# Logo

View File

@@ -4,13 +4,13 @@
# the option.
# Host to listen on.
#listen-host = 0.0.0.0
listen-host = 127.0.0.1
# Port to listen on. Set -1 to not listen.
#listen-port = -1
listen-port = 7667
# Port to listen on (TLS). Set -1 to not listen.
#listen-port-tls = -1
listen-port-tls = -1
listen-i2p = terrarium.i2p
sam-address = 127.0.0.1:7656

5
desc Normal file
View File

@@ -0,0 +1,5 @@
terrarium is an IRC server with a focus on being small and understandable,
originally forked from [horgh/catbox](https://github.com/horgh/catbox). The
goal is to create an easy-to-configure I2P IRC server which is highly stable
and secure, while retaining the ability to link with non-I2P IRC servers using
TLS in order to bridge anonymous and non-anonymous chat.

73
index.html Normal file
View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html>
<head>
<title>terrarium - IRC</title>
<link rel="stylesheet" type="text/css" href ="/style.css" />
</head>
<body>
<h1 id="terrarium"><img src="doc/terrarium-with-text.png" alt="terrarium" /></h1>
<p><a href="https://travis-ci.org/eyedeekay/terrarium"><img src="https://travis-ci.org/eyedeekay/terrarium.svg" alt="Build Status" /></a> <a href="https://goreportcard.com/report/i2pgit.org/idk/terrarium"><img src="https://goreportcard.com/badge/i2pgit.org/idk/terrarium" alt="Go Report Card" /></a></p>
<p>terrarium is an IRC server with a focus on being small and understandable, originally forked from <a href="https://github.com/horgh/catbox">horgh/catbox</a>. The goal is to create an easy-to-configure I2P IRC server which is highly stable and secure, while retaining the ability to link with non-I2P IRC servers using TLS in order to bridge anonymous and non-anonymous chat. For now, Bridged servers are not anonymous, this may change in the future as I evaluate the feasibility of outproxies or Tor.</p>
<h1 id="features">Features</h1>
<ul>
<li>Server to server linking</li>
<li>IRC operators</li>
<li>Private (WHOIS shows no channels, LIST isnt supported)</li>
<li>Flood protection</li>
<li>K: line style connection banning</li>
<li>TLS</li>
</ul>
<p>terrarium implements enough of <a href="https://tools.ietf.org/html/rfc1459">RFC 1459</a> to be recognisable as IRC and be minimally functional. It will intentionally omit unnecessary features. Priority features are those which enable moderation and provide more flexible security.</p>
<h1 id="plugin-installation-urls">Plugin Installation URLs</h1>
<p><a href="https://geti2p.net/en/docs/plugins">A guide to installing I2P plugins can be found on the I2P web site.</a></p>
<h3 id="inside-i2p">Inside I2P</h3>
<ul>
<li><a href="http://idk.i2p/terrarium/terrarium-windows-amd64.su3">Windows (In-I2P)</a></li>
<li><a href="http://idk.i2p/terrarium/terrarium-linux-amd64.su3">Linux (In-I2P)</a></li>
</ul>
<h3 id="outside-i2p">Outside I2P</h3>
<ul>
<li><a href="https://github.com/terrarium/blizzard/releases">Windows</a></li>
<li><a href="https://github.com/terrarium/blizzard/releases">Linux</a></li>
</ul>
<h1 id="installation">Installation</h1>
<ol type="1">
<li>Clone the software from <a href="https://i2pgit.org/idk/terrarium">i2pgit.org</a> (<code>git clone https://i2pgit.org/idk/terrarium go/src/i2pgit.org/idk/terrarium &amp;&amp; cd go/src/i2pgit.org/idk/terrarium</code>).</li>
<li>Build from source (<code>go build</code>).</li>
<li>Configure terrarium through config files. There are example configs in the <code>conf</code> directory. All settings are optional and have defaults.</li>
<li>Run it, e.g. <code>./terrarium -conf terrarium.conf</code>. You might run it via systemd via a service such as:</li>
</ol>
<pre><code>[Service]
ExecStart=/home/ircd/terrarium/terrarium -conf /home/ircd/terrarium/terrarium.conf
Restart=always
[Install]
WantedBy=default.target</code></pre>
<h1 id="configuration">Configuration</h1>
<h2 id="terrarium.conf">terrarium.conf</h2>
<p>Global server settings.</p>
<h2 id="opers.conf">opers.conf</h2>
<p>IRC operators.</p>
<h2 id="servers.conf">servers.conf</h2>
<p>The servers to link with.</p>
<h2 id="users.conf">users.conf</h2>
<p>Privileges and hostname spoofs for users.</p>
<p>The only privilege right now is flood exemption.</p>
<h2 id="tls">TLS</h2>
<p>A setup for a network might look like this:</p>
<ul>
<li>Give each server a certificate with 2 SANs: Its own hostname, e.g. server1.example.com, and the network hostname, e.g. irc.example.com.</li>
<li>Set up irc.example.com with DNS round-robin listing each servers IP.</li>
<li>List each server by its own hostname in servers.conf.</li>
</ul>
<p>Clients connect to the network hostname and verify against it. Servers connect to each other by server hostname and verify against it.</p>
<h2 id="i2p">I2P</h2>
<p>An example I2P configuration can be found in:</p>
<p><code>conf/catbox-i2p.conf</code></p>
<p>Thats all the docs I have for now</p>
<h1 id="why-the-name">Why the name?</h1>
<p>It was forked from an IRC server called catbox which had a focus on simplicity and understandability. It now has the ability to connect to other IRC servers through I2P Tunnels. Clearnet is to I2P Tunnels is sort of like Catbox is to Terrarium.</p>
<h1 id="logo">Logo</h1>
<p>terrarium logo (c) 2017 Bee</p>
</body>
</html>

29
main.go
View File

@@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"log"
"math/rand"
"net"
"os"
"os/signal"
@@ -17,10 +18,8 @@ import (
"github.com/horgh/irc"
"github.com/pkg/errors"
)
import (
"github.com/eyedeekay/sam3/helper"
sam "github.com/eyedeekay/sam3/helper"
)
// Catbox holds the state for this local server.
@@ -206,7 +205,18 @@ const ExcessFloodThreshold = 50
// from a user.
const ChanModesPerCommand = 4
func randString() string {
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
n := 3
b := make([]rune, n)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]
}
return string(b)
}
func NewCatbox(configFile string) (*Catbox, error) {
rand.Seed(time.Now().UnixNano())
cb := Catbox{
ConfigFile: configFile,
LocalClients: make(map[uint64]*LocalClient),
@@ -230,6 +240,9 @@ func NewCatbox(configFile string) (*Catbox, error) {
if err != nil {
return nil, fmt.Errorf("configuration problem: %s", err)
}
if cfg.ServerName == "irc.terrarium.i2p" {
cfg.ServerName = randString() + ".dirt.i2p"
}
cb.Config = cfg
if cb.Config.ListenPortTLS != "-1" || cb.Config.CertificateFile != "" ||
@@ -359,18 +372,18 @@ func (cb *Catbox) Start(listenFD int) error {
// I2P Listener with TLS
if cb.Config.ListenI2PTLS != "-1" {
ln, err := sam.I2PListener(cb.Config.ListenI2P, cb.Config.SAMAddress, cb.Config.ListenI2P)
ln, err := sam.I2PListener(cb.Config.ListenI2PTLS, cb.Config.SAMAddress, cb.Config.ListenI2PTLS)
if err != nil {
return fmt.Errorf("unable to listen (I2P): %s", err)
}
tlsln := tls.NewListener(ln, cb.TLSConfig)
cb.I2PListenerTLS = tlsln
err = ioutil.WriteFile(cb.Config.ListenI2P+".i2paddresshelper", []byte("http://"+cb.Config.ListenI2P+"?i2paddresshelper="+cb.I2PListener.Addr().String()), 0644)
err = ioutil.WriteFile(cb.Config.ListenI2PTLS+".tls.i2paddresshelper", []byte("http://"+cb.Config.ListenI2PTLS+"?i2paddresshelper="+cb.I2PListener.Addr().String()), 0644)
if err != nil {
return fmt.Errorf("unable to write I2P addresshelper link to file: %s", err)
}
if strings.HasSuffix(cb.Config.ServerName, ".i2p") {
err = ioutil.WriteFile(cb.Config.ServerName+".i2paddresshelper", []byte("http://"+cb.Config.ServerName+"?i2paddresshelper="+cb.I2PListener.Addr().String()), 0644)
err = ioutil.WriteFile(cb.Config.ServerName+".tls.i2paddresshelper", []byte("http://"+cb.Config.ServerName+"?i2paddresshelper="+cb.I2PListener.Addr().String()), 0644)
if err != nil {
return fmt.Errorf("unable to write I2P addresshelper link to file: %s", err)
}
@@ -388,7 +401,7 @@ func (cb *Catbox) Start(listenFD int) error {
// Catch SIGUSR1 and restart.
signalChan := make(chan os.Signal)
signal.Notify(signalChan, syscall.SIGHUP)
signal.Notify(signalChan, syscall.SIGUSR1)
signal.Notify(signalChan, syscall.SIGINT)
cb.WG.Add(1)
go func() {
@@ -401,7 +414,7 @@ func (cb *Catbox) Start(listenFD int) error {
cb.newEvent(Event{Type: RehashEvent})
break
}
if sig == syscall.SIGUSR1 {
if sig == syscall.SIGINT {
log.Printf("Received SIGUSR1 signal, restarting")
cb.newEvent(Event{Type: RestartEvent})
break