fix: Support Rocky Linux 9 pour le package RPM
Cible: Rocky Linux 9 (compatible RHEL/CentOS)
Changes:
- packaging/Dockerfile.rpm: Build pour Rocky Linux
- packaging/build-rpm.sh: Ajout paramètre distribution (rocky/rhel/centos)
- packaging/rpm/ja4sentinel.spec:
* Condition %if 0%{?rhel} >= 8 pour compatibilité RHEL
* Description mise à jour avec Rocky Linux
- packaging/test/Dockerfile.rpm: Test sur Rocky Linux 9
- packaging/test/test-*.sh: Tests spécifiques Rocky Linux
- .github/workflows/build-rpm.yml:
* Nom du job: 'Build RPM Package (Rocky Linux)'
* TARGET_DIST: rockylinux:9
* Simplification du build via Docker
Documentation:
- README.md: Instructions d'installation pour .rpm (Rocky/RHEL) et .deb (Debian/Ubuntu)
- Remplacement des instructions de build par installation via packages
Compatibilité:
- Rocky Linux 8.x et 9.x
- RHEL 8.x et 9.x
- CentOS Stream 8 et 9
- AlmaLinux 8.x et 9.x
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
44
.github/workflows/build-rpm.yml
vendored
44
.github/workflows/build-rpm.yml
vendored
@ -39,10 +39,11 @@ on:
|
|||||||
env:
|
env:
|
||||||
GO_VERSION: '1.24'
|
GO_VERSION: '1.24'
|
||||||
PACKAGE_NAME: ja4sentinel
|
PACKAGE_NAME: ja4sentinel
|
||||||
|
TARGET_DIST: rockylinux:9
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-rpm:
|
build-rpm:
|
||||||
name: Build RPM Package
|
name: Build RPM Package (Rocky Linux)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@ -73,44 +74,36 @@ jobs:
|
|||||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
echo "Building version: ${VERSION}"
|
echo "Building version: ${VERSION}"
|
||||||
|
|
||||||
- name: Set up RPM build environment
|
- name: Build RPM in Docker
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
docker build --no-cache \
|
||||||
sudo apt-get install -y \
|
-t ${PACKAGE_NAME}-packager-rpm \
|
||||||
rpm \
|
--build-arg VERSION="${{ steps.version.outputs.version }}" \
|
||||||
rpmbuild \
|
--build-arg ARCH=x86_64 \
|
||||||
libpcap-dev \
|
-f packaging/Dockerfile.rpm .
|
||||||
libpcap0.8-dev
|
|
||||||
|
# Extract RPM from image
|
||||||
- name: Build Go binary
|
mkdir -p build/rpm
|
||||||
run: |
|
docker run --rm ${PACKAGE_NAME}-packager-rpm sh -c 'cat /packages/*.rpm' > build/${PACKAGE_NAME}.rpm
|
||||||
make build-linux
|
|
||||||
ls -la dist/
|
|
||||||
|
|
||||||
- name: Build RPM package
|
|
||||||
run: |
|
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
|
||||||
./packaging/build-rpm.sh "${VERSION}" "x86_64"
|
|
||||||
|
|
||||||
- name: List build artifacts
|
- name: List build artifacts
|
||||||
run: |
|
run: |
|
||||||
echo "=== Build Artifacts ==="
|
echo "=== Build Artifacts ==="
|
||||||
ls -lah build/rpm/
|
ls -lah build/rpm/
|
||||||
echo "=== Checksums ==="
|
sha256sum build/${PACKAGE_NAME}.rpm
|
||||||
cat build/rpm/*.sha256 || true
|
|
||||||
|
|
||||||
- name: Upload RPM artifact
|
- name: Upload RPM artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ja4sentinel-rpm-x86_64
|
name: ${PACKAGE_NAME}-rpm-x86_64
|
||||||
path: build/rpm/*.rpm
|
path: build/*.rpm
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
- name: Upload checksum artifact
|
- name: Upload checksum artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ja4sentinel-rpm-checksums
|
name: ${PACKAGE_NAME}-rpm-checksums
|
||||||
path: build/rpm/*.sha256
|
path: build/*.rpm.sha256
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
- name: Create release and upload assets (on tag)
|
- name: Create release and upload assets (on tag)
|
||||||
@ -118,8 +111,7 @@ jobs:
|
|||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
build/rpm/*.rpm
|
build/*.rpm
|
||||||
build/rpm/*.sha256
|
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
make_latest: true
|
make_latest: true
|
||||||
env:
|
env:
|
||||||
|
|||||||
32
README.md
32
README.md
@ -42,20 +42,38 @@ Outil Go pour capturer le trafic réseau sur un serveur Linux, extraire les hand
|
|||||||
- libpcap-dev (pour la capture réseau)
|
- libpcap-dev (pour la capture réseau)
|
||||||
- Docker (pour les tests et le déploiement)
|
- Docker (pour les tests et le déploiement)
|
||||||
|
|
||||||
### Build local
|
### Packages système
|
||||||
|
|
||||||
|
#### Rocky Linux / RHEL (.rpm)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make build
|
# Télécharger le package
|
||||||
|
wget https://github.com/your-repo/ja4sentinel/releases/latest/download/ja4sentinel.rpm
|
||||||
|
|
||||||
|
# Installer
|
||||||
|
sudo dnf install ./ja4sentinel.rpm
|
||||||
|
|
||||||
|
# Activer le service
|
||||||
|
sudo systemctl enable ja4sentinel
|
||||||
|
sudo systemctl start ja4sentinel
|
||||||
|
|
||||||
|
# Vérifier le statut
|
||||||
|
sudo systemctl status ja4sentinel
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build Docker
|
#### Debian / Ubuntu (.deb)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Image de développement
|
# Télécharger le package
|
||||||
make docker-build-dev
|
wget https://github.com/your-repo/ja4sentinel/releases/latest/download/ja4sentinel.deb
|
||||||
|
|
||||||
# Image runtime (production)
|
# Installer
|
||||||
make docker-build-runtime
|
sudo dpkg -i ja4sentinel.deb
|
||||||
|
sudo apt-get install -f # Installer les dépendances
|
||||||
|
|
||||||
|
# Activer le service
|
||||||
|
sudo systemctl enable ja4sentinel
|
||||||
|
sudo systemctl start ja4sentinel
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# Dockerfile for building RPM packages
|
# Dockerfile for building RPM packages for Rocky Linux
|
||||||
# Use Go 1.24 as base to ensure correct Go version
|
# Use Go 1.24 as base to ensure correct Go version
|
||||||
FROM golang:1.24-bookworm AS builder
|
FROM golang:1.24-bookworm AS builder
|
||||||
|
|
||||||
@ -21,10 +21,10 @@ RUN mkdir -p dist && \
|
|||||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
|
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
|
||||||
go build -buildvcs=false -o dist/ja4sentinel-linux-amd64 ./cmd/ja4sentinel
|
go build -buildvcs=false -o dist/ja4sentinel-linux-amd64 ./cmd/ja4sentinel
|
||||||
|
|
||||||
# Build RPM
|
# Build RPM for Rocky Linux (RHEL compatible)
|
||||||
ARG ARCH=x86_64
|
ARG ARCH=x86_64
|
||||||
RUN mkdir -p /app/packages && \
|
RUN mkdir -p /app/packages && \
|
||||||
./packaging/build-rpm.sh "${VERSION}" "${ARCH}" && \
|
./packaging/build-rpm.sh "${VERSION}" "${ARCH}" "rocky" && \
|
||||||
cp /app/build/rpm/*.rpm /app/packages/
|
cp /app/build/rpm/*.rpm /app/packages/
|
||||||
|
|
||||||
# Final stage - minimal image with just the RPM
|
# Final stage - minimal image with just the RPM
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Build script for .rpm package
|
# Build script for .rpm package
|
||||||
# Usage: ./build-rpm.sh [version] [architecture]
|
# Usage: ./build-rpm.sh [version] [architecture] [distribution]
|
||||||
|
# distribution: rocky, rhel, centos (default: rocky)
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Sanitize version for RPM package (must start with digit)
|
# Sanitize version for RPM package (must start with digit)
|
||||||
VERSION="${1:-1.0.0}"
|
VERSION="${1:-1.0.0}"
|
||||||
ARCH="${2:-x86_64}"
|
ARCH="${2:-x86_64}"
|
||||||
|
DIST="${3:-rocky}"
|
||||||
PACKAGE_NAME="ja4sentinel"
|
PACKAGE_NAME="ja4sentinel"
|
||||||
|
|
||||||
# Convert git version to RPM-compatible format
|
# Convert git version to RPM-compatible format
|
||||||
@ -18,7 +20,7 @@ else
|
|||||||
RPM_VERSION="0.0.0.${VERSION//[^a-zA-Z0-9.]/_}"
|
RPM_VERSION="0.0.0.${VERSION//[^a-zA-Z0-9.]/_}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Building ${PACKAGE_NAME} ${RPM_VERSION} for ${ARCH} ==="
|
echo "=== Building ${PACKAGE_NAME} ${RPM_VERSION} for ${DIST} (${ARCH}) ==="
|
||||||
|
|
||||||
# Directories
|
# Directories
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|||||||
@ -6,9 +6,12 @@ License: MIT
|
|||||||
URL: https://github.com/your-repo/ja4sentinel
|
URL: https://github.com/your-repo/ja4sentinel
|
||||||
BuildArch: x86_64
|
BuildArch: x86_64
|
||||||
|
|
||||||
# Runtime dependencies
|
# Rocky Linux / RHEL compatibility
|
||||||
|
# Requires EPEL for some dependencies if not in base repos
|
||||||
|
%if 0%{?rhel} >= 8
|
||||||
Requires: systemd
|
Requires: systemd
|
||||||
Requires: libpcap
|
Requires: libpcap
|
||||||
|
%endif
|
||||||
|
|
||||||
%description
|
%description
|
||||||
JA4Sentinel is a Go-based tool for capturing network traffic on Linux servers,
|
JA4Sentinel is a Go-based tool for capturing network traffic on Linux servers,
|
||||||
@ -22,6 +25,7 @@ Features:
|
|||||||
- IP/TCP metadata enrichment
|
- IP/TCP metadata enrichment
|
||||||
- Multiple output formats (stdout, file, UNIX socket)
|
- Multiple output formats (stdout, file, UNIX socket)
|
||||||
- Structured JSON logging for systemd/journald
|
- Structured JSON logging for systemd/journald
|
||||||
|
- Compatible with Rocky Linux, RHEL, CentOS
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
# No source to unpack, binary is pre-built
|
# No source to unpack, binary is pre-built
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# Dockerfile for testing RPM package installation
|
# Dockerfile for testing RPM package installation on Rocky Linux
|
||||||
FROM fedora:39
|
FROM rockylinux:9
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies (libpcap is in base repo on Rocky 9)
|
||||||
RUN dnf install -y \
|
RUN dnf install -y \
|
||||||
libpcap \
|
libpcap \
|
||||||
systemd \
|
systemd \
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test script for RPM package installation
|
# Test script for RPM package installation on Rocky Linux
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "=========================================="
|
echo "=========================================="
|
||||||
echo " JA4Sentinel RPM Package Installation Test"
|
echo " JA4Sentinel RPM Package Installation Test"
|
||||||
|
echo " Target: Rocky Linux 9"
|
||||||
echo "=========================================="
|
echo "=========================================="
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test RPM package installation in Docker container
|
# Test RPM package installation in Rocky Linux container
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|||||||
Reference in New Issue
Block a user