Pushed by: admin
License: 1CFBBDCA-31F (Starter)
Timestamp: 2026-02-01T00:44:27.685172
masterdev
Splunk Git Pusher 3 months ago
parent fcca288542
commit 1cb542666a

@ -0,0 +1,532 @@
# 🚀 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>

@ -1 +1 @@
{"pushes_today": 1, "pushes_total": 10, "last_push_date": "2026-02-01", "apps_pushed": []}
{"pushes_today": 2, "pushes_total": 11, "last_push_date": "2026-02-01", "apps_pushed": []}
Loading…
Cancel
Save