Fix: use domain_name (FQDN) in cell invite and conflict checks
Unit Tests / test (push) Successful in 7m39s
Unit Tests / test (push) Successful in 7m39s
The GET /api/cells/invite endpoint was returning domain='pic.ngo' instead of the full FQDN 'test5.pic.ngo' because it read _identity.domain rather than _identity.domain_name. Apply the same domain_name preference (domain_name || domain) to: - routes/cells.py get_cell_invite() — the invite shown to connecting cells - routes/cells.py update_cell_permissions() — Corefile DNS regeneration - cell_link_manager.py _check_invite_conflicts() — incoming domain collision check - cell_link_manager.py exchange_invites() — own invite construction Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -426,7 +426,7 @@ class CellLinkManager:
|
||||
try:
|
||||
from app import config_manager
|
||||
identity = config_manager.configs.get('_identity', {})
|
||||
own_domain = identity.get('domain', os.environ.get('CELL_DOMAIN', ''))
|
||||
own_domain = identity.get('domain_name') or identity.get('domain', os.environ.get('CELL_DOMAIN', ''))
|
||||
if own_domain and remote_domain == own_domain:
|
||||
raise ValueError(
|
||||
f"Domain {remote_domain!r} is the same as this cell's own domain — "
|
||||
@@ -466,7 +466,7 @@ class CellLinkManager:
|
||||
identity = self._local_identity()
|
||||
from app import config_manager
|
||||
id_cfg = config_manager.configs.get('_identity', {})
|
||||
own_domain = id_cfg.get('domain', os.environ.get('CELL_DOMAIN', 'cell'))
|
||||
own_domain = id_cfg.get('domain_name') or id_cfg.get('domain', os.environ.get('CELL_DOMAIN', 'cell'))
|
||||
own_invite = self.generate_invite(identity['cell_name'], own_domain)
|
||||
except Exception as e:
|
||||
return {'ok': False, 'error': f'could not build own invite: {e}'}
|
||||
|
||||
+3
-2
@@ -47,7 +47,7 @@ def get_cell_invite():
|
||||
from app import cell_link_manager, config_manager
|
||||
identity = config_manager.configs.get('_identity', {})
|
||||
cell_name = identity.get('cell_name', os.environ.get('CELL_NAME', 'mycell'))
|
||||
domain = identity.get('domain', os.environ.get('CELL_DOMAIN', 'cell'))
|
||||
domain = identity.get('domain_name') or identity.get('domain', os.environ.get('CELL_DOMAIN', 'cell'))
|
||||
return jsonify(cell_link_manager.generate_invite(cell_name, domain))
|
||||
except Exception as e:
|
||||
logger.error(f"Error generating cell invite: {e}")
|
||||
@@ -146,7 +146,8 @@ def update_cell_permissions(cell_name):
|
||||
# Regenerate Corefile so outbound DNS changes take effect
|
||||
try:
|
||||
from app import config_manager
|
||||
domain = config_manager.configs.get('_identity', {}).get('domain', 'cell')
|
||||
_id = config_manager.configs.get('_identity', {})
|
||||
domain = _id.get('domain_name') or _id.get('domain', 'cell')
|
||||
peers = peer_registry.list_peers()
|
||||
cell_links = cell_link_manager.list_connections()
|
||||
firewall_manager.apply_all_dns_rules(peers, COREFILE_PATH, domain,
|
||||
|
||||
Reference in New Issue
Block a user