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

Tacacs, Maximum server limit #2986

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 #Maximum of 8 Tacacs server hosts can be added

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