This prototype aims to create a tool to initialize the FreeDOS-based VMs for running in the cloud, similarly as cloud-init or Ignition projects on Linux. I.e., configure networking, start custom scripts and services on boot or call back home.
Why? Maybe somebody still has an old DOS server machine, which can be easily moved into the cloud. Or, maybe one uses FreeDOS, and having the network functional without pain to push data from/to DOS machine via rsync/FTP/HTTP would simplify the workflow. Or, just because even legacy systems still deserve a little love ❤️.
This repository contains
- FreeDOS Cloud Initialization Scripts
- Packer templates and Makefile to build a cloud-ready FreeDOS image
Scripts build release candidate (RC) of upcoming FreeDOS 1.3!
Requirements:
make
,curl
,unzip
- packer
To build a cloud-ready FreeDOS image, type:
make
If build succeeds, you'll find the image in build/image/freedos-1.3.qcow2
.
Functionality is currently limited only to OpenNebula.
Open an issue in case of interest in other platforms.
Features
- KVM hypervisor only
- network configuration
- NIC models:
pcnet
,rtl8139
- only the first NIC is configured (
ETH0_
) - supports both static IP configuration and DHCP (if
ETH0_METHOD="dhcp"
)
- NIC models:
- runs script (BAT) base64 encoded (
START_SCRIPT_BASE64
) - reports VM readiness via OneGate to OpenNebula
- optionally configures and runs
- FTP server (mTCP FTPSrv)
- HTTP server (mTCP HTTPServ)
- Telnet server (RMENU)
Full VM template example:
NAME = "freedos"
CONTEXT = [
NETWORK = "YES",
REPORT_READY = "YES",
START_SCRIPT_BASE64 = "ZWNobyAuLi4gVGhpcyBpcyBvdXRwdXQgZnJvbSBjdXN0b20gc3RhcnQgc2NyaXB0IC4uLg==",
SVC_FTP_ENABLE = "yes",
SVC_FTP_PASSWORD = "root",
SVC_FTP_SANDBOX_DIR = "/drive_c/",
SVC_FTP_USERNAME = "root",
TOKEN = "YES" ]
CPU = "1"
MEMORY = "256"
DISK = [
IMAGE = "freedos-1.3",
DEV_PREFIX = "hd"]
NIC = [
NETWORK = "private",
MODEL = "pcnet" ]
GRAPHICS = [
LISTEN = "0.0.0.0",
TYPE = "VNC" ]
Custom BAT script provided in contextualization data is executed on every VM boot. The BAT script content must be provided in context parameter START_SCRIPT_BASE64
on a single unwrapped line and base64 encoded!
Example:
CONTEXT = [
START_SCRIPT_BASE64 = "ZWNobyAuLi4gVGhpcyBpcyBvdXRwdXQgZnJvbSBjdXN0b20gc3RhcnQgc2NyaXB0IC4uLg==",
...
]
for a simple script
echo ... This is output from custom start script ...
Supported context parameters
SVC_FTP_ENABLE="yes"
to run FTP server on bootSVC_FTP_USERNAME
with FTP userSVC_FTP_PASSWORD
with FTP passwordSVC_FTP_SANDBOX_DIR
with FTP root directory in format/drive_$X/$PATH
(e.g.,/drive_c/TEMP
)SVC_FTP_UPLOAD_DIR
with FTP upload directory relative toSVC_FTP_SANDBOX_DIR
, defaults to[any]
SVC_FTP_PERMISSIONS
with FTP permissions, defaults toall
Consult the mTCP FTPSrv documentation.
Example:
CONTEXT = [
SVC_FTP_ENABLE = "yes",
SVC_FTP_USERNAME = "root",
SVC_FTP_PASSWORD = "root",
SVC_FTP_SANDBOX_DIR = "/drive_c/",
...
]
Supported context parameters
SVC_HTTP_ENABLE="yes"
to run HTTP server on bootSVC_HTTP_CLIENTS
number of clientsSVC_HTTP_DIR_INDEXES="yes"
to enable directory indexesSVC_HTTP_DOC_ROOT
path with document root (e.g.,C:\
)SVC_HTTP_PORT
custom HTTP port
Consult the mTCP HTTPServ documentation.
Example:
CONTEXT = [
SVC_HTTP_ENABLE = "yes",
SVC_HTTP_DOC_ROOT = "C:\ ",
SVC_HTTP_DIR_INDEXES = "yes",
...
]
⚠️ WARNING: RMENU allows to access the DOS machine via telnet protocol, which is not encrypted. Also, RMENU doesn't support authentication, thus anyone who connects can control the machine. Don't enable telnet on untrusted networks OR restrict access to port 23 of VM in your cloud management tools!⚠️
Supported context parameters
SVC_RMENU_ENABLE="yes"
to run RMENU on boot
Example:
CONTEXT = [
SVC_RMENU_ENABLE="yes",
...
]