fifrst commit
This commit is contained in:
parent
e1c0d3d08c
commit
7fd1632044
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
data/
|
40
Dockerfile
Normal file
40
Dockerfile
Normal file
@ -0,0 +1,40 @@
|
||||
FROM alpine:edge
|
||||
|
||||
# enable edge repos including testing
|
||||
RUN printf '%s\n' \
|
||||
"https://dl-cdn.alpinelinux.org/alpine/edge/main" \
|
||||
"https://dl-cdn.alpinelinux.org/alpine/edge/community" \
|
||||
"https://dl-cdn.alpinelinux.org/alpine/edge/testing" \
|
||||
> /etc/apk/repositories
|
||||
|
||||
RUN apk update && apk add --no-cache \
|
||||
openssl \
|
||||
openssl-libs-static \
|
||||
nodejs \
|
||||
npm \
|
||||
thelounge \
|
||||
ngircd \
|
||||
tor \
|
||||
su-exec \
|
||||
bash \
|
||||
tini
|
||||
|
||||
RUN addgroup -S app && adduser -S -G app app
|
||||
|
||||
ENV DATA_DIR=/data
|
||||
ENV TOR_DIR=${DATA_DIR}/tor
|
||||
ENV THELOUNGE_DIR=${DATA_DIR}/thelounge
|
||||
ENV NGIRCD_DIR=${DATA_DIR}/ngircd
|
||||
|
||||
RUN mkdir -p ${TOR_DIR} ${THELOUNGE_DIR} ${NGIRCD_DIR}
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
COPY ngircd.conf.template /etc/ngircd/
|
||||
COPY ngircd.motd /etc/ngircd/
|
||||
COPY torrc /etc/tor/
|
||||
COPY thelounge-config.js.template /
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
EXPOSE 9000
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["bash"]
|
51
entrypoint.sh
Normal file
51
entrypoint.sh
Normal file
@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DATA_DIR=/data
|
||||
TOR_DIR=${DATA_DIR}/tor
|
||||
THELOUNGE_DIR=${DATA_DIR}/thelounge
|
||||
NGIRCD_DIR=${DATA_DIR}/ngircd
|
||||
|
||||
mkdir -p "${TOR_DIR}" "${THELOUNGE_DIR}" "${NGIRCD_DIR}"
|
||||
chown -R app:app "${DATA_DIR}"
|
||||
|
||||
# Start tor (uses DataDirectory as set in torrc)
|
||||
su-exec app tor -f /etc/tor/torrc &
|
||||
TORPID=$!
|
||||
|
||||
# Wait for hidden service hostname (give Tor up to 20s)
|
||||
for i in $(seq 1 20); do
|
||||
if [ -f "${TOR_DIR}/hidden_service/hostname" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
HS_NAME=`cat ${TOR_DIR}/hidden_service/hostname`
|
||||
|
||||
# Start ngircd (listening on 127.0.0.1:6667)
|
||||
NGIRCD_CFG=${NGIRCD_DIR}/ngircd.conf
|
||||
if [ ! -f "${NGIRCD_CFG}" ]; then
|
||||
sed "s|%HS_NAME%|${HS_NAME}|g" "/etc/ngircd/ngircd.conf.template" > "${NGIRCD_CFG}"
|
||||
mv /etc/ngircd/ngircd.motd ${NGIRCD_DIR}/ngircd.motd
|
||||
chown -R app:app "${NGIRCD_DIR}/"
|
||||
fi
|
||||
ngircd -f ${NGIRCD_CFG} &
|
||||
|
||||
# Prepare The Lounge config from template if missing
|
||||
THELOUNGE_CFG=${THELOUNGE_DIR}/config.js
|
||||
if [ ! -f "${THELOUNGE_CFG}" ]; then
|
||||
#THELOUNGE_NICK=${THELOUNGE_NICK:-DuckUser}
|
||||
sed "s|%HS_NAME%|${HS_NAME}|g" "/thelounge-config.js.template" > "${THELOUNGE_CFG}"
|
||||
chown app:app "${THELOUNGE_CFG}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Connect to http://${HS_NAME} on a Tor enabled browser, and don't forget to enable javascript."
|
||||
echo ""
|
||||
|
||||
# Start The Lounge as non-root
|
||||
export THELOUNGE_HOME=${THELOUNGE_DIR}
|
||||
su-exec app /usr/bin/thelounge start
|
||||
|
||||
|
||||
wait -n
|
15
ngircd.conf.template
Normal file
15
ngircd.conf.template
Normal file
@ -0,0 +1,15 @@
|
||||
[Global]
|
||||
Name = %HS_NAME%
|
||||
Listen = ::,0.0.0.0
|
||||
MotdFile = /data/ngircd/ngircd.motd
|
||||
[Limits]
|
||||
[Options]
|
||||
CloakHost = cloaked.host
|
||||
DNS = no
|
||||
MorePrivacy = yes
|
||||
PAMIsOptional = yes
|
||||
[Operator]
|
||||
[Server]
|
||||
[Channel]
|
||||
Name = #chat
|
||||
Autojoin = yes
|
6
ngircd.motd
Normal file
6
ngircd.motd
Normal file
@ -0,0 +1,6 @@
|
||||
███████╗███████╗██╗██████╗ ██████╗
|
||||
██╔════╝╚══███╔╝██║██╔══██╗██╔════╝
|
||||
█████╗ ███╔╝ ██║██████╔╝██║
|
||||
██╔══╝ ███╔╝ ██║██╔══██╗██║
|
||||
███████╗███████╗██║██║ ██║╚██████╗
|
||||
╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ ╚═════╝
|
51
thelounge-config.js.template
Normal file
51
thelounge-config.js.template
Normal file
@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
public: true,
|
||||
host: undefined,
|
||||
port: 9000,
|
||||
bind: undefined,
|
||||
reverseProxy: false,
|
||||
maxHistory: 100000,
|
||||
https: {
|
||||
enable: false,
|
||||
},
|
||||
theme: "morning",
|
||||
prefetch: true,
|
||||
disableMediaPreview: false,
|
||||
prefetchStorage: true,
|
||||
prefetchMaxImageSize: 6144,
|
||||
prefetchMaxSearchSize: 50,
|
||||
prefetchTimeout: 10000,
|
||||
fileUpload: {
|
||||
enable: true,
|
||||
maxFileSize: 51200,
|
||||
baseUrl: "http://%HS_NAME%/uploads/",
|
||||
},
|
||||
transports: ["polling", "websocket"],
|
||||
leaveMessage: "https://chat.hackfreedom.org",
|
||||
defaults: {
|
||||
name: "EZIRC",
|
||||
host: "127.0.0.1",
|
||||
port: 6667,
|
||||
password: "",
|
||||
tls: false,
|
||||
rejectUnauthorized: true,
|
||||
nick: "anon%%",
|
||||
username: "",
|
||||
realname: "",
|
||||
join: "#chat",
|
||||
leaveMessage: "",
|
||||
},
|
||||
lockNetwork: true,
|
||||
messageStorage: ["sqlite"],
|
||||
storagePolicy: {
|
||||
enabled: false,
|
||||
maxAgeDays: 1,
|
||||
deletionPolicy: "everything",
|
||||
},
|
||||
useHexIp: false,
|
||||
debug: {
|
||||
ircFramework: false,
|
||||
raw: false,
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue
Block a user