Skip to content

Commit

Permalink
Merge pull request #99 from NethServer/sdl-fix-7199
Browse files Browse the repository at this point in the history
Fix external AD domain connection failure handling and improve domain extraction logic NethServer/dev#7199
  • Loading branch information
stephdl authored Dec 9, 2024
2 parents fafd227 + 7769948 commit 5c37353
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion root/usr/sbin/ns8-join
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ if account_provider_config['isAD'] == '1':
value = add_external_domain_response['data']['output'][0].get('value', '')
message = f"Task add_external_domain has failed: reason: {error} value: {value}"
print(message, file=sys.stderr)
subprocess.run(['/usr/sbin/ns8-leave']) # leave the cluster, we failed to connect to the external domain
sys.exit(1)
elif account_provider_config['isLdap'] == '1' and '127.0.0.1' in account_provider_config['LdapURI']:
# Configure OpenLDAP as account provider of an external user domain: (retrieve the baseDN from the UI, directory.nh is obsoleted)
Expand Down Expand Up @@ -276,7 +277,7 @@ elif account_provider_config['isLdap'] == '1' and '127.0.0.1' in account_provide
value = add_external_domain_response['data']['output'][0].get('value', '')
message = f"Task add_external_domain has failed: reason: {error} value: {value}"
print(message, file=sys.stderr)
subprocess.run(['/usr/sbin/ns8-leave'])
subprocess.run(['/usr/sbin/ns8-leave']) # leave the cluster, we failed to connect to the external domain
sys.exit(1)
elif account_provider_config['isLdap'] == '1':
# Remote LDAP account provider
Expand Down
7 changes: 5 additions & 2 deletions ui/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,10 @@ export default {
const ns8Config = output.configuration.ns8.props;
const slapd = output.configuration.slapd.props;
const account_provider_proposal = output.configuration.account_provider_proposal;
this.config.isConnected = ns8Config.Host != "";
this.config.isConnected =
ns8Config.Host != "" &&
ns8Config.User != "" &&
ns8Config.Password != "";
this.config.leaderNode = ns8Config.Host;
this.config.adminUsername = ns8Config.User;
this.config.adminPassword = ns8Config.Password;
Expand Down Expand Up @@ -1618,7 +1621,7 @@ export default {
context.error.connectionUpdate = errorMessage;
// Extract the 'error' field value from streamMessage
const domainExistMatch = streamMessage.match(/domain_exists value: ([^\s]+)/i);
const domainValue = domainExistMatch[1];
const domainValue = (domainExistMatch && domainExistMatch[1]) || "";
const unauthorizedMatch = streamMessage.match(/unauthorized/i);
const certificateVerifyFailedMatch = streamMessage.match(
/certificate_verify_failed/i
Expand Down

0 comments on commit 5c37353

Please sign in to comment.