Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Configuration Files

ByteDream edited this page Nov 15, 2022 · 3 revisions

docker4ssh.conf

The docker4ssh.conf file manages all general settings like the ssh port, log files or the database.

The docker4ssh.conf file is built up the following:

[profile]
# the directory where profiles are stored
Dir = "./profile/"

# defalt settings for profiles
[profile.default]
Password = ""
NetworkMode = 3
Configurable = true
RunLevel = 1
StartupInformation = true
ExitAfter = ""
KeepOnExit = false

# settings for dynamic container creation
[profile.dynamic]
Enable = true
Password = ""
NetworkMode = 3
Configurable = true
RunLevel = 1
StartupInformation = true
ExitAfter = ""
KeepOnExit = false

[api]
Port = 8420

[api.configure]
Binary = "./configure"
Man = "./man/configure.1"

[ssh]
# the default ssh port. if blank, port 2222 will be used
Port = 2222
# path to the ssh private key. if blank, a random key will be generated
Keyfile = "./docker4ssh.key"
# password of the ssh private key
Passphrase = ""

[database]
# path to sqlite3 database file. there may be support for other databases in the future
Sqlite3File = "./docker4ssh.sqlite3"

[network.default]
Subnet = "172.69.0.0/16"

[network.isolate]
Subnet = "172.96.0.0/16"

[logging]
# the loglevel. available levels are: debug, info, warn, error, fatal
Level = "info"
ConsoleOutput = true
ConsoleError = true
OutputFile = "./docker4ssh.log"
ErrorFile = "./docker4ssh.log"

You can overwrite option which are specified in the config file with environment variables. The structure of this variables is SECTION_KEY=VALUE. E.g. LOGGING_LEVEL="debug" or PROFILE_DYNAMIC_ENABLED=false.

With man docker4ssh.conf you can get the manual page for this config file (if docker4ssh is installed on your system properly).

profile.conf

profile.conf is the name of a file as well as a synonym for a specific type of files, profile files. In this files, profiles can be specified. Profiles are settings to which image / container with settings a user should get redirected when a specified username password combination is provided.

A profile file is built up the following:

[section name]
# REQUIRED - (ssh) username. can be specified via regex
# to use regex, put a 'regex:' in front of it
Username = "example"

# OPTIONAL - (ssh) password. can be specified via regex or as hash.
# to use regex, put a 'regex:' in front of it
# if you want to specify a hash, put a 'sha1:', 'sha256:' or 'sha512:' at the beginning of it
Password = ""

# OPTIONAL - the network mode. must be one of the following: 1 (off) | 2 (isolate) | 3 (host) | 4 (docker) | 5 (none)
# NetworkMode describes the level of isolation of the container to the host system.
# Mostly changes the network of the container.
NetworkMode = 3

# OPTIONAL - if the container should be configurable
# If Configurable is true, the container can change settings for itself
Configurable = true

# OPTIONAL - the container run behavior. must be one of the following: 1 (user) | 2 (container) 3 | (forever)
# If the RunLevel is 1, the container will exit when the user disconnects.
# If the RunLevel is 2, the container keeps running if the user disconnects
# and ExitAfter is specified and the specified process has not finished yet.
# If the RunLevel is 3, the container keeps running forever unless ExitAfter
# is specified and the specified process ends.
#
# Note: It also automatically exits if ExitAfter is specified and the specified
# process ends, even if the user is still connected to the container
RunLevel = 1

# OPTIONAL - if information should be shown about the container on startup
# StartupInformation defines if information about the container like its (shorthand)
# container id, NetworkMode, RunLevel, etc. should be shown when connecting to it
StartupInformation = true

# OPTIONAL - a process name to exit after it has finished
# ExitAfter contains a process name after which end the container should stop
ExitAfter = ""

# OPTIONAL - not delete the container when it stops working
# When KeepOnExit is true, the container won't get deleted if it stops working
KeepOnExit = false

# REQUIRED OR `Container` - the image to connect to
Image = "ubuntu:latest"

# REQUIRED OR `Image` - the container id to connect to
Container = ""

See the example profile.conf for another example.

With man profile.conf you can get the manual page for this config file (if docker4ssh is installed on your system properly).

Clone this wiki locally