June 09, 2021

mailinabox setup/restore

update fstab:

//192.168.1.24/backup  /media/nas-backup  cifs  vers=3.0,username=media,password=XXXXXXXXXX,uid=1000,gid=1000,iocharset=utf8  0  0

update crontab:

00 0    * * 7   root    cp -r /home/user-data/backup/encrypted /media/nas-backup/mail-in-a-box-b

00 0    * * 7   root    cp /home/user-data/backup/secret_key.txt /media/nas-backup/mail-in-a-box-b

00 14   * *   6   root    backup-folder -n etc-weekly -f "/home/user-data/www/"

run the restore

export PASSPHRASE=$(cat /home/billw/secret_key.txt)

duplicity restore --force file:///media/nas-backup/mail-in-a-box/encrypted /home/user-data/


Spam rules

/etc/postgrey/whitelist_clients

# 2021-05-05: St Bedes

122.56.66.10


/etc/spamassassin/local2.cf 

whitelist_from *@stbedes.school.nz

whitelist_from *.stbedes.school.nz



April 30, 2021

Docker Minecraft Java CurseForge RLCraft

I'm running 4 docker instances now and it needs alot of resources




---------------- curseforge/all-the-mods-6

docker run -d -it -v atm-volume:/data --name curseforge-atm \
      -p 192.168.1.11:25565:25565 \ 
      -e EULA=true \
      curseforge/all-the-mods-6
---------------- curseforge/rlcraft:2.8.2
docker run -d -it -v rlc-volume:/data --name curseforge-rlc \
      -p 192.168.1.99:25565:25565 \ 
      -e EULA=true \
      curseforge/rlcraft:2.8.2

Set them to autostart

  docker update --restart unless-stopped curseforge-atm

  docker update --restart unless-stopped curseforge-rlc

References

GitHub - curseforge-docker/modpack-servers: Project for building CurseForge minecraft modpack servers as docker images

---------------- Trying and failing using itgz/minecraft-server

PARAMETERS:  From what I was able to test, the default 1GB of RAM that is allocated won't be enough.  Recommend allocating 3 to 4GB's of RAM.  You can do this by going to Launch Options, enabling JVM Arguments, and changing "-Xmx1G" to "-Xmx4G".  My JVM Arguments looks like this:

-Xmx4G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M

apt install openjdk-8-jre-headless

docker run -d -it -v cf-volume:/data \
    -p 192.168.1.11:25565:25565 \
    -e EULA=TRUE \
    -e VERSION=1.12.2 \
    -e MEMORY=2G \
    -e TYPE=CURSEFORGE \
    -e CF_SERVER_MOD=RLCraft_Server.zip \
    --name minecraft-cf itzg/minecraft-server:java8-multiarch
    -e MANIFEST=/data/FeedTheBeast/manifest.json \
java8-multiarch

in folder /cf-volume/_data/FeedTheBeast

wget https://raw.githubusercontent.com/AllTheMods/Server-Scripts/master/ServerStart.sh 

wget https://raw.githubusercontent.com/AllTheMods/Server-Scripts/master/settings.cfg 

 

references

https://www.curseforge.com/minecraft/modpacks/rlcraft

https://www.curseforge.com/minecraft/modpacks/rlcraft/files/2935316

https://github.com/itzg/docker-minecraft-server/issues/392



April 29, 2021

Docker IPTABLES Rules

Really hard to lockdown docker instances, this is the easiest way I have found.

Permit access from LAN networks and individual IP's externally

ipset -N minecraft iphash

ipset -A minecraft 192.168.1.0/24

ipset -A minecraft 172.16.0.0/24

ipset -A minecraft 125.238.106.4 # Daniel

iptables -I DOCKER-USER -p tcp --dport 25565 -m set ! --match-set minecraft src -j DROP

iptables -I DOCKER-USER -p udp --dport 19132 -m set ! --match-set minecraft src -j DROP

This is all added to a script that runs when the interfaces come up.

iptables -L DOCKER-USER

ipset list minecraft

References:

    https://wiki.archlinux.org/index.php/Ipset
    https://vmalli.com/managing-custom-iptables-rules-on-a-debian-docker-host/

April 25, 2021

Proxmox setup notes, VM Import from ESXi6.7U2

 

Enable jumbo frames.

    Edit /etc/network/interfaces

        add "mtu 9000" to each interface


Configure APT to use the "No-Subscription" repository

    https://pve.proxmox.com/wiki/Package_Repositories#sysadmin_no_subscription_repo

Import VMWare VM's:

    https://pve.proxmox.com/wiki/Migration_of_servers_to_Proxmox_VE#VMware_Converter

    download ovftool from vmware.com

    https://my.vmware.com/group/vmware/downloads/get-download?downloadGroup=OVFTOOL440

    shutdown the VM on esx

    run the following command to create the OVF package in the current directory

        ovftool "vi://esxdell.wjw.local/Windows 10 - Minecraft" .

    wait for a while.... 1:45-

Import the OVF into ProxMox

qm importovf 200 Windows\ 10\ -\ Minecraft/Windows\ 10\ -\ Minecraft.ovf PVE-NFS15


Docker Minecraft Servers Java & Bedrock

Bedrock Edition

https://hub.docker.com/r/itzg/minecraft-bedrock-server 

docker run -d -it --name minecraft-sa -e EULA=TRUE -p 192.168.1.68:19132:19132/udp -v sa-volume:/data itzg/minecraft-bedrock-server

Java Edition

https://github.com/itzg/docker-minecraft-server/blob/master/README.md

docker run -d -it --name minecraft-jv -e EULA=TRUE -p 192.168.1.68:25565:25565 -v mj-volume:/data itzg/minecraft-server:java16

Docker Commands

Access Console

  • docker attach minecraft-jv
  • - Control-p Control-q to detach

Check network ports in use in container

    • docker inspect -f '{{.State.Pid}}' minecraft-jv
    • nsenter -t 5549 -n netstat

Servers

  • Aidan - Java - 192.168.1.68:25565
  • Aidan - Bedrock - Survival - 192.168.1.68:19132


Backup Script

# Stop the Minecraft Server nicely
echo 'stop' | socat EXEC:"docker attach minecraft-sa",pty STDIN
# Backup the minecraft data
/media/nas-backup/scripts/backup-folder -n minecraft-sa-weekly -f "/var/snap/docker/common/var-lib-docker/volumes/sa-volume"
# Restart the container
docker start minecraft-sa

March 27, 2021

DC Movies in Chronological Order

1. Wonder Woman (2017)

2. Wonder Woman 1984 (2020)

3. Man of Steel (2013)

4. Suicide Squad (2016) 

5. Batman v Superman: Dawn of Justice (2016)

6. Justice League (2017) / Zack Snyder's Justice League (2021)

7. Aquaman (2018)

8. Shazam! (2019)

9. Birds of Prey (2020)

February 25, 2021

Exporting all zones from Zonomi account to bind format

Install rimudns

    pip install rimudns

Grab the script from

    https://github.com/zoltanf/Zonomi-Bind-Export

Install the required package

    apt-get install python-requests

---------------------------------
-- export_all_zones python script
---------------------------------
#!/usr/bin/env python
import os

from rimudns import RimuDNS
api_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
dns = RimuDNS(api_key)
dns.use_zonomi()
for domain in dns.list_zones():
os.system("/media/nas-backup/scripts/export_bind.py " + api_key + " " + domain['name'])



---------------------------------
-- export_bind_py
---------------------------------
#!/usr/bin/env python
import re
import sys
import xml.etree.ElementTree as ET

import requests

from datetime import datetime

try:
    api_key = sys.argv[1]
    domain_name = sys.argv[2]
except:
    print("Invalid arguments. Usage: export-bind.py ZONOMI-API-KEY domain.name")
    exit(13)

# noinspection PyUnboundLocalVariable
f = open("/media/nas-backup/zones/" + datetime.today().strftime('%Y-%m-%d') + "_" + domain_name + ".zone.txt", "w")
r = requests.get("https://zonomi.com/app/dns/dyndns.jsp?action=QUERY&name=**.%s&api_key=%s" % (domain_name, api_key))

root = ET.fromstring(r.content)
actions = root.find("actions")
action = actions.find("action")


def isIpAddress(target):
    if re.match(r'^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$', target):
        return True
    else:
        return False


def get_content_fqn(target):
    if isIpAddress(target):
        return target
    else:
        return target + "."


for record in action.iter("record"):
    source_name = record.attrib.get("name")
    type = record.attrib.get("type")
    source_content = record.attrib.get("content")

    if source_name == domain_name:
        name = "        "
    elif "." + domain_name in source_name:
        name = source_name.replace("." + domain_name, "")
    else:
        name = source_name + "."

    if type == "NS" or type == "SOA": continue

    if type == "CNAME":
        content = get_content_fqn(source_content)
    elif type == "MX":
        content = "%s\t%s" % (record.attrib.get("prio"), get_content_fqn(source_content))
    elif type == "TXT":
        content = "\"%s\"" % source_content
    else:
        content = get_content_fqn(source_content)

    f.write(
        "%s\t%s\t%s\t%s\t%s\n" % (
            name,
            record.attrib.get("ttl").replace(" seconds", ""),
            "IN",
            type,
            content
        )
    )
    print("Exporting record: %s " % record.attrib)
---------------------------------