generated from NethServer/ns8-kickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from NethServer:removeLdapSettings
Fix LDAP_DOMAIN setting and update mail server event handlers
- Loading branch information
Showing
12 changed files
with
57 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (C) 2023 Nethesis S.r.l. | ||
# Copyright (C) 2024 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
import agent | ||
import json | ||
import os | ||
import sys | ||
|
||
request = json.load(sys.stdin) | ||
rdb = agent.redis_connect() | ||
|
||
# Bind the new domain, overriding previous values (unbind) | ||
agent.bind_user_domains([request["ldap_domain"]]) | ||
providers = agent.list_service_providers(rdb, 'imap', 'tcp', { | ||
'module_uuid': os.environ['MAIL_SERVER'] | ||
}) | ||
|
||
if providers: | ||
user_domain = providers[0]['user_domain'] | ||
agent.bind_user_domains([user_domain]) | ||
agent.set_env('LDAP_DOMAIN', user_domain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ config["lets_encrypt"] = os.getenv("TRAEFIK_LETS_ENCRYPT") == "True" | |
config["mail_server"] = os.getenv("MAIL_SERVER", "") # the value is the Mail module UUID! | ||
config["mail_domain"] = os.getenv("MAIL_DOMAIN", "") # the value is the mail domain of user to force domain identity : [email protected] ! | ||
config["admin_users"] = os.getenv("ADMIN_USERS", "administrator") | ||
config["ldap_domain"] = os.getenv("LDAP_DOMAIN", "") | ||
config["workers_count"] = os.getenv("WOWORKERSCOUNT", "3") | ||
config["auxiliary_account"] = os.getenv("AUXILIARYACCOUNT") == "True" | ||
config["activesync"] = os.getenv("ACTIVESYNC") == "True" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (C) 2022 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
import json | ||
import sys | ||
import agent | ||
import os | ||
|
||
event = json.load(sys.stdin) | ||
|
||
if event['module_uuid'] == os.getenv('MAIL_SERVER', ''): | ||
# Update user domain in redis because the mail server might have changed its user_domain | ||
rdb = agent.redis_connect() | ||
|
||
providers = agent.list_service_providers(rdb, 'imap', 'tcp', { | ||
'module_uuid': os.environ['MAIL_SERVER'] | ||
}) | ||
|
||
if providers: | ||
user_domain = providers[0]['user_domain'] | ||
agent.bind_user_domains([user_domain]) | ||
agent.set_env('LDAP_DOMAIN', user_domain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (C) 2024 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
import json | ||
import sys | ||
import agent | ||
import os | ||
|
||
event = json.load(sys.stdin) | ||
|
||
if event['module_uuid'] == os.getenv('MAIL_SERVER', ''): | ||
# Restart to apply changed settings | ||
agent.run_helper("systemctl", "--user", "try-restart", "sogo.service").check_returncode() |
21 changes: 0 additions & 21 deletions
21
imageroot/events/smarthost-changed/user-domain-changed/20configure-ldap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters