Resolve "[sync] Backport login_enabled Raw Data Collection to v1.3.1" #172
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.
Summary
Backport the
login_enabledraw data collection feature from main branch torelease/v1.3.1.This change enables alpamon to collect raw login-related data from
/etc/shadowand/etc/shells, allowing the server to make more accuratelogin_enableddeterminations.Changes
ShadowExpireDate(*int64) andValidShells([]string) fields toUserDatastructshadowEntrystruct for internal shadow file parsingloadValidShells()helper function to read/etc/shellsloadShadowData()helper function to read/etc/shadowgetUserData()to collect raw data for server-sidelogin_enabledcalculationWhy Backport?
Files Changed
pkg/runner/commit_types.goUserData, addshadowEntrystruct, updateGetData()pkg/runner/commit.goloadValidShells(),loadShadowData(), updategetUserData()pkg/runner/commit_test.goTestLoadValidShells,TestLoadShadowData,TestGetUserDataWithRawFieldsRaw Data Fields
shadow_expire_date*int64/etc/shadowvalid_shells[]string/etc/shellsExample JSON Output
{ "uid": 1000, "gid": 1000, "username": "user", "description": "User", "directory": "/home/user", "shell": "/bin/bash", "shadow_expire_date": null, "valid_shells": ["/bin/sh", "/bin/bash", "/bin/zsh", "/usr/bin/zsh"] }Testing
go build ./...passesgo test -v ./pkg/runner/... -p 1passesgo vet ./pkg/runner/...passesgofmt- no formatting issuesBackward Compatibility
Related
login_enabledfield accuracy with native Linux checks #169release/v1.3.1