Skip to content

Commit

Permalink
Issue Description: There is no limit on the number of tacacs servers …
Browse files Browse the repository at this point in the history
…that can be added as host. Root-Cause: A limit on the Number of tacacs servers can that be added was not set. What i did: added a limit as 8 on the number of tacacs servers that can be added
  • Loading branch information
Vignesh S committed Sep 19, 2023
1 parent 701994f commit 7d2a262
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/aaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
RADIUS_MAXSERVERS = 8
RADIUS_PASSKEY_MAX_LEN = 65
VALID_CHARS_MSG = "Valid chars are ASCII printable except SPACE, '#', and ','"
TACACS_MAXSERVERS = 8

def is_secret(secret):
return bool(re.match('^' + '[^ #,]*' + '$', secret))
Expand Down Expand Up @@ -266,8 +267,11 @@ def add(address, timeout, key, auth_type, port, pri, use_mgmt_vrf):
config_db = ValidatedConfigDBConnector(ConfigDBConnector())
config_db.connect()
old_data = config_db.get_entry('TACPLUS_SERVER', address)
number_of_servers = len(config_db.get_table('TACPLUS_SERVER'))
if old_data != {}:
click.echo('server %s already exists' % address)
elif number_of_servers == TACACS_MAXSERVERS:
click.echo('Maximum of %d can be configured' % TACACS_MAXSERVERS)
else:
data = {
'tcp_port': str(port),
Expand Down

0 comments on commit 7d2a262

Please sign in to comment.