Commit 4ff75b19 authored by The Heavy's avatar The Heavy 🚂
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

.dockerignore

0 → 100644
+4 −0
Original line number Diff line number Diff line
config/
docker-compose.yml
README.md
.git/

Dockerfile

0 → 100644
+32 −0
Original line number Diff line number Diff line
# thanks linuxserver guys!
FROM ghcr.io/linuxserver/baseimage-ubuntu:focal

# have apt run unattended
ARG DEBIAN_FRONTEND="noninteractive"

# copy the virtualmin repo keys
COPY root/root/RPM-GPG-KEY-* /root/
# copy the apt config
COPY root/etc/apt/ /etc/apt/

# install the webmin keys
RUN apt-key add /root/RPM-GPG-KEY-virtualmin-6 && \
 apt-key add /root/RPM-GPG-KEY-webmin

# update sources and install packages
RUN apt-get update && \
 apt-get -y install webmin && \
 apt-get -y install usermin && \
 apt-get -y install postfix && \
 apt-get -y install libdbd-mysql-perl clamav-base clamav procmail procmail-wrapper mysql-server mysql-client mysql-common awstats php-mysql dovecot-core dovecot-imapd unrar p7zip xz-utils clamav-freshclam libconfig-inifiles-perl spamassassin opendkim virtualmin-lamp-stack-minimal && \
 apt-get -y install webmin-virtualmin-awstats webmin-virtualmin-htpasswd liblog-log4perl-perl perl-modules virtualmin-core iproute2 fetchmail

# cleanup
RUN apt-get clean
RUN rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /*.out

VOLUME /config
EXPOSE 80 443 25 143 10000 20000

# copy the remaining config
COPY root/ /

README.md

0 → 100644
+40 −0
Original line number Diff line number Diff line
# Virtualmin in Docker

## What is it

Virtualmin (https://www.virtualmin.com/) in a Docker (https://www.docker.com/) container. No, it probably shouldn't be done, but I did it anyway. Virtualmin is way too complex with far too many moving parts to really fit into the "containerisation" concept, however it makes managing multiple domains with web and e-mail way too simple to give up (old dogs, new tricks, perhaps?). So here it is in containerised form to fit into "the new way" without having to dedicate a whole virtual (or even physical) server to it.

This image has a highly opinionated default config with very little in the way of explanation or notes. Where I can I have split out the config files into "default" sections (usually at the top) where the settings match the defaults the package came with, and "customised" sections where I have deviated from the defaults, some also contain "disabled" sections where I have deliberately commented out the setting to have the package fill it out on first boot, these are things that cannot be known during image build (like IPs or domain names), or things that will change over time with the underlying software (package version numbers and such). I believe the default settings to be reasonably secure, but make no guarantees that I'm not a total idiot.

## Build

(sudo) docker build -f Dockerfile .

## Usage

Root's default password is 'changeme', it should force you to change it at first login.

After signing in you should run 'Re-check and refresh configuration' (should be a button on the first page you see) to ensure Virtualmin is fully set up.

## Known Bugs

- This image (particularly the initialisation script) is not well tested on existing data/config. If you do try to import something, make sure you have a backup of it first.
- This also applies to updating to newer versions of this image. **Assume everything is un-tested and un-supported. Back up everything.**
- ClamAV-Freshclam runs on a cron job defined in the image, this means *every* instance of this image will try to update Clam at the same time unless you change the defaults.
- This image contains a copy of the ClamAV virus database in root/var/lib/clamav occupying >200MB. The daily part in particular probably shouldn't be there and could be downloaded on container init.
- The build process should not be sending the entire directory as context, just root would do.
- The initialisation script will set all notification e-mail addresses to admin@container-domain, this may not be what you want. Refer to root/etc/cont-init.d/50-virtualmin-config for a list of the files where this is set.
- The initialisation script will also change ownership of a bunch of files and directories in /config to root:root, this might make a mess of existing data and I'm not really sure this is valid any more (feels like an old hack for permissions issues that may or may not still exist or could be handled better).
- Running 'passwd' in the container will fail because /etc/shadow is actually a symlink, Webmin can manipulate the file just fine (I'm probably breaking some fundamental *nix concept here).
- A number of features are installed directly in the container when really they should be separate containers that Virtualmin can link to (e.g. MySQL, ClamAV, SpamAssassin, and so on), and which probably have perfectly good images I could direct you to.

## Licence

TODO!

## Thanks

Thanks to Canonical for Ubuntu.
Thanks to LinuxServer.io for the base docker image.
Thanks to Jamie Cameron for Webmin/Virtualmin.
And the countless others who make the Open-Source world work!

docker-compose.yml

0 → 100644
+20 −0
Original line number Diff line number Diff line
---
version: "2.1"
services:
  virtualmin:
    image: 55e2681d55a9
    container_name: virtualmin
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    volumes:
      - /opt/docker/virtualmin/config:/config
    ports:
      - 10000:10000  # Webmin port
      - 20000:20000  # Usermin port
      - 25:25        # SMTP port
      - 143:143      # IMAP port
      - 80:80        # HTTP port
      - 443:443      # HTTPS port
    restart: unless-stopped

root/etc/aliases

0 → 100644
+4 −0
Original line number Diff line number Diff line
# See man 5 aliases for format
postmaster: root
clamav: root
root: admin@if-this-domain-resolves-someone-is-going-to-be-mad-at-me.eteoxaoghtrhwfza