Added auto discover initial commit
This commit is contained in:
parent
a0fcc38a50
commit
da9d36528c
12
bin/.env
12
bin/.env
@ -1,8 +1,8 @@
|
|||||||
# Domain name
|
# Domain name
|
||||||
DOMAIN="crudgingtons.net"
|
DOMAIN="f11228a1.federatedcomputer.cloud"
|
||||||
|
|
||||||
# Company name
|
# Company name
|
||||||
COMPANY="The Crudgingtons"
|
COMPANY="f11228a1 Federated Core"
|
||||||
|
|
||||||
# Country Code (US, HK, GB, JP, etc)
|
# Country Code (US, HK, GB, JP, etc)
|
||||||
COUNTRY="US"
|
COUNTRY="US"
|
||||||
@ -10,12 +10,6 @@ COUNTRY="US"
|
|||||||
# Where to send welcome e-mail
|
# Where to send welcome e-mail
|
||||||
EMAIL="derek@federated.computer"
|
EMAIL="derek@federated.computer"
|
||||||
|
|
||||||
# Admin password
|
|
||||||
ADMINPASS="password123"
|
|
||||||
|
|
||||||
# Listmonk password
|
|
||||||
LISTMONKPASS="password123"
|
|
||||||
|
|
||||||
# Backblaze KeyID (Master Key) for backups
|
# Backblaze KeyID (Master Key) for backups
|
||||||
B2_APPLICATION_KEY_ID="3239c6765fdc"
|
B2_APPLICATION_KEY_ID="3239c6765fdc"
|
||||||
|
|
||||||
@ -23,4 +17,4 @@ B2_APPLICATION_KEY_ID="3239c6765fdc"
|
|||||||
B2_APPLICATION_KEY="0050ac8837466cbca0e0aa574b5f8332f706a5e26c"
|
B2_APPLICATION_KEY="0050ac8837466cbca0e0aa574b5f8332f706a5e26c"
|
||||||
|
|
||||||
# Email address for alerts on services that fail to start
|
# Email address for alerts on services that fail to start
|
||||||
ALERTS_EMAIL="alerts@federated.computer"
|
ALERTS_EMAIL="derek@federated.computer"
|
||||||
|
@ -38,6 +38,7 @@ get_config() {
|
|||||||
. /federated/lib/baserow.sh
|
. /federated/lib/baserow.sh
|
||||||
. /federated/lib/gitea.sh
|
. /federated/lib/gitea.sh
|
||||||
. /federated/lib/caddy.sh
|
. /federated/lib/caddy.sh
|
||||||
|
. /federated/lib/autodiscover.sh
|
||||||
|
|
||||||
COUNTRIES=("AF" "AL" "DZ" "AS" "AD" "AO" "AI" "AQ" "AG" "AR" "AM" "AW" "AU" "AT" "AZ" "BS" "BH" "BD" "BB" "BY" "BE" "BZ" "BJ" "BM" "BT" "BO" "BO" "BA" "BW" "BV" "BR" "IO" "BN" "BN" "BG" "BF" "BI" "KH" "CM" "CA" "CV" "KY" "CF" "TD" "CL" "CN" "CX" "CC" "CO" "KM" "CG" "CD" "CK" "CR" "CI" "CI" "HR" "CU" "CY" "CZ" "DK" "DJ" "DM" "DO" "EC" "EG" "SV" "GQ" "ER" "EE" "ET" "FK" "FO" "FJ" "FI" "FR" "GF" "PF" "TF" "GA" "GM" "GE" "DE" "GH" "GI" "GR" "GL" "GD" "GP" "GU" "GT" "GG" "GN" "GW" "GY" "HT" "HM" "VA" "HN" "HK" "HU" "IS" "IN" "ID" "IR" "IQ" "IE" "IM" "IL" "IT" "JM" "JP" "JE" "JO" "KZ" "KE" "KI" "KP" "KR" "KR" "KW" "KG" "LA" "LV" "LB" "LS" "LR" "LY" "LY" "LI" "LT" "LU" "MO" "MK" "MG" "MW" "MY" "MV" "ML" "MT" "MH" "MQ" "MR" "MU" "YT" "MX" "FM" "MD" "MC" "MN" "ME" "MS" "MA" "MZ" "MM" "MM" "NA" "NR" "NP" "NL" "AN" "NC" "NZ" "NI" "NE" "NG" "NU" "NF" "MP" "NO" "OM" "PK" "PW" "PS" "PA" "PG" "PY" "PE" "PH" "PN" "PL" "PT" "PR" "QA" "RE" "RO" "RU" "RU" "RW" "SH" "KN" "LC" "PM" "VC" "VC" "VC" "WS" "SM" "ST" "SA" "SN" "RS" "SC" "SL" "SG" "SK" "SI" "SB" "SO" "ZA" "GS" "SS" "ES" "LK" "SD" "SR" "SJ" "SZ" "SE" "CH" "SY" "TW" "TW" "TJ" "TZ" "TH" "TL" "TG" "TK" "TO" "TT" "TN" "TR" "TM" "TC" "TV" "UG" "UA" "AE" "GB" "US" "UM" "UY" "UZ" "VU" "VE" "VE" "VN" "VN" "VG" "VI" "WF" "EH" "YE" "ZM" "ZW")
|
COUNTRIES=("AF" "AL" "DZ" "AS" "AD" "AO" "AI" "AQ" "AG" "AR" "AM" "AW" "AU" "AT" "AZ" "BS" "BH" "BD" "BB" "BY" "BE" "BZ" "BJ" "BM" "BT" "BO" "BO" "BA" "BW" "BV" "BR" "IO" "BN" "BN" "BG" "BF" "BI" "KH" "CM" "CA" "CV" "KY" "CF" "TD" "CL" "CN" "CX" "CC" "CO" "KM" "CG" "CD" "CK" "CR" "CI" "CI" "HR" "CU" "CY" "CZ" "DK" "DJ" "DM" "DO" "EC" "EG" "SV" "GQ" "ER" "EE" "ET" "FK" "FO" "FJ" "FI" "FR" "GF" "PF" "TF" "GA" "GM" "GE" "DE" "GH" "GI" "GR" "GL" "GD" "GP" "GU" "GT" "GG" "GN" "GW" "GY" "HT" "HM" "VA" "HN" "HK" "HU" "IS" "IN" "ID" "IR" "IQ" "IE" "IM" "IL" "IT" "JM" "JP" "JE" "JO" "KZ" "KE" "KI" "KP" "KR" "KR" "KW" "KG" "LA" "LV" "LB" "LS" "LR" "LY" "LY" "LI" "LT" "LU" "MO" "MK" "MG" "MW" "MY" "MV" "ML" "MT" "MH" "MQ" "MR" "MU" "YT" "MX" "FM" "MD" "MC" "MN" "ME" "MS" "MA" "MZ" "MM" "MM" "NA" "NR" "NP" "NL" "AN" "NC" "NZ" "NI" "NE" "NG" "NU" "NF" "MP" "NO" "OM" "PK" "PW" "PS" "PA" "PG" "PY" "PE" "PH" "PN" "PL" "PT" "PR" "QA" "RE" "RO" "RU" "RU" "RW" "SH" "KN" "LC" "PM" "VC" "VC" "VC" "WS" "SM" "ST" "SA" "SN" "RS" "SC" "SL" "SG" "SK" "SI" "SB" "SO" "ZA" "GS" "SS" "ES" "LK" "SD" "SR" "SJ" "SZ" "SE" "CH" "SY" "TW" "TW" "TJ" "TZ" "TH" "TL" "TG" "TK" "TO" "TT" "TN" "TR" "TM" "TC" "TV" "UG" "UA" "AE" "GB" "US" "UM" "UY" "UZ" "VU" "VE" "VE" "VN" "VN" "VG" "VI" "WF" "EH" "YE" "ZM" "ZW")
|
||||||
|
|
||||||
|
109
lib/autodiscover.sh
Normal file
109
lib/autodiscover.sh
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Autodiscover service for mail
|
||||||
|
|
||||||
|
PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
||||||
|
config_autodiscover() {
|
||||||
|
echo -ne "\n* Configuring /federated/apps/autodiscover container.."
|
||||||
|
spin &
|
||||||
|
SPINPID=$!
|
||||||
|
|
||||||
|
if [ ! -d "/federated/apps/autodiscover" ]; then
|
||||||
|
mkdir -p /federated/apps/autodiscover
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > /federated/apps/autodiscover/docker-compose.yml <<EOF
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
autodiscover:
|
||||||
|
image: monogramm/autodiscover-email-settings:latest
|
||||||
|
container_name: autodiscover
|
||||||
|
hostname: autodiscover.$DOMAIN
|
||||||
|
domainname: $DOMAIN
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
federated:
|
||||||
|
ipv4_address: 172.99.0.32
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.autodiscover.rule=Host(`autoconfig.$DOMAIN`,`autodiscover.$DOMAIN`)"
|
||||||
|
- "traefik.http.routers.autodiscover.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.autodiscover.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.autodiscover.loadbalancer.server.port=8000"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
federated:
|
||||||
|
external: true
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > /federated/apps/autodiscover/.env <<EOF
|
||||||
|
IMAGE_VERSION="620af02"
|
||||||
|
COMPANY_NAME=$COMPANY
|
||||||
|
SUPPORT_URL=https://autodiscover.$DOMAIN
|
||||||
|
DOMAIN=$DOMAIN
|
||||||
|
# IMAP configuration (host mandatory to enable)
|
||||||
|
IMAP_HOST=mail.$DOMAIN
|
||||||
|
IMAP_PORT=993
|
||||||
|
IMAP_SOCKET=SSL
|
||||||
|
# POP configuration (host mandatory to enable)
|
||||||
|
POP_HOST=mail.$DOMAIN
|
||||||
|
POP_PORT=995
|
||||||
|
POP_SOCKET=SSL
|
||||||
|
# SMTP configuration (host mandatory to enable)
|
||||||
|
SMTP_HOST=mail.$DOMAIN
|
||||||
|
SMTP_PORT=587
|
||||||
|
SMTP_SOCKET=STARTTLS
|
||||||
|
# MobileSync/ActiveSync configuration (url mandatory to enable)
|
||||||
|
# - MOBILESYNC_URL=https://sync.example.com
|
||||||
|
#- MOBILESYNC_NAME=sync.example.com
|
||||||
|
# LDAP configuration (host mandatory to enable)
|
||||||
|
LDAP_HOST=ldap.$DOMAIN
|
||||||
|
LDAP_PORT=636
|
||||||
|
LDAP_SOCKET=SSL
|
||||||
|
LDAP_BASE=dc=federatedcomputer,dc=cloud
|
||||||
|
LDAP_USER_FIELD=mail
|
||||||
|
LDAP_USER_BASE=ou=people,dc=federatedcomputer,dc=cloud
|
||||||
|
LDAP_SEARCH=(|(objectClass=PostfixBookMailAccount))
|
||||||
|
# Apple mobile config identifiers (identifier mandatory to enable)
|
||||||
|
PROFILE_IDENTIFIER=cloud.federatedcomputer.autodiscover
|
||||||
|
PROFILE_UUID=92943D26-CAB3-4086-897D-DC6C0D8B1E86
|
||||||
|
MAIL_UUID=7A981A9E-D5D0-4EF8-87FE-39FD6A506FAC
|
||||||
|
LDAP_UUID=6ECB6BA9-2208-4ABF-9E60-4E9F4CD7309E
|
||||||
|
EOF
|
||||||
|
chmod 600 /federated/apps/autodiscover/.env
|
||||||
|
|
||||||
|
# Add DNS records for auto discovery
|
||||||
|
docker exec -it pdns pdnsutil add-record $DOMAIN autoconfig A 86400 $EXTERNALIP
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record for auto discovery"
|
||||||
|
docker exec -it pdns pdnsutil add-record $DOMAIN autodiscover A 86400 $EXTERNALIP
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record for auto discovery"
|
||||||
|
docker exec -it pdns pdnsutil add-record $DOMAIN @ TXT 86400 "\"mailconf=https://autoconfig.$DOMAIN/mail/config-v1.1.xml\""
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record for auto discovery"
|
||||||
|
docker exec -it pdns pdnsutil add-record $DOMAIN _imaps._tcp SRV "0 0 993 mail.$DOMAIN"
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record for auto discovery"
|
||||||
|
docker exec -it pdns pdnsutil add-record $DOMAIN _pop3s._tcp SRV "0 0 995 mail.$DOMAIN"
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record for auto discovery"
|
||||||
|
docker exec -it pdns pdnsutil add-record $DOMAIN _imaps._tcp SRV "0 0 993 mail.$DOMAIN"
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record for auto discovery"
|
||||||
|
docker exec -it pdns pdnsutil add-record $DOMAIN _submission._tcp SRV 86400 "0 0 587 $DOMAIN"
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record for auto discovery"
|
||||||
|
docker exec -it pdns pdnsutil add-record $DOMAIN _autodiscover._tcp SRV 86400 "0 0 443 autodiscover.$DOMAIN"
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record for auto discovery"
|
||||||
|
docker exec -it pdns pdnsutil add-record $DOMAIN _ldap._tcp SRV 86400 "0 0 636 ldap.$DOMAIN"
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record for auto discovery"
|
||||||
|
|
||||||
|
kill -9 $SPINPID &> /dev/null
|
||||||
|
echo -ne "done."
|
||||||
|
}
|
||||||
|
|
||||||
|
start_autodiscover() {
|
||||||
|
# Start service with command to make sure it's up before proceeding
|
||||||
|
start_service "autodiscover" "nc -z 172.99.0.32 8000 &> /dev/null" "8"
|
||||||
|
|
||||||
|
kill -9 $SPINPID &> /dev/null
|
||||||
|
echo -ne "done."
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
# Federated Computer functions
|
# Federated Computer functions
|
||||||
|
|
||||||
# Define all services
|
# Define all services
|
||||||
SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy")
|
SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover")
|
||||||
|
|
||||||
fail() {
|
fail() {
|
||||||
echo -ne "FAILED\n\n$1\n\n"
|
echo -ne "FAILED\n\n$1\n\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user