-
Notifications
You must be signed in to change notification settings - Fork 134
feat: Add user management daemon #309
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
Open
manoharan-nexthop
wants to merge
1
commit into
sonic-net:master
Choose a base branch
from
manoharan-nexthop:sonic-net.user-management
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 hidden or 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,27 @@ | ||
| # PAM faillock configuration managed by userd | ||
| # Do not edit manually - changes will be overwritten | ||
|
|
||
| # Global settings | ||
| dir = /var/run/faillock | ||
| audit | ||
| silent | ||
| no_log_info | ||
|
|
||
| {% if security_policies %} | ||
| # Role-based security policies | ||
| {% for role, policy in security_policies.items() %} | ||
| {% if policy.max_login_attempts %} | ||
| # {{ role }} role settings | ||
| deny = {{ policy.max_login_attempts }} | ||
| unlock_time = 900 # 15 minutes | ||
| {% endif %} | ||
| {% endfor %} | ||
| {% else %} | ||
| # Default settings when no policies are configured | ||
| deny = 5 | ||
| unlock_time = 900 | ||
| {% endif %} | ||
|
|
||
| # Additional settings | ||
| fail_interval = 900 | ||
| root_unlock_time = 900 | ||
This file contains hidden or 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,26 @@ | ||
| # Makefile for sonic-host-userd | ||
|
|
||
| .PHONY: all clean install build-cpp | ||
|
|
||
| # Default target | ||
| all: build-cpp | ||
|
|
||
| # Build C++ components | ||
| build-cpp: | ||
| mkdir -p build | ||
| cd build && cmake ../src && make | ||
|
|
||
| # Clean build artifacts | ||
| clean: | ||
| rm -rf build | ||
|
|
||
| # Install (called by debian packaging) | ||
| install: build-cpp | ||
| mkdir -p $(DESTDIR)/usr/local/bin | ||
| cp build/userd $(DESTDIR)/usr/local/bin/userd | ||
| chmod +x $(DESTDIR)/usr/local/bin/userd | ||
|
|
||
| # For development/testing | ||
| install-local: build-cpp | ||
| sudo cp build/userd /usr/local/bin/userd | ||
| sudo chmod +x /usr/local/bin/userd |
This file contains hidden or 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,5 @@ | ||
| sonic-host-userd (1.0-1) UNRELEASED; urgency=low | ||
|
|
||
| * Initial release | ||
|
|
||
| -- SONiC Maintainers <[email protected]> Mon, 11 Aug 2025 08:00:00 +0000 |
This file contains hidden or 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 @@ | ||
| 11 |
This file contains hidden or 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,11 @@ | ||
| Source: sonic-host-userd | ||
| Maintainer: SONiC Maintainers <[email protected]> | ||
| Section: misc | ||
| Priority: optional | ||
| Standards-Version: 0.1 | ||
| Build-Depends: debhelper (>=11), cmake, g++, pkg-config, libcrypt-dev, nlohmann-json3-dev, libswsscommon-dev | ||
|
|
||
| Package: sonic-host-userd | ||
| Architecture: any | ||
| Depends: ${shlibs:Depends}, ${misc:Depends}, sonic-host-services-data, libswsscommon | ||
| Description: SONiC host userd binary |
This file contains hidden or 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,20 @@ | ||
| Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
| Upstream-Name: sonic-host-userd | ||
| Source: https://github.com/Azure/sonic-buildimage | ||
|
|
||
| Files: * | ||
| Copyright: 2025 Microsoft Corporation | ||
| License: Apache-2.0 | ||
|
|
||
| License: Apache-2.0 | ||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
| . | ||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
| . | ||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. |
This file contains hidden or 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 @@ | ||
| build/userd /usr/local/bin/ |
This file contains hidden or 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,20 @@ | ||
| #!/usr/bin/make -f | ||
|
|
||
| %: | ||
| dh $@ | ||
|
|
||
| override_dh_auto_build: | ||
| dh_auto_build | ||
| # Build C++ components | ||
| make build-cpp | ||
|
|
||
| override_dh_auto_install: | ||
| dh_auto_install | ||
| # Install C++ components | ||
| make install DESTDIR=$(CURDIR)/debian/sonic-host-userd | ||
|
|
||
| override_dh_installsystemd: | ||
| dh_installsystemd --no-start --name=sonic-host-userd | ||
|
|
||
| override_dh_usrlocal: | ||
| # Skip dh_usrlocal since we're intentionally installing to /usr/local/bin |
This file contains hidden or 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,15 @@ | ||
| [Unit] | ||
| Description=User management daemon | ||
| Requires=config-setup.service | ||
| After=config-setup.service | ||
| BindsTo=sonic.target | ||
| After=sonic.target | ||
|
|
||
| [Service] | ||
| Type=simple | ||
| ExecStart=/usr/local/bin/userd | ||
| Restart=always | ||
| RestartSec=5 | ||
|
|
||
| [Install] | ||
| WantedBy=sonic.target |
This file contains hidden or 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,31 @@ | ||
| cmake_minimum_required(VERSION 3.10) | ||
| project(sonic-host-userd) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Include directories (SONiC standard paths) | ||
| include_directories(/usr/include/swss) | ||
| include_directories(/usr/include) | ||
|
|
||
| # Compiler flags | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror") | ||
| set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0") | ||
| set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") | ||
|
|
||
| # Add executable | ||
| add_executable(userd userd.cpp) | ||
|
|
||
| # Link libraries | ||
| target_link_libraries(userd | ||
| swsscommon | ||
| pthread | ||
| crypt | ||
| ) | ||
|
|
||
| # Install target | ||
| install(TARGETS userd | ||
| RUNTIME DESTINATION /usr/local/bin | ||
| ) | ||
|
|
||
|
|
Oops, something went wrong.
Oops, something went wrong.
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.
does faillock support individual config per group/role/user ?