Skip to content

Commit

Permalink
todo
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Dec 13, 2023
1 parent ed0216b commit d31daae
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 27 deletions.
6 changes: 4 additions & 2 deletions Notes
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ sogo 142 0.0 0.0 406040 3860 ? Ssl 22:59 0:00 /usr/bin/memc



api-cli run configure-module --agent module/sogo4 --data - <<EOF
api-cli run configure-module --agent module/sogo6 --data - <<EOF
{
"mail_server": "f38f9911-8341-452e-8941-d889385a59a8",
"ldap_domain": "ad.rocky9-pve4.org",
Expand All @@ -202,7 +202,9 @@ api-cli run configure-module --agent module/sogo4 --data - <<EOF
"lets_encrypt": false,
"host": "sogo3.rocky9-pve4.org",
"workers_count": 3,
"auxiliary_account": true
"auxiliary_account": true,
"active_sync": true,
"dav": true
}
EOF

Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ Example:
api-cli run configure-module --agent module/sogo1 --data - <<EOF
{
"mail_server": "f38f9911-8341-452e-8941-d889385a59a8",
"ldap_domain": "ad.foo.com",
"admin_users" : "admin,administrator",
"mail_domain": "foo.com",
"ldap_domain": "ad.rocky9-pve4.org",
"admin_users" : "Administrator",
"mail_domain": "rocky9-pve4.org",
"http2https": true,
"lets_encrypt": false,
"host": "roundcubemail.domain.com",
"host": "sogo3.rocky9-pve4.org",
"workers_count": 3,
"auxiliary_account": true
"auxiliary_account": true,
"active_sync": true,
"dav": true
}
EOF

Expand Down
2 changes: 2 additions & 0 deletions imageroot/actions/configure-module/10EnvSOGo
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ agent.set_env("LDAP_DOMAIN", data["ldap_domain"])
agent.set_env("MAIL_DOMAIN",data.get("mail_domain",""))
agent.set_env("WOWORKERSCOUNT",data.get("workers_count","3"))
agent.set_env("AUXILIARYACCOUNT",data.get("auxiliary_account",True))
agent.set_env("ACTIVESYNC",data.get("activesync",True))
agent.set_env("DAV",data.get("dav",True))
3 changes: 1 addition & 2 deletions imageroot/actions/create-module/20Env-default
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ if not timezone:

# Create default vars
agent.set_env("ACTIVESYNC", True)
agent.set_env("CUSTOMEMAILFIELD", "userPrincipalName")
agent.set_env("DAV", True)
agent.set_env("DRAFTSFOLDER", "Drafts")
agent.set_env("SOGOFOLDERSSENDEMAILNOTIFICATIONS", "NO")
Expand All @@ -38,4 +37,4 @@ agent.set_env("SXVMEMLIMIT", "512")
agent.set_env("TIMEZONE", timezone)
agent.set_env("TRASHFOLDER", "Trash")
agent.set_env("WOWATCHDOGREQUESTTIMEOUT", "60")
agent.set_env("BACKUPTIME", "30 0")
agent.set_env("BACKUPTIME", "#30 0")
14 changes: 14 additions & 0 deletions imageroot/actions/get-configuration/20read
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import os
import sys
import json
import agent
from agent.ldapproxy import Ldapproxy

# Prepare return variable
config = {}
Expand Down Expand Up @@ -48,5 +49,18 @@ for key in agent.list_service_providers(rdb,'imap','tcp'):
# use it inside a dropdown
config['mail_server_URL'] = modules

# retrieve LDAP domains list
lp = Ldapproxy()
domains = []
for key in lp.get_domains_list():
domains.append({
"name": key,
"label": key,
"value": key,
})

config['user_domains_list'] = domains


# Dump the configuration to stdout
json.dump(config, fp=sys.stdout)
1 change: 0 additions & 1 deletion imageroot/bin/expand-configuration
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ properties = {
"auxiliary_account": 'YES' if os.environ['AUXILIARYACCOUNT'] == 'True' else 'NO',
"active_sync": True if os.environ['ACTIVESYNC'] == 'True' else False,
"dav": True if os.environ['DAV'] == 'True' else False,
"customemailfield": os.environ['CUSTOMEMAILFIELD'],
"draftsfolder": os.environ['DRAFTSFOLDER'],
"sogofolderssendemailnotifications": os.environ['SOGOFOLDERSSENDEMAILNOTIFICATIONS'],
"sogoaclssendemailnotifications": os.environ['SOGOACLSSENDEMAILNOTIFICATIONS'],
Expand Down
3 changes: 2 additions & 1 deletion imageroot/systemd/user/sogo-app.service
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ EnvironmentFile=-%S/state/discovery_ldap.env
WorkingDirectory=%S/state
Restart=always
TimeoutStopSec=70
ExecStartPre=/bin/mkdir -p config
ExecStartPre=/usr/bin/bash -c "/bin/mkdir -p {config,backups}"
ExecStartPre=/bin/rm -f %t/sogo-app.pid %t/sogo-app.ctr-id
ExecStartPre=/usr/local/bin/runagent discover-ldap
ExecStartPre=/usr/local/bin/runagent discover-service
Expand All @@ -30,6 +30,7 @@ ExecStart=/usr/bin/podman run --conmon-pidfile %t/sogo-app.pid \
--volume ./config/cron-sogo:/etc/cron.d/cron-sogo:Z \
--volume ./config/sieve.creds:/etc/sogo/sieve.creds:Z \
--volume ./config/SOGo.conf:/etc/httpd/conf/extra/SOGo.conf:Z \
--volume ./backups:/etc/sogo/backups:Z \
--env=SOGO_* \
${SOGO_IMAGE}
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/sogo-app.ctr-id -t 10
Expand Down
30 changes: 14 additions & 16 deletions imageroot/templates/sogo.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{% if ldap_schema == 'ad' %}
/* 45 AD authentication */
SOGoUserSources =(
{
{
id = AD_Users;
type = ldap;
CNFieldName = displayName;
Expand All @@ -46,14 +46,13 @@
baseDN = "{{ldap_base}}";
bindFields = (
sAMAccountName,
{{customemailfield}}
);
);
hostname = ldap://10.0.2.2:{{ldap_port}};
filter = "(objectClass='user') AND (sAMAccountType=805306368)";
MailFieldNames = ("{{customemailfield}}");
//MailFieldNames = ("userPrincipalName");
scope = SUB;
displayName = "{{mail_domain}} users";
isAddressBook = YES;
isAddressBook = NO;
},
{
id = AD_Groups;
Expand All @@ -67,10 +66,10 @@
baseDN = "{{ldap_base}}";
hostname = ldap://10.0.2.2:{{ldap_port}};
filter = "(objectClass='group') AND (sAMAccountType=268435456)";
MailFieldNames = ("mail");
//MailFieldNames = ("mail");
scope = SUB;
displayName = "{{mail_domain}} groups";
isAddressBook = YES;
isAddressBook = NO;
}
);
{% elif ldap_schema == 'rfc2307' %}
Expand All @@ -84,33 +83,32 @@
baseDN = "{{ldap_base}}";
bindDN = "{{ldap_user}}";
bindPassword = "{{ldap_password}}";
scope = ONE;
scope = SUB;
canAuthenticate = YES;
MailFieldNames = ("mail");
displayName = "{{mail_domain}} groups";
hostname = ldap://10.0.2.2:{{ldap_port}};
isAddressBook = YES;
isAddressBook = NO;
},
{
id = users;
type = ldap;
CNFieldName = cn;
CNFieldName = displayName;
UIDFieldName = uid;
IDFieldName = mail;
IDFieldName = uid;
bindFields = (
mail,
uid
);
IMAPLoginFieldName = mail;
);
IMAPLoginFieldName = uid;
baseDN = "{{ldap_base}}";
bindDN = "{{ldap_user}}";
bindPassword = "{{ldap_password}}";
scope = ONE;
scope = SUB;
MailFieldNames = ("mail");
canAuthenticate = YES;
displayName = "{{mail_domain}} users";
hostname = ldap://10.0.2.2:{{ldap_port}};
isAddressBook = YES;
isAddressBook = NO;
}
);
{% endif %}
Expand Down

0 comments on commit d31daae

Please sign in to comment.