WIP kong rpm updates #2241
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2241
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2241/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #1661
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1661
Original created: 2025-09-25T03:19:01Z
Original updated: 2025-09-26T16:30:35Z
Original head: carverauto/serviceradar:kong/rpm_packaging_fixes
Original base: main
Original merged: 2025-09-26T16:30:11Z by @mfreeman451
PR Type
Enhancement
Description
Add systemd service integration for Kong Gateway
Fix certificate timezone/clock skew issues
Improve RPM packaging with user management
Add Kong wrapper script for proper service execution
Diagram Walkthrough
File Walkthrough
tls.go
Fix certificate timing for clock skewpkg/cli/tls.go
NotBeforetime to 1 hour agokong-wrapper.sh
Add Kong systemd service wrapperpackaging/kong/scripts/kong-wrapper.sh
postinstall.sh
Enhance postinstall with user creationpackaging/kong/scripts/postinstall.sh
serviceradar-kongpreremove.sh
Add service cleanup on removalpackaging/kong/scripts/preremove.sh
serviceradar-kongservice before removalserviceradar-kong.service
Add systemd service configurationpackaging/kong/systemd/serviceradar-kong.service
serviceradar-kong.spec
Update RPM spec for systemd supportpackaging/specs/serviceradar-kong.spec
Imported GitHub PR comment.
Original author: @CLAassistant
Original URL: https://github.com/carverauto/serviceradar/pull/1661#issuecomment-3331891581
Original created: 2025-09-25T03:19:07Z
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
mfreeman seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1661#issuecomment-3331896851
Original created: 2025-09-25T03:19:46Z
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
Service privilege and permissions:
The systemd unit runs as root and the wrapper chowns /etc/kong and /usr/local/kong recursively. Running Kong as root increases blast radius; consider running the service as the 'kong' user and limiting chown scope to necessary paths. Additionally, creating a system user with shell '/sbin/nologin' is good, but ensure config files and logs don't become world-readable after ownership changes.
Behavior Change
Setting certificate NotBefore to one hour in the past changes validity windows; confirm this aligns with compliance and testing expectations, and consider making the skew configurable instead of hard-coded.
Privilege Model
Service runs as root while wrapper ensures kong-owned dirs; verify Kong itself drops privileges or run service as kong user to minimize risk, and ensure file permissions allow non-root operation.
Exec Arg Handling
Appending '-c /etc/kong/kong.conf' after all user args may conflict with commands that expect options before subcommands; validate for 'start', 'reload', etc., and consider placing config earlier or allowing override.
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1661#issuecomment-3331904515
Original created: 2025-09-25T03:20:47Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Drop root privileges before executing
To mitigate a security risk, modify
kong-wrapper.shto userunuser -u kongtoexecute the
kongbinary, dropping root privileges and running the service withthe dedicated
konguser.packaging/kong/scripts/kong-wrapper.sh [23-24]
Suggestion importance[1-10]: 10
__
Why: The suggestion correctly identifies a critical security vulnerability where the Kong service runs as
rootand proposes a valid fix to drop privileges to thekonguser before execution.Run Kong service as non-root user
The systemd service for Kong should run as the dedicated
konguser instead ofrootto enhance security. This aligns with the PR's creation of akonguser andfollows the principle of least privilege.
Examples:
packaging/kong/systemd/serviceradar-kong.service [16-17]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: This suggestion correctly identifies a critical security flaw by pointing out that the service runs as
rootdespite a dedicatedkonguser being created, which undermines the principle of least privilege.Remove error suppression for chown
Remove the
|| truefrom thechowncommands inkong-wrapper.sh. This will ensurethe script fails immediately if ownership cannot be set, preventing the service
from starting in a broken state.
packaging/kong/scripts/kong-wrapper.sh [16-17]
Suggestion importance[1-10]: 7
__
Why: This suggestion correctly identifies that suppressing
chownerrors can lead to runtime failures. Removing|| trueimproves script robustness and ensures the service does not start in a misconfigured state.Remove error suppression for mkdir
In
kong-wrapper.sh, remove the|| truefrom themkdir -pcommand. This willallow the script to fail on legitimate errors, improving its robustness, as the
-pflag already prevents failure if the directory exists.packaging/kong/scripts/kong-wrapper.sh [12]
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly points out that suppressing the exit code of
mkdir -pcan hide serious filesystem issues, and removing|| trueimproves the script's robustness by allowing it to fail fast.