Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fix port and help #61

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.6.4] - 2024-10-10

### Fixed

- Fixed issue with help message on --jwt.
- Fixed issue with fabric port on ziti version above 30 if link listener was eneabled.

## [1.6.3] - 2024-09-25

- Add --skipSoftwareMgmtPortCheck to allow skipping just the software management port check.
Expand Down
34 changes: 17 additions & 17 deletions router_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ def check_port(ip_host, port, timeout):
if port == 6262:
logging.info("Found port 6262 closed - could be intentional")
return True
else:
logging.error("Socket error: %s", error)
return False
logging.error("Socket error: %s", error)
return False
finally:
socket_connection.close()

Expand Down Expand Up @@ -306,15 +305,15 @@ def create_parser():

:return: A Namespace containing arguments
"""
__version__ = '1.6.3'
__version__ = '1.6.4'
parser = argparse.ArgumentParser()

mgroup = parser.add_mutually_exclusive_group(required=True)

mgroup.add_argument('registration_key', nargs='?',
help='NetFoundry Edge-Router Registration Key')
mgroup.add_argument('--jwt', type=str,
help='Path to file based jwt')
help='JWT string')
parser.add_argument('-f', '--force',
action="store_false",
help='Forcefully proceed with re-enrollment',
Expand Down Expand Up @@ -645,6 +644,13 @@ def handle_ziti_router_auto_enroll(args, router_info, enrollment_commands, regis
enrollment_commands.append('tls:0.0.0.0:443')
enrollment_commands.append(f"{args.edge}:443")

# set fabric_port depending on ziti version
fabric_port = 80
if ziti_router_auto_enroll.compare_semver(
router_info['productMetadata']['zitiVersion'],'0.30.0'
) >= 0:
fabric_port = 443

# if the setting was selected in the NetFoundry console
# if overriding the fabric listener add a manual linkListener
# Otherwise the auto_enroller will create one if passing in
Expand All @@ -653,8 +659,8 @@ def handle_ziti_router_auto_enroll(args, router_info, enrollment_commands, regis
if args.fabric:
enrollment_commands.append('--linkListeners')
enrollment_commands.append('transport')
enrollment_commands.append('tls:0.0.0.0:80')
enrollment_commands.append(f"tls:{args.fabric}:80")
enrollment_commands.append(f"tls:0.0.0.0:{fabric_port}")
enrollment_commands.append(f"tls:{args.fabric}:{fabric_port}")
else:
enrollment_commands.append('--assumePublic')

Expand Down Expand Up @@ -688,16 +694,10 @@ def handle_ziti_router_auto_enroll(args, router_info, enrollment_commands, regis
enrollment_commands.append(router_info['productMetadata']['zitiBinaryBundleLinuxAMD64'])


# check if ziti version is 0.30.0 or above
fabric_port = ziti_router_auto_enroll.compare_semver(
router_info['productMetadata']['zitiVersion'],'0.30.0'
)

# pass in fabric port 443 for versions 0.30.0 and above
if fabric_port >= 0:
logging.debug("Setting fabric port to 443")
enrollment_commands.append('--controllerFabricPort')
enrollment_commands.append('443')
# pass in fabric port
logging.debug("Setting fabric port to %s", fabric_port)
enrollment_commands.append('--controllerFabricPort')
enrollment_commands.append(f"{fabric_port}")

# add proxy if specified
if args.proxyAddress:
Expand Down
Loading