You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
533 lines
13 KiB
533 lines
13 KiB
# đ Git Pusher for Splunk
|
|
|
|
**Version 2.0** | Application Splunk pour déployer vos applications vers Git
|
|
|
|
---
|
|
|
|
## đ Table des matiĂšres
|
|
|
|
- [Présentation](#-présentation)
|
|
- [Fonctionnalités](#-fonctionnalités)
|
|
- [Architecture](#-architecture)
|
|
- [Installation](#-installation)
|
|
- [Configuration](#-configuration)
|
|
- [SystĂšme de Licence](#-systĂšme-de-licence)
|
|
- [Utilisation](#-utilisation)
|
|
- [Sécurité](#-sécurité)
|
|
- [Dépannage](#-dépannage)
|
|
- [API Reference](#-api-reference)
|
|
- [Changelog](#-changelog)
|
|
- [Support](#-support)
|
|
|
|
---
|
|
|
|
## đŻ PrĂ©sentation
|
|
|
|
**Git Pusher** est une application Splunk Enterprise qui permet de versionner et déployer vos applications Splunk vers un repository Git en quelques clics.
|
|
|
|
Idéal pour :
|
|
- đŠ Sauvegarder vos configurations Splunk
|
|
- đ Versionner vos dashboards et applications
|
|
- đ„ Collaborer en Ă©quipe sur les dĂ©veloppements Splunk
|
|
- đ Mettre en place un workflow CI/CD pour Splunk
|
|
|
|
---
|
|
|
|
## ⚠Fonctionnalités
|
|
|
|
| Fonctionnalité | Description |
|
|
|----------------|-------------|
|
|
| **Push vers Git** | Déployez une ou plusieurs applications Splunk vers votre repository Git |
|
|
| **Interface moderne** | Dashboard intuitif avec sélection visuelle des applications |
|
|
| **Multi-repository** | Support de GitHub, GitLab, Gitea, Bitbucket et tout serveur Git |
|
|
| **SystÚme de licence** | Gestion par fichier `.lic` sécurisé |
|
|
| **Credentials sécurisés** | Chiffrement des mots de passe Splunk |
|
|
| **Logs détaillés** | Traçabilité complÚte des opérations |
|
|
|
|
---
|
|
|
|
## đ Architecture
|
|
|
|
```
|
|
pusher_app_prem/
|
|
âââ bin/
|
|
â âââ git_pusher.py # Serveur HTTP principal (port 9999)
|
|
â âââ license_validator.py # Validation des licences
|
|
â âââ license_generator.py # GĂ©nĂ©ration des licences (vendeur)
|
|
â âââ credentials_manager.py # Gestion sĂ©curisĂ©e des credentials
|
|
â âââ start_git_pusher.sh # Script de dĂ©marrage
|
|
âââ appserver/static/
|
|
â âââ git_pusher.js # Logique JavaScript principale
|
|
â âââ license_validation.js # Interface de gestion des licences
|
|
âââ default/data/ui/views/
|
|
â âââ git_pusher_-_deploy_applications.xml # Dashboard principal
|
|
âââ local/
|
|
â âââ license.lic # Fichier de licence (aprĂšs activation)
|
|
â âââ .credentials # Credentials chiffrĂ©s
|
|
â âââ .key # ClĂ© de chiffrement
|
|
âââ README.md
|
|
```
|
|
|
|
### Flux de données
|
|
|
|
```
|
|
âââââââââââââââ ââââââââââââââââ âââââââââââââââ
|
|
â Splunk ââââââ¶â Git Pusher ââââââ¶â Git Repo â
|
|
â Dashboard â â Server:9999 â â (Remote) â
|
|
âââââââââââââââ ââââââââââââââââ âââââââââââââââ
|
|
â
|
|
ââââââââŽâââââââ
|
|
â /opt/splunk/etc/apps/ â
|
|
â (Applications locales) â
|
|
âââââââââââââââââââââââââââ
|
|
```
|
|
|
|
---
|
|
|
|
## đ„ Installation
|
|
|
|
### Prérequis
|
|
|
|
- Splunk Enterprise 8.x ou supérieur
|
|
- Python 3.7+
|
|
- Git installé sur le serveur (`yum install git` ou `apt install git`)
|
|
- AccÚs réseau vers votre repository Git
|
|
|
|
### Ătapes d'installation
|
|
|
|
#### 1. Extraire l'application
|
|
|
|
```bash
|
|
# Copier l'application dans Splunk
|
|
cp -r pusher_app_prem /opt/splunk/etc/apps/
|
|
|
|
# Définir les permissions
|
|
chown -R splunk:splunk /opt/splunk/etc/apps/pusher_app_prem
|
|
chmod +x /opt/splunk/etc/apps/pusher_app_prem/bin/*.sh
|
|
```
|
|
|
|
#### 2. Configurer les credentials Splunk
|
|
|
|
```bash
|
|
cd /opt/splunk/etc/apps/pusher_app_prem/bin/
|
|
./start_git_pusher.sh credentials setup
|
|
```
|
|
|
|
```
|
|
==================================================
|
|
Git Pusher - Credentials Setup
|
|
==================================================
|
|
|
|
Splunk Username [admin]: admin
|
|
Splunk Password: ********
|
|
Confirm Password: ********
|
|
|
|
â Credentials saved securely!
|
|
```
|
|
|
|
#### 3. Démarrer le serveur Git Pusher
|
|
|
|
```bash
|
|
./start_git_pusher.sh start
|
|
```
|
|
|
|
#### 4. Ouvrir le firewall (si nécessaire)
|
|
|
|
```bash
|
|
# FirewallD
|
|
sudo firewall-cmd --add-port=9999/tcp --permanent
|
|
sudo firewall-cmd --reload
|
|
|
|
# UFW
|
|
sudo ufw allow 9999/tcp
|
|
```
|
|
|
|
#### 5. Redémarrer Splunk
|
|
|
|
```bash
|
|
/opt/splunk/bin/splunk restart
|
|
```
|
|
|
|
#### 6. Accéder au dashboard
|
|
|
|
Ouvrez votre navigateur et allez sur :
|
|
```
|
|
http://VOTRE_IP_SPLUNK:8000/app/pusher_app_prem/git_pusher_-_deploy_applications
|
|
```
|
|
|
|
---
|
|
|
|
## âïž Configuration
|
|
|
|
### Commandes du script de gestion
|
|
|
|
```bash
|
|
# Démarrer le serveur
|
|
./start_git_pusher.sh start
|
|
|
|
# ArrĂȘter le serveur
|
|
./start_git_pusher.sh stop
|
|
|
|
# Redémarrer le serveur
|
|
./start_git_pusher.sh restart
|
|
|
|
# Voir le statut
|
|
./start_git_pusher.sh status
|
|
|
|
# Voir les logs
|
|
./start_git_pusher.sh logs
|
|
./start_git_pusher.sh logs -f # Mode follow
|
|
|
|
# Gestion des credentials
|
|
./start_git_pusher.sh credentials setup
|
|
./start_git_pusher.sh credentials status
|
|
./start_git_pusher.sh credentials delete
|
|
```
|
|
|
|
### Variables d'environnement (optionnel)
|
|
|
|
Si vous préférez ne pas utiliser le credentials manager :
|
|
|
|
```bash
|
|
export SPLUNK_USERNAME=admin
|
|
export SPLUNK_PASSWORD=your_password
|
|
export SPLUNK_HOME=/opt/splunk
|
|
```
|
|
|
|
### Fichiers de configuration
|
|
|
|
| Fichier | Description |
|
|
|---------|-------------|
|
|
| `local/license.lic` | Fichier de licence |
|
|
| `local/.credentials` | Credentials Splunk chiffrés |
|
|
| `local/.key` | Clé de chiffrement (générée automatiquement) |
|
|
|
|
---
|
|
|
|
## đ SystĂšme de Licence
|
|
|
|
Git Pusher utilise un systÚme de licence par fichier `.lic` pour activer les fonctionnalités.
|
|
|
|
### Types de licences
|
|
|
|
| Type | Durée | Apps max | Pushes/jour | Fonctionnalités |
|
|
|------|-------|----------|-------------|-----------------|
|
|
| **Trial** | 14 jours | 3 | 5 | Push basique |
|
|
| **Starter** | 1 an | 10 | 50 | + Push programmé |
|
|
| **Professional** | 1 an | Illimité | Illimité | + Multi-repo, Support prioritaire |
|
|
| **Enterprise** | 1 an | Illimité | Illimité | + Branding personnalisé, API |
|
|
|
|
### Obtenir une licence
|
|
|
|
1. **Récupérer votre hostname Splunk**
|
|
- Visible dans le dashboard Git Pusher lors de l'activation
|
|
- Ou via la commande : `hostname`
|
|
|
|
2. **Contacter le support** avec :
|
|
- Votre hostname Splunk
|
|
- Votre email
|
|
- Le type de licence souhaité
|
|
|
|
3. **Recevoir votre fichier `.lic`**
|
|
|
|
4. **Activer la licence**
|
|
- Ouvrir le dashboard Git Pusher
|
|
- Glisser-déposer le fichier `.lic`
|
|
- Cliquer sur "Activer"
|
|
|
|
### Structure du fichier de licence
|
|
|
|
```
|
|
# =============================================
|
|
# Git Pusher License File
|
|
# =============================================
|
|
# Customer: Acme Corp
|
|
# Email: admin@acme.com
|
|
# Type: Professional
|
|
# Hostname: splunk-prod-01
|
|
# Expires: 2026-01-30
|
|
# License ID: A1B2C3D4E5F6
|
|
# =============================================
|
|
# DO NOT MODIFY THIS FILE
|
|
# =============================================
|
|
|
|
eyJsaWNlbnNlIjogey4uLn0sICJzaWduYXR1cmUiOiAiLi4uIn0=
|
|
|
|
# =============================================
|
|
# END OF LICENSE
|
|
# =============================================
|
|
```
|
|
|
|
### Génération de licences (Vendeur uniquement)
|
|
|
|
```bash
|
|
# Mode interactif
|
|
python3 license_generator.py
|
|
|
|
# Mode rapide
|
|
python3 license_generator.py quick "Client Name" "email@client.com" "hostname" "professional"
|
|
|
|
# Valider une licence
|
|
python3 license_generator.py validate
|
|
```
|
|
|
|
---
|
|
|
|
## đ Utilisation
|
|
|
|
### Pousser des applications vers Git
|
|
|
|
1. **Ouvrir le dashboard** Git Pusher
|
|
|
|
2. **Configurer Git**
|
|
- **Repository URL** : `https://github.com/user/repo.git` ou `https://gitlab.com/user/repo.git`
|
|
- **Branch** : `main`, `master`, ou votre branche
|
|
- **Token** : Personal Access Token avec droits `write`
|
|
|
|
3. **Sélectionner les applications**
|
|
- Cocher les applications à déployer
|
|
- Utiliser "Select All" pour tout sélectionner
|
|
|
|
4. **Ăcrire le message de commit**
|
|
- Décrivez les changements effectués
|
|
|
|
5. **Cliquer sur "Deploy to Git"**
|
|
|
|
### Obtenir un token Git
|
|
|
|
#### GitHub
|
|
1. Settings â Developer settings â Personal access tokens â Tokens (classic)
|
|
2. Generate new token
|
|
3. Cocher : `repo` (Full control)
|
|
|
|
#### GitLab
|
|
1. Preferences â Access Tokens
|
|
2. Create personal access token
|
|
3. Scopes : `write_repository`
|
|
|
|
#### Gitea
|
|
1. Settings â Applications â Generate New Token
|
|
2. Permissions : `repository: write`
|
|
|
|
---
|
|
|
|
## đ SĂ©curitĂ©
|
|
|
|
### Credentials Splunk
|
|
|
|
Les credentials Splunk sont :
|
|
- **Chiffrés** avec une clé dérivée de l'ID machine
|
|
- **Stockés** dans un fichier avec permissions `600`
|
|
- **Jamais visibles** en clair dans les logs ou scripts
|
|
|
|
```bash
|
|
# Les credentials sont stockés ici (chiffrés)
|
|
/opt/splunk/etc/apps/pusher_app_prem/local/.credentials
|
|
|
|
# La clé de chiffrement (unique par machine)
|
|
/opt/splunk/etc/apps/pusher_app_prem/local/.key
|
|
```
|
|
|
|
### Token Git
|
|
|
|
- Le token Git n'est **jamais stocké** sur le serveur
|
|
- Il est transmis uniquement lors de l'opération de push
|
|
- Option "Save credentials" stocke en localStorage du navigateur (encodé)
|
|
|
|
### Licence
|
|
|
|
- Signature HMAC-SHA256 anti-falsification
|
|
- Binding au hostname Splunk
|
|
- Vérification de l'expiration
|
|
|
|
### Recommandations
|
|
|
|
1. â
Utiliser des tokens Git avec permissions minimales
|
|
2. â
Renouveler les tokens réguliÚrement
|
|
3. â
Utiliser HTTPS pour les repositories Git
|
|
4. â
Restreindre l'accĂšs au dashboard aux administrateurs
|
|
|
|
---
|
|
|
|
## đ§ DĂ©pannage
|
|
|
|
### Le serveur ne démarre pas
|
|
|
|
```bash
|
|
# Vérifier les logs
|
|
tail -f /opt/splunk/var/log/splunk/git_pusher.log
|
|
|
|
# Vérifier si le port est utilisé
|
|
ss -tlnp | grep 9999
|
|
|
|
# Vérifier les permissions
|
|
ls -la /opt/splunk/etc/apps/pusher_app_prem/bin/
|
|
```
|
|
|
|
### Erreur "Connexion refusée"
|
|
|
|
```bash
|
|
# Vérifier que le serveur tourne
|
|
ps aux | grep git_pusher
|
|
|
|
# Vérifier le firewall
|
|
sudo firewall-cmd --list-ports
|
|
|
|
# Ouvrir le port
|
|
sudo firewall-cmd --add-port=9999/tcp --permanent
|
|
sudo firewall-cmd --reload
|
|
```
|
|
|
|
### Erreur CORS
|
|
|
|
Les fichiers JavaScript doivent utiliser l'adresse IP du serveur, pas `127.0.0.1`.
|
|
|
|
Vérifier :
|
|
```bash
|
|
head -10 /opt/splunk/etc/apps/pusher_app_prem/appserver/static/license_validation.js
|
|
```
|
|
|
|
Doit contenir :
|
|
```javascript
|
|
const LICENSE_API_URL = window.location.protocol + '//' + window.location.hostname + ':9999';
|
|
```
|
|
|
|
### Les applications ne sont pas poussées
|
|
|
|
```bash
|
|
# Vérifier les logs
|
|
tail -50 /opt/splunk/var/log/splunk/git_pusher.log
|
|
|
|
# Tester manuellement
|
|
curl -X POST "http://localhost:9999/health"
|
|
```
|
|
|
|
### Erreur de licence
|
|
|
|
```bash
|
|
# Vérifier le hostname
|
|
hostname
|
|
|
|
# Vérifier la licence
|
|
python3 /opt/splunk/etc/apps/pusher_app_prem/bin/license_validator.py status
|
|
```
|
|
|
|
### Vider le cache Splunk
|
|
|
|
```bash
|
|
rm -rf /opt/splunk/var/run/splunk/appserver/*
|
|
/opt/splunk/bin/splunk restart
|
|
```
|
|
|
|
---
|
|
|
|
## đĄ API Reference
|
|
|
|
### Endpoints
|
|
|
|
| Méthode | Endpoint | Description |
|
|
|---------|----------|-------------|
|
|
| `GET` | `/health` | Health check |
|
|
| `GET` | `/license` | Statut de la licence |
|
|
| `GET` | `/license/hostname` | Hostname Splunk |
|
|
| `POST` | `/license/upload` | Uploader une licence |
|
|
| `POST` | `/push` | Pousser les applications |
|
|
|
|
### Exemple : Health Check
|
|
|
|
```bash
|
|
curl http://localhost:9999/health
|
|
```
|
|
|
|
```json
|
|
{
|
|
"status": "ok",
|
|
"service": "git_pusher",
|
|
"timestamp": "2026-01-31T12:00:00.000000"
|
|
}
|
|
```
|
|
|
|
### Exemple : Statut de licence
|
|
|
|
```bash
|
|
curl http://localhost:9999/license
|
|
```
|
|
|
|
```json
|
|
{
|
|
"status": "valid",
|
|
"hostname": "splunk-server",
|
|
"license": {
|
|
"license_id": "A1B2C3D4E5F6",
|
|
"type": "professional",
|
|
"type_name": "Professional",
|
|
"expires": "2027-01-30",
|
|
"days_remaining": 365
|
|
}
|
|
}
|
|
```
|
|
|
|
### Exemple : Push
|
|
|
|
```bash
|
|
curl -X POST "http://localhost:9999/push?git_url=https://github.com/user/repo.git&git_branch=main&git_token=TOKEN&commit_message=Update&apps=[{\"id\":\"my_app\"}]&user=admin"
|
|
```
|
|
|
|
```json
|
|
{
|
|
"status": "success",
|
|
"message": "Successfully pushed 1 application(s) to Git",
|
|
"apps_pushed": 1,
|
|
"license_type": "Professional"
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## đ Changelog
|
|
|
|
### Version 2.0.0 (Janvier 2026)
|
|
- âš Nouveau systĂšme de licence par fichier `.lic`
|
|
- đ Credentials Splunk chiffrĂ©s
|
|
- đš Interface utilisateur modernisĂ©e
|
|
- đ Badge de licence en temps rĂ©el
|
|
- đ§ Script de gestion amĂ©liorĂ©
|
|
- đ Logs dĂ©taillĂ©s
|
|
|
|
### Version 1.0.0
|
|
- đ Version initiale
|
|
- Push d'applications vers Git
|
|
- Interface basique
|
|
|
|
---
|
|
|
|
## đ Support
|
|
|
|
### Obtenir de l'aide
|
|
|
|
- đ§ Email : support@gitpusher.com
|
|
- đ Site web : https://gitpusher.com
|
|
- đ Documentation : https://docs.gitpusher.com
|
|
|
|
### Signaler un bug
|
|
|
|
Incluez dans votre rapport :
|
|
1. Version de Git Pusher
|
|
2. Version de Splunk
|
|
3. Logs (`/opt/splunk/var/log/splunk/git_pusher.log`)
|
|
4. Ătapes pour reproduire le problĂšme
|
|
|
|
---
|
|
|
|
## đ Licence
|
|
|
|
Git Pusher est un logiciel propriétaire. Une licence valide est requise pour son utilisation.
|
|
|
|
© 2026 Git Pusher - Tous droits réservés
|
|
|
|
---
|
|
|
|
<p align="center">
|
|
Made with â€ïž for Splunk administrators
|
|
</p>
|