Skip to content

HLD for persistent local user management#2018

Open
manoharan-nexthop wants to merge 1 commit into
sonic-net:masterfrom
manoharan-nexthop:user-mgmt
Open

HLD for persistent local user management#2018
manoharan-nexthop wants to merge 1 commit into
sonic-net:masterfrom
manoharan-nexthop:user-mgmt

Conversation

@manoharan-nexthop

@manoharan-nexthop manoharan-nexthop commented Jun 17, 2025

Copy link
Copy Markdown

Currently the local users that are created are not persistent across upgrades. This HLD proposes to manage the users across upgrades by storing the configuration in CONFIG_DB and a daemon to manage them in Linux.

Implementation Pull requests:

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

Comment thread doc/User_Management/User_Management.md
Comment thread doc/User_Management/User_Management.md Outdated
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@anders-nexthop

Copy link
Copy Markdown

@manoharan-nexthop - Do you have some draft implementation or just HLD changes? If you have any specific details or examples, please share them.

@vitaliibylinka PRs with implementation details have been posted.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@spandan-nexthop spandan-nexthop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!
Just added some comments/questions.

Comment thread doc/User_Management/User_Management.md Outdated
Comment thread doc/User_Management/User_Management.md
Comment thread doc/User_Management/User_Management.md
@arlakshm

arlakshm commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

@qiluo-msft can you please help signoff on this feature?

manoharan-nexthop added a commit to manoharan-nexthop/sonic-buildimage that referenced this pull request Nov 18, 2025
This implementation addresses the User Management HLD requirements for
centralized user administration in SONiC.
sonic-net/SONiC#2018

nexthop-ai/private-sonic-host-services#54
nexthop-ai/private-sonic-utilities#120

**1. YANG Model & Configuration Schema:**
- Added sonic-user.yang model defining LOCAL_USER and
LOCAL_ROLE_SECURITY_POLICY tables
- Integrated user management into CONFIG_DB schema with role-based
configuration
- Added DEVICE_METADATA.local_user_management feature flag

**2. User Management Daemon (userd):**
- Implemented C++ daemon using SWSS framework for CONFIG_DB integration
- Added user lifecycle management (create/update/delete/enable/disable)
- Implemented role-based group assignment (administrator, operator
roles)
- Added SSH key management with proper file permissions
- Integrated PAM faillock configuration using Jinja2 templates

**3. CLI Interface:**
- Extended sonic-utilities with 'config user' and 'show user' commands
- Added user import functionality to migrate existing system users
- Added role-based user management with proper validation

**4. Build System Integration:**
- Added sonic-host-services package with userd daemon and systemd
service
- Integrated user management into SONiC image build process
- Added template-based configuration generation for init_cfg.json
- Added build dependencies for JSON processing and password hashing

Tested for all the features that are implemented.
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

Comment thread doc/User_Management/User_Management.md
@BYGX-wcr

Copy link
Copy Markdown
Contributor

Password hashes are also considered sensitive data since they can be used for reverse-engineering to get the password. Normally, /etc/shadow is only readable to root-level user. Making this change in SONiC essentially expose the /etc/shadow file content to general users and breaks the security policy of Linux.

Comment thread doc/User_Management/User_Management.md
@aidan-gallagher

Copy link
Copy Markdown

Password hashes are also considered sensitive data since they can be used for reverse-engineering to get the password. Normally, /etc/shadow is only readable to root-level user. Making this change in SONiC essentially expose the /etc/shadow file content to general users and breaks the security policy of Linux.

I believe the CLI show command will only show password hashes when the user is root.
See can_view_passwords in https://github.com/sonic-net/sonic-utilities/pull/4053/files#diff-3311722931fe6ac91c84f68dc5b09d27dbc6624d78e59165e1f0c54564a5b947R29.

I believe the file /etc/sonic/config_db.json is currently world readable

-rw-r--r-- 1 root root 17K Sep 23 09:07 /etc/sonic/config_db.json

And it will need to be changed to this

-rw--r---- 1 root redis 731 Sep 16 14:25 /etc/sonic/config_db.json

I don't see the code to do that in this PR? I would expect something like the following code at the end of generate_config() (
https://github.com/sonic-net/sonic-buildimage/blob/master/files/image_config/config-setup/config-setup#L255)

sudo chmod 640 ${DEST_FILE}
sudo chown root:redis ${DEST_FILE}

@anilpannala anilpannala moved this from 🏗 In Progress to 🆕 Backlog (not in plan yet) in SONiC 202511 Release Feb 6, 2026
@zhangyanzhao zhangyanzhao moved this from Todo to In Progress in SONiC 202605 Release Feb 12, 2026
manoharan-nexthop added a commit to manoharan-nexthop/sonic-buildimage that referenced this pull request Apr 16, 2026
This implementation addresses the User Management HLD requirements for
centralized user administration in SONiC.
sonic-net/SONiC#2018

nexthop-ai/private-sonic-host-services#54
nexthop-ai/private-sonic-utilities#120

**1. YANG Model & Configuration Schema:**
- Added sonic-user.yang model defining LOCAL_USER and
LOCAL_ROLE_SECURITY_POLICY tables
- Integrated user management into CONFIG_DB schema with role-based
configuration
- Added DEVICE_METADATA.local_user_management feature flag

**2. User Management Daemon (userd):**
- Implemented Rust daemon using SWSS framework for CONFIG_DB integration
- Added user lifecycle management (create/update/delete/enable/disable)
- Implemented role-based group assignment (administrator, operator
roles)
- Added SSH key management with proper file permissions
- Integrated PAM faillock configuration using Jinja2 templates

**3. CLI Interface:**
- Extended sonic-utilities with 'config user' and 'show user' commands
- Added user import functionality to migrate existing system users
- Added role-based user management with proper validation

**4. Build System Integration:**
- Added template-based configuration generation for init_cfg.json
- Added build dependencies for JSON processing and password hashing

Tested for all the features that are implemented.
manoharan-nexthop added a commit to manoharan-nexthop/sonic-buildimage that referenced this pull request Apr 16, 2026
This implementation addresses the User Management HLD requirements for
centralized user administration in SONiC.
sonic-net/SONiC#2018

nexthop-ai/private-sonic-host-services#54
nexthop-ai/private-sonic-utilities#120

**1. YANG Model & Configuration Schema:**
- Added sonic-user.yang model defining LOCAL_USER and
LOCAL_ROLE_SECURITY_POLICY tables
- Integrated user management into CONFIG_DB schema with role-based
configuration
- Added DEVICE_METADATA.local_user_management feature flag

**2. User Management Daemon (userd):**
- Implemented Rust daemon using SWSS framework for CONFIG_DB integration
- Added user lifecycle management (create/update/delete/enable/disable)
- Implemented role-based group assignment (administrator, operator
roles)
- Added SSH key management with proper file permissions
- Integrated PAM faillock configuration using Jinja2 templates

**3. CLI Interface:**
- Extended sonic-utilities with 'config user' and 'show user' commands
- Added user import functionality to migrate existing system users
- Added role-based user management with proper validation

**4. Build System Integration:**
- Added template-based configuration generation for init_cfg.json
- Added build dependencies for JSON processing and password hashing

Tested for all the features that are implemented.

Signed-off-by: Manoharan Sundaramoorthy <manoharan@nexthop.ai>
@rookie-who

Copy link
Copy Markdown
Contributor

Hi @manoharan-nexthop — the 202605 branch cut is at end of May. This PR has had no activity since Dec 2025. Are you still planning to land this for 202605? If so, please address @aidan-gallagher's review comments. Otherwise we may need to defer to the next release.

CC: @vaibhavhd @radha-danda (branch managers)

@anders-nexthop

Copy link
Copy Markdown

Hi @manoharan-nexthop — the 202605 branch cut is at end of May. This PR has had no activity since Dec 2025. Are you still planning to land this for 202605? If so, please address @aidan-gallagher's review comments. Otherwise we may need to defer to the next release.

CC: @vaibhavhd @radha-danda (branch managers)

@rookie-who there is recent activity on all of the linked PRs, including LGTM responses on all three from @aidan-gallagher. These PRs still require sign-off from a reviewer with write-access before they can be merged.

@rookie-who

Copy link
Copy Markdown
Contributor

Hi @qiluo-msft @maipbui — could you please review and sign off on this HLD from the AAA and user management perspective? The 202605 branch cut is at end of May.

CC: @vaibhavhd @radha-danda (branch managers)

@securely1g

Copy link
Copy Markdown

@qiluo-msft @maipbui Could you review and sign off on this HLD from the AAA and user management perspective? Thanks!

manoharan-nexthop added a commit to manoharan-nexthop/sonic-buildimage that referenced this pull request May 24, 2026
This implementation addresses the User Management HLD requirements for
centralized user administration in SONiC.
sonic-net/SONiC#2018

nexthop-ai/private-sonic-host-services#54
nexthop-ai/private-sonic-utilities#120

**1. YANG Model & Configuration Schema:**
- Added sonic-user.yang model defining LOCAL_USER and
LOCAL_ROLE_SECURITY_POLICY tables
- Integrated user management into CONFIG_DB schema with role-based
configuration
- Added DEVICE_METADATA.local_user_management feature flag

**2. User Management Daemon (userd):**
- Implemented Rust daemon using SWSS framework for CONFIG_DB integration
- Added user lifecycle management (create/update/delete/enable/disable)
- Implemented role-based group assignment (administrator, operator
roles)
- Added SSH key management with proper file permissions
- Integrated PAM faillock configuration using Jinja2 templates

**3. CLI Interface:**
- Extended sonic-utilities with 'config user' and 'show user' commands
- Added user import functionality to migrate existing system users
- Added role-based user management with proper validation

**4. Build System Integration:**
- Added template-based configuration generation for init_cfg.json
- Added build dependencies for JSON processing and password hashing

Tested for all the features that are implemented.

Signed-off-by: Manoharan Sundaramoorthy <manoharan@nexthop.ai>
@rookie-who

Copy link
Copy Markdown
Contributor

This PR/feature will not be included in the SONiC 202605 release. It can be retargeted for the 202611 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🆕 Backlog (not in plan yet)
Status: In Progress

Development

Successfully merging this pull request may close these issues.