initial commit
This commit is contained in:
commit
4f42666bf4
9 changed files with 108 additions and 0 deletions
3
rootfs/etc/confd/conf.d/molly.conf.toml
Normal file
3
rootfs/etc/confd/conf.d/molly.conf.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[template]
|
||||
dest = "/etc/molly-brown/molly.conf"
|
||||
src = "molly.conf.tmpl"
|
20
rootfs/etc/confd/templates/molly.conf.tmpl
Normal file
20
rootfs/etc/confd/templates/molly.conf.tmpl
Normal file
|
@ -0,0 +1,20 @@
|
|||
## Basic settings
|
||||
#
|
||||
Port = 1965
|
||||
Hostname = "{{ getenv "HOST_NAME" }}"
|
||||
CertPath = "/etc/molly-brown/keys/{{ getenv "HOST_NAME" }}-cert.pem"
|
||||
KeyPath = "/etc/molly-brown/keys/{{ getenv "HOST_NAME" }}-key.pem"
|
||||
DocBase = "/var/gemini/"
|
||||
HomeDocBase = "users"
|
||||
GeminiExt = "gmi"
|
||||
DefaultLang = "{{ getenv "DEFAULT_LANG" "en" }}"
|
||||
AccessLog = "/home/molly-brown/access.log"
|
||||
ErrorLog = "/home/molly-brown/error.log"
|
||||
ReadMollyFiles = true
|
||||
|
||||
#
|
||||
## MIME type overrides
|
||||
#
|
||||
[MimeOverrides]
|
||||
"atom.xml$" = "application/atom+xml"
|
||||
"rss.xml$" = "application/rss+xml"
|
21
rootfs/etc/cont-init.d/02-tls
Normal file
21
rootfs/etc/cont-init.d/02-tls
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/with-contenv sh
|
||||
|
||||
KEY="/etc/molly-brown/keys/$HOST_NAME-key.pem"
|
||||
CERT="/etc/molly-brown/keys/$HOST_NAME-cert.pem"
|
||||
|
||||
if [ ! -f "$KEY" ] || [ ! -f "$CERT" ]; then
|
||||
openssl req -x509 -newkey rsa:4096 -keyout "$KEY" -out "$CERT" -days 3650 -nodes -subj "/CN=$HOST_NAME"
|
||||
fi
|
||||
|
||||
chown molly-brown:molly-brown "$KEY"
|
||||
chown molly-brown:molly-brown "$CERT"
|
||||
|
||||
date_valid="$(openssl x509 -in "$CERT" -enddate -noout | sed "s/.*=\(.*\)/\1/")"
|
||||
seconds_valid="$(date --date "$date_valid" +"%s")"
|
||||
now="$(date "+%s")"
|
||||
days="$(echo "($seconds_valid - $now)/(60 * 60 * 24)" | bc)"
|
||||
|
||||
if [ "$days" -lt 7 ]; then
|
||||
echo "only $days to go, generating new certificate..."
|
||||
openssl req -x509 -key "$KEY" -out "$CERT" -days 3650 -nodes -subj "/CN=$HOST_NAME"
|
||||
fi
|
1
rootfs/etc/fix-attrs.d/01-data
Normal file
1
rootfs/etc/fix-attrs.d/01-data
Normal file
|
@ -0,0 +1 @@
|
|||
/var/gemini/ true molly-brown:molly-brown 0664 0775
|
3
rootfs/etc/services.d/molly-brown/run
Normal file
3
rootfs/etc/services.d/molly-brown/run
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/with-contenv sh
|
||||
|
||||
exec s6-setuidgid molly-brown molly-brown -c /etc/molly-brown/molly.conf
|
Loading…
Add table
Add a link
Reference in a new issue