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

Common Authentication Template fix #16593

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Vignesh1405
Copy link

Issue Description: Local authentication succeeds (admin user) even when only tacacs+ is configured for login authentication Root-Cause: Authentication of Tacacs and tacacs,local was being handled in the same way in the template file common-auth-sonic.j2
What i did: Separated the condition such that tacacs+,local is handled differently from tacacs+ configuration

Why I did it

Local authentication succeeds (admin user) even when only TACACS+ is configured for login authentication

How I did it

Separated the condition such that tacacs+,local is handled differently from tacacs+ configuration

How to verify it

Configure aaa authentication login as tacacs+. open a new ssh session, and try to login using local user credentials. The authentication should not succeed.

Description for the changelog

Separated the condition such that tacacs+,local is handled differently from tacacs+ configuration in common-auth-sonic.j2 file.

…en only tacacs+ is configured for login authentication Root-Cause: Authentication of tacacs and tacacs,local was being handled in the same way in the template file common-auth-sonic.j2 What i did:Seperated the condition such that tacacs+,local is handled differently from tacacs+ configuration
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 19, 2023

CLA Missing ID CLA Not Signed

@lguohan
Copy link
Collaborator

lguohan commented Sep 23, 2023

@qiluo-msft to review

@lguohan lguohan added the auth label Sep 23, 2023
@qiluo-msft qiluo-msft requested a review from liuh-80 September 23, 2024 20:53
@@ -22,11 +22,16 @@ auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not
auth [success=1 default=ignore] pam_tacplus.so server={{ last_server.ip }}:{{ last_server.tcp_port }} secret={{ last_server.passkey }} login={{ last_server.auth_type }} timeout={{ last_server.timeout }} {% if last_server.vrf %} vrf={{ last_server.vrf }} {% endif %} {{ 'source_ip=%s' % src_ip if src_ip }} try_first_pass

{% endif %}
{% elif auth['login'] == 'tacacs+' or auth['login'] == 'tacacs+,local' %}
{% elif auth['login'] == 'tacacs+' %}
{% for server in servers %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TACACS sever loop code are same.
2 place changed:

For TACACS+ only scenario, following line removed:
auth [success=1 default=ignore] pam_unix.so nullok try_first_pass

For TACACS+, LOCAL scenario, following line added:
auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_unix.so nullok try_first_pass

I will verify this again

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TACACS authorization code be there for long time, and in practice local user can't login when TACACS+ only enabled and remote server reachable.

So, need reproduce and verify this issue.

@liuh-80
Copy link
Contributor

liuh-80 commented Sep 24, 2024

/azpw run Azure.sonic-buildimage

Copy link

Commenter does not have sufficient privileges for PR 16593 in repo sonic-net/sonic-buildimage

@liuh-80
Copy link
Contributor

liuh-80 commented Sep 24, 2024

@Vignesh1405 , I can't reproduce the issue in description with following steps:

  1. Enable TACACS on device.
  2. Check TACACS server side config, make sure 'admin' account not a remote user.
  3. Login with device with 'admin' account.
    My test result is: 'admin' user can't login with above steps.

Can you share me how to produce the issue you trying to fix?

Also, SONiC has following feature: When authentication set to 'tacacs+' and TACACS server not reachable, local user can login to device with local authorization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants