From eed4880edd10f48052d4f73ee26a20f189606c62 Mon Sep 17 00:00:00 2001
From: DTB <trinity@trinity.moe>
Date: Mon, 22 Jan 2024 23:57:39 -0700
Subject: [PATCH] feeling: ngircd stuff

---
 feeling/Makefile            | 29 ++++++++++++++++++++++
 feeling/alpine.mk           | 25 +++++++++++++++++++
 feeling/motd.irc            |  1 +
 feeling/{motd => motd.unix} |  0
 feeling/ngircd.conf         | 48 +++++++++++++++++++++++++++++++++++++
 feeling/secrets.conf        |  6 +++++
 6 files changed, 109 insertions(+)
 create mode 100644 feeling/Makefile
 create mode 100644 feeling/alpine.mk
 create mode 100644 feeling/motd.irc
 rename feeling/{motd => motd.unix} (100%)
 create mode 100644 feeling/ngircd.conf
 create mode 100644 feeling/secrets.conf

diff --git a/feeling/Makefile b/feeling/Makefile
new file mode 100644
index 0000000..2499cd8
--- /dev/null
+++ b/feeling/Makefile
@@ -0,0 +1,29 @@
+include alpine.mk
+
+MKDIR = mkdir -p
+PREFIX = /usr/local/murderu.us
+
+/etc/motd: $(PREFIX)/src/feeling/motd.unix
+	ln -sf $(PREFIX)/src/feeling/motd.unix $@
+
+/etc/ngircd: $(PREFIX)/bin/ngircd
+	$(MKDIR) $@.tmp/ephemeral
+	ln -sf $(PREFIX)/src/feeling/ngircd.conf $@.tmp/
+	ln -sf $(PREFIX)/src/feeling/motd.irc $@.tmp/motd
+	cp $(PREFIX)/src/feeling/secrets.conf $@.tmp/ephemeral/
+	mv $@.tmp $@
+	@ printf '%s\n' "Configure /etc/ngircd/ngircd.conf."
+	@ printf '%s\n' "Configure /etc/ngircd/ephemeral/secrets.conf."
+
+/etc/prosody: $(PREFIX)/bin/prosody
+
+/srv/http/www: $(PREFIX)/bin/darkhttpd $(PREFIX)/src
+	$(MKDIR) /srv/http/
+	ln -s $(PREFIX)/src/www $@
+
+$(PREFIX):
+	$(MKDIR) $(PREFIX)
+
+$(PREFIX)/src: $(PREFIX) $(PREFIX)/bin/git
+	git clone https://git.sr.ht/~trinity/murderu.us $@.tmp
+	mv $@.tmp $@
diff --git a/feeling/alpine.mk b/feeling/alpine.mk
new file mode 100644
index 0000000..8ec3ff5
--- /dev/null
+++ b/feeling/alpine.mk
@@ -0,0 +1,25 @@
+/bin/darkhttpd:
+	apk add darkhttpd
+
+/usr/bin/git:
+	apk add git
+
+/usr/bin/ngircd:
+	apk add ngircd
+	rc-update add ngircd
+
+/usr/bin/prosody:
+	apk add prosody
+	rc-update add prosody
+
+$(PREFIX)/bin:
+	$(MKDIR) $(PREFIX)/bin
+
+$(PREFIX)/bin/darkhttpd: $(PREFIX)/bin /usr/bin/darkhttpd
+	ln -s /usr/bin/darkhttpd $(PREFIX)/bin/darkhttpd
+
+$(PREFIX)/bin/git: $(PREFIX)/bin /usr/bin/git
+	ln -s /usr/bin/git $(PREFIX)/bin/git
+
+$(PREFIX)/bin/ngircd: $(PREFIX)/bin /usr/bin/ngircd
+	ln -s /usr/bin/ngircd $(PREFIX)/bin/ngircd
diff --git a/feeling/motd.irc b/feeling/motd.irc
new file mode 100644
index 0000000..89e1926
--- /dev/null
+++ b/feeling/motd.irc
@@ -0,0 +1 @@
+i heard dead men tell no tales /// i'm feeling.murderu.us
diff --git a/feeling/motd b/feeling/motd.unix
similarity index 100%
rename from feeling/motd
rename to feeling/motd.unix
diff --git a/feeling/ngircd.conf b/feeling/ngircd.conf
new file mode 100644
index 0000000..3f4a3e7
--- /dev/null
+++ b/feeling/ngircd.conf
@@ -0,0 +1,48 @@
+[Global]
+	AdminEMail = # CHANGE ME
+	AdminInfo1 = # CHANGE ME
+	AdminInfo2 = # CHANGE ME
+	Info = # CHANGE ME
+	MotdFile = /etc/ngircd/motd
+	Name = # CHANGE ME
+	Network = # CHANGE ME
+	PidFile = /var/run/ngircd.pid
+	Ports = 6667, 6668, 6669
+	ServerUID = # CHANGE ME
+	ServerGID = # CHANGE ME
+
+[Limits]
+	MaxJoins = 20
+	MaxNickLength = 9
+        PingTimeout = 120
+        PongTimeout = 120
+
+[Options]
+	AllowRemoteOper = yes
+	CloakHostModeX = %x.cloak
+	DefaultUserModes = wx
+	DNS = no
+	Ident = no
+	IncludeDir = /etc/ngircd/ephemeral
+	MorePrivacy = yes
+	OperCanUseMode = yes
+	OperChanPAutoOp = yes
+	PAM = no
+
+[SSL]
+	CertFile = # CHANGE ME
+	DHFile = /etc/ssl/dhparam
+	KeyFile = # CHANGE ME
+	Ports = 6697, 9999
+
+[Channel]
+	Name = #subgeneral
+	Topic = under the radar
+
+[Channel]
+	Name = #media
+	Topic = memetics research group
+
+[Channel]
+	Name = #lontokilen
+	Topic = subgeneral
diff --git a/feeling/secrets.conf b/feeling/secrets.conf
new file mode 100644
index 0000000..d20a090
--- /dev/null
+++ b/feeling/secrets.conf
@@ -0,0 +1,6 @@
+[Options]
+	CloakHostSalt = # CHANGE ME
+
+[Operator]
+	Name = # CHANGE ME
+	Password = # CHANGE ME