Initial Revision

This commit is contained in:
Deon George 2018-11-09 12:14:57 +11:00
commit d485c47da2
9 changed files with 318 additions and 0 deletions

63
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,63 @@
image: docker:latest
stages:
- test
- build
variables:
DOCKER_HOST: tcp://docker:2375
services:
- docker:dind
before_script:
- apk add curl
- docker info
- docker version
- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
test:
stage: test
script:
- cat /etc/hosts
- env|sort
- docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} .
- docker images
tags:
- docker
only:
- debug
build:x86_64:
variables:
CACHETAG: build-x86_64
VERSION: 0.12-alpha-x86_64
stage: build
script:
- if [ -f init ]; then chmod 500 init; fi
- docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG} || true
- docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSION}
- docker push ${CI_REGISTRY_IMAGE}:${CACHETAG}
tags:
- docker
- x86_64
only:
- docker
build:armv7l:
variables:
CACHETAG: build-armv7l
VERSION: 0.12-alpha-armv7l
stage: build
script:
- if [ -f init ]; then chmod 500 init; fi
- docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG} || true
- docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSION}
- docker push ${CI_REGISTRY_IMAGE}:${CACHETAG}
tags:
- docker
- armv7l
only:
- docker

39
Dockerfile Normal file
View File

@ -0,0 +1,39 @@
# NAME leenooks/magicka
# VERSION 0.12-4
FROM debian:stretch-slim
MAINTAINER Deon George <deon@leenooks.net>
# Pre-requisites
# + Base application requires unzip zip curl
RUN apt-get update \
&& apt-get install -yqq unzip zip curl \
&& rm -rf /var/lib/apt/lists/* /tmp/*
# Set timezone to Melbourne
RUN ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime
# Add in Leenooks' apt repository
RUN curl -s http://apt.leenooks.net/setup.sh | sh
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated magicka openssh-server binkd supervisor \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* #3
ADD binkd.conf /opt/magicka/etc/
ADD magimail.prefs /opt/magicka/etc/
ADD magitoss.sh /opt/magicka/bin
RUN ln -sf magitoss.sh /opt/magicka/bin/magiscan.sh
WORKDIR /opt/magicka
EXPOSE 22 23 80 24554
COPY init /sbin/init
COPY supervisord.d /etc/supervisor/conf.d/
VOLUME [ "/opt/magicka/data" ]
ENTRYPOINT [ "/sbin/init" ]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n"]

49
README.md Normal file
View File

@ -0,0 +1,49 @@
# Magicka BBS (Bulletin Board Software)
----
## What is Magicka BBS?
see [MagickaBBS](https://magickabbs.com)
> MagickaBBS is a Bulletin Board System (BBS) for Linux, macOS, FreeBSD, NetBSD, OpenIndiana, DragonFlyBSD and OpenBSD
> Magicka contains both Telnet & SSH servers, an FTP server and a HTTP server. It is able to run both native and DOS doors (via DosBox or Dosemu). It comes with an external full screen editor, a mail tosser/scanner and bluewave offline mail. It has internal ZModem, and works with external protocols like LRZSZ. Magicka is also easily configurable via ini files, and a configuration utility is in the works.
----
## About this Docker Container
This Docker Container represents a completed installation of MagickaBBS. It is ready to configure and personalise.
To use this container:
1. Docker pull it from my registry. (Actually you can skip this step, but its worth doing it anyway!)
docker pull registry.leenooks.net/bbs/magicka:0.12-alpha-x86_64 (armv7l is available too!)
2. Create a directory to hold your BBS data. (I use */srv/docker/magicka*).
mkdir -p /srv/magicka/data
3. Start the container.
docker run -d -v /srv/magicka/data:/opt/magicka/data -p 10022:2024 -p 10023:2023 -p 24554:24554 registry.leenooks.net/bbs/magicka:0.12-alpha-x86_64
Explanation of these parameters:
| Parameter | Value |
| :- | :-- |
| -d | Detached mode: run the container in the background and print the new container ID. |
| --name= | Give your container a specific name. (optional) |
| -p | Map host ports to container ports. (may be required, otherwise recommended) |
| -v | Map a path on the host into the container (optional but recommended). |
(There are other useful parameters you can use, like --restart, etc. If you dont pass in a data volume for /opt/magicka/data, docker will create one and preserve it if you start subsequent containers a specific way (beyond the scope of this README - so its recommended you do this in first instance anyway.)
Remember your container ID *(your number will be different)*.
ca219a461376...
4. You can connect to your container and run any commands inside it.
docker exec -it ca219a461376 <COMMAND>
5. You can now start to play. If you externalised your telnet port, then you can telnet in.
You can also run this in a swarm (I do)!

53
binkd.conf Normal file
View File

@ -0,0 +1,53 @@
# Number @ end is the root zone
domain private /opt/magicka/data/ftn/private 10
#domain fsxnet /opt/magicka/data/ftn/fsxnet 21
# Our Private address
address 10:10/999@private
# Our FSXNet Address
#address 21:21/999@fsxnet
sysname "My Magicka BBS"
location "Virtualised in Docker"
sysop "Docker Daemon"
nodeinfo 115200,TCP,BINKP
try 10
hold 600
send-if-pwd
log /opt/magicka/data/var/magicka/logs/binkd.log
loglevel 4
conlog 4
percents
printq
backresolv
inbound /opt/magicka/data/ftn/in_sec
inbound-nonsecure /opt/magicka/data/ftn/in
temp-inbound /opt/magicka/data/ftn/in_temp
minfree 2048
minfree-nonsecure 2048
kill-dup-partial-files
kill-old-partial-files 86400
prescan
# Private HUB
node 10:1/0@private -md hub.private.ftn:24554 CHANGEME c
# FSXNet HUB
#node 21:1/100@fsxnet -md ipv4.agency.bbs.geek.nz:24556 LETMEIN c
# our listening port (default=24554)
iport 24554
pid-file /opt/magicka/var/magicka/binkd.pid
exec "/opt/magicka/bin/magitoss.sh" *.[mwtfs][oehrau][0-9a-zA-Z] *.pkt
exec "/opt/magicka/bin/ticproc.sh" *.tic *.TIC
# nuke old .bsy/.csy files after 24 hours
kill-old-bsy 43200

34
init Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
: ${MAGICKA_ROOT=/opt/magicka}
PATH=${MAGICKA_ROOT}/bin:$PATH
export PATH
# Adjust some paths
echo "* Adjusting some paths..."
sed -i 's/magicka\/var/magicka\/data\/var/g' ${MAGICKA_ROOT}/bin/magiedit.sh
if [ ! -d "${MAGICKA_ROOT}/data/etc" ]; then
echo "* Installing MAGICKA_ROOT data files into ${MAGICKA_ROOT}/data"
cp -pR ${MAGICKA_ROOT}/{etc,share,var} ${MAGICKA_ROOT}/data/
sed -ri 's#opt/magicka/(etc|share|var)#opt/magicka/data/\1#g' ${MAGICKA_ROOT}/data/etc/magicka/bbs.ini
sed -i 's/=\ USERNAME/= root/g' ${MAGICKA_ROOT}/data/etc/magicka/bbs.ini
sed -i 's#magicka#opt/magicka/data#g' ${MAGICKA_ROOT}/data/etc/magicka/filesgen.ini
sed -i 's#var/magicka/msgs#data/msgs#g' ${MAGICKA_ROOT}/data/etc/magicka/localmail.ini
mkdir ${MAGICKA_ROOT}/data/{msgs,ftn}
mkdir ${MAGICKA_ROOT}/data/ftn/{in_sec,in,in_temp}
rmdir ${MAGICKA_ROOT}/data/var/magicka/msgs
fi
for keytype in rsa dsa; do
if [ ! -f "${MAGICKA_ROOT}/data/etc/magicka/keys/ssh_host_${keytype}_key" ]; then
echo "* Generating ${keytype} ssh key"
[ -d "${MAGICKA_ROOT}/data/etc/magicka/keys" ] || mkdir ${MAGICKA_ROOT}/data/etc/magicka/keys
/usr/bin/ssh-keygen -f ${MAGICKA_ROOT}/data/etc/magicka/keys/ssh_host_${keytype}_key -N '' -t ${keytype}
fi
done
# clear out state and lockfiles from previous instance
exec "$@"

61
magimail.prefs Normal file
View File

@ -0,0 +1,61 @@
SYSOP "Docker Daemon"
BBSNAME "My Magicka BBS"
BROADCAST 0.0.0.0 2025
LOGFILE "/opt/magicka/data/var/magicka/logs/magimail.log"
LOGLEVEL 3
DUPEFILE "/opt/magicka/data/var/magicka/logs/dupes.log" 200
DUPEMODE BAD
LOOPMODE LOG+BAD
MAXPKTSIZE 50
MAXBUNDLESIZE 100
DEFAULTZONE 10
INBOUND "/opt/magicka/data/ftn/in_sec"
OUTBOUND "/opt/magicka/data/ftn/out"
TEMPDIR "/opt/magicka/data/ftn/cm_temp"
CREATEPKTDIR "/opt/magicka/data/ftn/cm_temp"
PACKETDIR "/opt/magicka/data/ftn/cm_packets"
STATSFILE "/opt/magicka/data/ftn/magimail.stats"
FORCEINTL
ANSWERRECEIPT
ANSWERAUDIT
CHECKSEENBY
IMPORTAREAFIX
IMPORTSEENBY
WEEKDAYNAMING
ADDTID
ALLOWRESCAN
INCLUDEFORWARD
ALLOWKILLSENT
GROUPNAME A "private"
PACKER "ZIP" "zip -j %a %f" "unzip -j %a" "PK"
AKA 10:1/999
DOMAIN private
NODE 10:1/0 "ZIP" "" AUTOADD PACKNETMAIL
DEFAULTGROUP A
ROUTE "10:*/*.*" "10:1/0.0" 10:1/999
JAM_HIGHWATER
JAM_LINK
JAM_QUICKLINK
JAM_MAXOPEN 5
NETMAIL "NETMAIL" 10:1/999.0 JAM "/opt/magicka/data/msgs/pvt_netmail"
AREA "BAD" 10:1/999.0 JAM "/opt/magicka/data/msgs/bad"
AREA "PVT-TEST" 10:1/999.0 JAM "/opt/magicka/data/msgs/pvt_test"
EXPORT %10:1/0.0
GROUP A

13
magitoss.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
FILE=$(basename $0)
cd /opt/magicka/data/ftn
if [ "${FILE}" == "magitoss.sh" ]; then
/opt/magicka/bin/magimail toss
elif [ "${FILE}" == "magiscan.sh" ]; then
/opt/magicka/bin/magimail scan
fi

3
supervisord.d/bbs.conf Normal file
View File

@ -0,0 +1,3 @@
[program:magicka]
command=/opt/magicka/bin/magicka /opt/magicka/data/etc/magicka/bbs.ini
user=root

3
supervisord.d/binkd.conf Normal file
View File

@ -0,0 +1,3 @@
[program:binkd]
command=/usr/sbin/binkd /opt/magicka/data/etc/binkd.conf
user=root