-
Notifications
You must be signed in to change notification settings - Fork 731
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+ test]: Add TACACS+ test #372
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Setup for TACACS+ testbed: | ||
# 1. Start TACACS+ service (tac_plus) in TACACS+ server. | ||
# 2. Add TACACS+ passkey, user account and password for test in TACACS+ server. | ||
# 3. Update TACACS+ server ip, passkey, user account and password in group_vars/lab/lab.yml | ||
# 4. Update ssh_user and ssh_pass for TACACS+ server in inventory | ||
############################################################################################### | ||
|
||
# Set TACACS+ authentication configuration in DUT | ||
- name: Set global TACACS+ passkey | ||
become: true | ||
shell: config tacacs passkey {{ tacacs_passkey }} | ||
|
||
- name: Add TACACS+ server | ||
become: true | ||
shell: config tacacs add {{ tacacs_servers[0] }} | ||
|
||
# Test TACACS+ login authentication | ||
- name: Enable TACACS+ Authentication | ||
become: true | ||
shell: config aaa authentication login tacacs+ local | ||
|
||
- name: Check if pam configuration ok | ||
become: true | ||
shell: "grep 'pam_tacplus.so server={{ tacacs_servers[0] }}' /etc/pam.d/common-auth-sonic" | ||
register: tacplus_pam_module | ||
failed_when: '"secret={{ tacacs_passkey }}" not in tacplus_pam_module.stdout' | ||
|
||
- name: Check if TACACS+ user login ok | ||
shell: "sshpass -p {{ tacacs_passwd }} ssh {{ tacacs_username }}@{{ ansible_host }} whoami" | ||
connection: local | ||
become: no | ||
register: login_result | ||
failed_when: login_result.stdout != "{{ tacacs_username }}" | ||
|
||
# Test failthrough mechanism | ||
- name: Config local authentication prior to TACACS+ authentication | ||
become: true | ||
shell: config aaa authentication login local tacacs+ | ||
|
||
- name: Disable fail-through mechanism | ||
become: true | ||
shell: config aaa authentication failthrough disable | ||
|
||
- name: Check if TACACS+ user login fail | ||
shell: "sshpass -p {{ tacacs_passwd }} ssh {{ tacacs_username }}@{{ ansible_host }} whoami" | ||
connection: local | ||
become: no | ||
register: login_result | ||
failed_when: login_result.stdout == "{{ tacacs_username }}" | ||
|
||
- name: Restore fail-through mechanism | ||
become: true | ||
shell: config aaa authentication failthrough default | ||
|
||
# Cleanup TACACS+ configuration | ||
- name: Delete TACACS+ server | ||
become: true | ||
shell: config tacacs delete {{ tacacs_servers[0] }} | ||
|
||
- name: Delete TACACS+ passkey | ||
become: true | ||
shell: config tacacs default passkey | ||
|
||
- name: Set AAA authentication default | ||
become: true | ||
shell: config aaa authentication login default | ||
|
||
- name: Set AAA authentication failthrough default | ||
become: true | ||
shell: config aaa authentication failthrough default |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liuqu are you using the default ptf docker within the testbed? I didn't closely follow up PRs in sonic-buildimage, is this server been included and deployed with testbed ptf docker?
did you add your Tacacs+ design/testing document to sonic/wiki so the community member can follow? (I remembered last time it's from your own repo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry too late to reply. You can find the the test plan in TACACS+ Test Plan.md
TACACS+ server is a host which installed tac_plus, not included in ptf docker. This configuration is used to save the username and password to ensure that TACACS+ server can be logined to execute sudo command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature source address for TACACS+ is needed for source address test. It will be pulled request after the current PRs are merged.