22 KiB
🚀 Git Pusher for Splunk
Version 2.1 | Application Splunk pour déployer vos applications vers Git et le Search Head Cluster
📋 Table des matières
- Présentation
- Fonctionnalités
- Architecture
- Installation - Serveur Source
- Installation - SH Deployer Agent
- Configuration
- Configuration HTTPS
- Système de Licence
- Utilisation
- Sécurité
- Personnalisation du Dashboard
- Dépannage
- API Reference
- Changelog
- Support
🎯 Présentation
Git Pusher est une application Splunk Enterprise qui permet de :
- Versionner vos applications Splunk dans un repository Git
- Déployer automatiquement vers un Search Head Cluster via le SH Deployer
Le workflow complet en un clic :
Splunk Source → Push Git → Pull SH Deployer → Apply Bundle → Search Head Cluster
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
- 🎯 Déployer automatiquement vers votre Search Head Cluster
✨ Fonctionnalités
| Fonctionnalité | Description |
|---|---|
| Push vers Git | Déployez une ou plusieurs applications Splunk vers votre repository Git |
| Déploiement SH Cluster | Déploiement automatique vers le Search Head Cluster après le push Git |
| Interface moderne | Dashboard intuitif avec sélection visuelle des applications |
| Multi-repository | Support de GitHub, GitLab, Gitea, Bitbucket et tout serveur Git |
| Support HTTPS | Communication sécurisée avec certificats SSL |
| 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
┌─────────────────────────────────────────────────────────────────┐
│ SERVEUR SOURCE │
│ ┌─────────────┐ ┌─────────────────────────────────────┐ │
│ │ Splunk │────▶│ Git Pusher Server (:9999) │ │
│ │ Dashboard │ │ 1. Push apps vers Git │ │
│ │ (HTTPS) │ │ 2. Appelle le SH Deployer Agent │ │
│ └─────────────┘ └──────────────────┬──────────────────┘ │
└─────────────────────────────────────────┼───────────────────────┘
│ HTTPS (:9998)
▼
┌─────────────────────────────────────────────────────────────────┐
│ SH DEPLOYER │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Deployer Agent (:9998) │ │
│ │ 1. Git pull dans /opt/splunk/etc/shcluster/apps/ │ │
│ │ 2. Exécute: splunk apply shcluster-bundle │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ SEARCH HEAD CLUSTER │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ SH1 │ │ SH2 │ │ SH3 │ │
│ └───────────┘ └───────────┘ └───────────┘ │
└─────────────────────────────────────────────────────────────────┘
Structure des fichiers
SERVEUR SOURCE - pusher_app_prem/
├── bin/
│ ├── git_pusher.py # Serveur HTTP/HTTPS 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
│ └── certs/ # Certificats SSL
│ ├── server.crt
│ └── server.key
└── README.md
SH DEPLOYER - deployer_agent/
├── bin/
│ ├── deployer_agent.py # Agent de déploiement (port 9998)
│ └── start_deployer_agent.sh # Script de démarrage
└── local/
└── certs/ # Certificats SSL
├── server.crt
└── server.key
📥 Installation - Serveur Source
Prérequis
- Splunk Enterprise 8.x ou supérieur
- Python 3.7+
- Git installé sur le serveur (
yum install gitouapt install git) - OpenSSL (pour la génération des certificats HTTPS)
- Accès réseau vers votre repository Git
Étapes d'installation
1. Extraire l'application
# 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
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. Configurer HTTPS (si Splunk est en HTTPS)
# Créer le dossier des certificats
mkdir -p /opt/splunk/etc/apps/pusher_app_prem/local/certs
# Générer un certificat auto-signé (valide 365 jours)
openssl req -x509 -newkey rsa:4096 \
-keyout /opt/splunk/etc/apps/pusher_app_prem/local/certs/server.key \
-out /opt/splunk/etc/apps/pusher_app_prem/local/certs/server.crt \
-days 365 -nodes -subj "/CN=git-pusher"
# Définir les permissions
chmod 600 /opt/splunk/etc/apps/pusher_app_prem/local/certs/server.key
chown -R splunk:splunk /opt/splunk/etc/apps/pusher_app_prem/local/certs/
4. Démarrer le serveur Git Pusher
./start_git_pusher.sh start
5. Ouvrir le firewall (si nécessaire)
# FirewallD
sudo firewall-cmd --add-port=9999/tcp --permanent
sudo firewall-cmd --reload
# UFW
sudo ufw allow 9999/tcp
6. Redémarrer Splunk
/opt/splunk/bin/splunk restart
7. Accepter le certificat dans le navigateur
- Ouvrir :
https://VOTRE_IP_SPLUNK:9999/health - Accepter le certificat auto-signé
- Rafraîchir le dashboard (Ctrl+Shift+R)
📥 Installation - SH Deployer Agent
Sur le serveur SH Deployer
1. Créer l'application
# Créer les dossiers
mkdir -p /opt/splunk/etc/apps/deployer_agent/bin
mkdir -p /opt/splunk/etc/apps/deployer_agent/local/certs
# Copier les fichiers
cp deployer_agent.py /opt/splunk/etc/apps/deployer_agent/bin/
cp start_deployer_agent.sh /opt/splunk/etc/apps/deployer_agent/bin/
# Rendre exécutable
chmod +x /opt/splunk/etc/apps/deployer_agent/bin/start_deployer_agent.sh
2. Configurer le token d'authentification
nano /opt/splunk/etc/apps/deployer_agent/bin/deployer_agent.py
Modifier la ligne AUTH_TOKEN :
AUTH_TOKEN = "votre_token_secret_personnalise"
3. Configurer le Search Head Captain
Dans le même fichier, trouver la fonction apply_shcluster_bundle et modifier l'IP du captain :
target_uri = "https://IP_DU_CAPTAIN:8089"
4. Générer les certificats SSL
cd /opt/splunk/etc/apps/deployer_agent/bin/
./start_deployer_agent.sh gencerts
5. Définir les permissions
chown -R splunk:splunk /opt/splunk/etc/apps/deployer_agent
6. Ouvrir le firewall
sudo firewall-cmd --add-port=9998/tcp --permanent
sudo firewall-cmd --reload
7. Démarrer l'agent
./start_deployer_agent.sh start
8. Vérifier le statut
./start_deployer_agent.sh status
9. Accepter le certificat
Ouvrir dans un navigateur : https://IP_SH_DEPLOYER:9998/health
Accepter le certificat auto-signé.
⚙️ Configuration
Commandes Git Pusher (Serveur Source)
cd /opt/splunk/etc/apps/pusher_app_prem/bin/
# 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
Commandes Deployer Agent (SH Deployer)
cd /opt/splunk/etc/apps/deployer_agent/bin/
# Démarrer l'agent
./start_deployer_agent.sh start
# Arrêter l'agent
./start_deployer_agent.sh stop
# Redémarrer l'agent
./start_deployer_agent.sh restart
# Voir le statut
./start_deployer_agent.sh status
# Voir les logs
./start_deployer_agent.sh logs
./start_deployer_agent.sh logs -f
# Générer les certificats SSL
./start_deployer_agent.sh gencerts
# Tester la connexion
./start_deployer_agent.sh test
Configuration du SH Deployer dans l'interface
- Ouvrir le dashboard Git Pusher
- Cliquer sur ⚙️ Configure dans la section "Deploy to Search Head Cluster"
- Remplir :
- Host : IP du SH Deployer (ex: 10.10.40.14)
- Port : 9998
- Token : Le même token que dans
deployer_agent.py
- Cliquer sur Save & Test
🔒 Configuration HTTPS
Git Pusher Server (Port 9999)
mkdir -p /opt/splunk/etc/apps/pusher_app_prem/local/certs
openssl req -x509 -newkey rsa:4096 \
-keyout /opt/splunk/etc/apps/pusher_app_prem/local/certs/server.key \
-out /opt/splunk/etc/apps/pusher_app_prem/local/certs/server.crt \
-days 365 -nodes -subj "/CN=git-pusher"
chmod 600 /opt/splunk/etc/apps/pusher_app_prem/local/certs/server.key
chown -R splunk:splunk /opt/splunk/etc/apps/pusher_app_prem/local/certs/
Deployer Agent (Port 9998)
mkdir -p /opt/splunk/etc/apps/deployer_agent/local/certs
openssl req -x509 -newkey rsa:4096 \
-keyout /opt/splunk/etc/apps/deployer_agent/local/certs/server.key \
-out /opt/splunk/etc/apps/deployer_agent/local/certs/server.crt \
-days 365 -nodes -subj "/CN=deployer-agent"
chmod 600 /opt/splunk/etc/apps/deployer_agent/local/certs/server.key
chown -R splunk:splunk /opt/splunk/etc/apps/deployer_agent/local/certs/
Vérifier HTTPS
# Git Pusher
curl -k https://localhost:9999/health
# Deployer Agent
curl -k https://localhost:9998/health
🔐 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é | + SH Cluster deployment, API |
Activer une licence
- Ouvrir le dashboard Git Pusher
- Glisser-déposer le fichier
.lic - Cliquer sur "Activer"
📖 Utilisation
Workflow complet : Push Git + Déploiement SH Cluster
-
Ouvrir le dashboard Git Pusher
-
Sélectionner les applications à déployer
-
Configurer Git :
- Repository URL :
https://github.com/user/repo.git - Branch :
main - Token : Personal Access Token
- Repository URL :
-
Activer le déploiement SH Cluster :
- Cocher "Enable automatic deployment"
- (Optionnel) Remplir les credentials Splunk si différents de l'admin par défaut
-
Cliquer sur "Deploy to Git"
Le processus automatique :
✅ Push vers Git
✅ Pull sur le SH Deployer
✅ Apply shcluster-bundle
✅ Mise à jour du Search Head Cluster
Obtenir un token Git
GitHub
- Settings → Developer settings → Personal access tokens
- Generate new token
- Cocher :
repo(Full control)
GitLab
- Preferences → Access Tokens
- Create personal access token
- Scopes :
write_repository
Gitea
- Settings → Applications → Generate New Token
- Permissions :
repository: write
🔒 Sécurité
Credentials Splunk
- Chiffrés avec une clé dérivée de l'ID machine
- Stockés dans un fichier avec permissions
600 - Jamais visibles en clair
Communication HTTPS
- SSL/TLS entre tous les composants
- Certificats auto-signés supportés
- Validation du token d'authentification
Token Deployer Agent
- Authentification par token entre Git Pusher et Deployer Agent
- Token configurable dans les deux composants
- Doit être identique des deux côtés
Bonnes pratiques
- ✅ Utiliser HTTPS pour tous les composants
- ✅ Changer le token par défaut du Deployer Agent
- ✅ Utiliser des tokens Git avec permissions minimales
- ✅ Restreindre l'accès réseau au port 9998/9999
- ✅ Renouveler les certificats régulièrement
🎨 Personnalisation du Dashboard
Masquer les boutons d'édition
nano /opt/splunk/etc/apps/pusher_app_prem/default/data/ui/views/git_pusher_-_deploy_applications.xml
Modifier la première ligne :
<dashboard version="1.1" script="license_validation.js, git_pusher.js" hideEdit="true" hideExport="true">
Options disponibles
| Attribut | Description |
|---|---|
hideEdit="true" |
Masque le bouton "Modifier" |
hideExport="true" |
Masque le bouton "Exporter" |
hideTitle="true" |
Masque le titre du dashboard |
hideSplunkBar="true" |
Masque la barre Splunk en haut |
hideAppBar="true" |
Masque la barre de l'application |
hideFooter="true" |
Masque le footer |
Appliquer les changements
rm -rf /opt/splunk/var/run/splunk/appserver/*
/opt/splunk/bin/splunk restart
🔧 Dépannage
Les boutons ne fonctionnent pas
Le fichier JavaScript doit exposer les fonctions globalement. Vérifier que le bloc suivant est présent à la fin de git_pusher.js :
// Exposer les fonctions globalement
window.showDeployerConfigModal = showDeployerConfigModal;
window.closeDeployerConfigModal = closeDeployerConfigModal;
window.saveDeployerConfigFromModal = saveDeployerConfigFromModal;
window.toggleDeployerAuth = toggleDeployerAuth;
// Attacher les événements aux boutons
(function attachButtonEvents() {
function tryAttach() {
var pushBtn = document.getElementById('push-btn');
if (pushBtn) {
pushBtn.addEventListener('click', function(e) {
e.preventDefault();
pushDashboards();
});
}
var buttons = document.querySelectorAll('button.btn');
buttons.forEach(function(btn) {
if (btn.textContent.includes('Reset')) {
btn.addEventListener('click', function(e) {
e.preventDefault();
resetForm(true);
});
}
});
var configBtn = document.querySelector('.deployer-config-btn');
if (configBtn) {
configBtn.addEventListener('click', function(e) {
e.preventDefault();
showDeployerConfigModal();
});
}
if (!pushBtn) setTimeout(tryAttach, 500);
}
if (document.readyState === 'complete') {
setTimeout(tryAttach, 1000);
} else {
window.addEventListener('load', function() {
setTimeout(tryAttach, 1000);
});
}
})();
Puis vider le cache :
rm -rf /opt/splunk/var/run/splunk/appserver/*
/opt/splunk/bin/splunk restart
Et dans le navigateur : Ctrl+Shift+R
Erreur 401 Unauthorized (Deployer)
Le token ne correspond pas entre les deux composants.
- Vérifier le token sur le SH Deployer :
grep "AUTH_TOKEN" /opt/splunk/etc/apps/deployer_agent/bin/deployer_agent.py
-
Configurer le même token dans l'interface (⚙️ Configure)
-
Tester :
curl -k -H "X-Auth-Token: VOTRE_TOKEN" https://IP_DEPLOYER:9998/status
Erreur "tcsetattr: Inappropriate ioctl for device"
La commande splunk apply shcluster-bundle attend une entrée interactive.
Solution : Modifier la fonction apply_shcluster_bundle dans deployer_agent.py pour utiliser echo 'y' | :
shell_cmd = f"echo 'y' | {SPLUNK_BIN} apply shcluster-bundle -target {target_uri} -auth {auth_user}:'{escaped_pass}' -preserve-lookups true"
Erreur CORS
Vider le cache Splunk et navigateur :
rm -rf /opt/splunk/var/run/splunk/appserver/*
/opt/splunk/bin/splunk restart
Puis Ctrl+Shift+R dans le navigateur.
Le SH Deployer ne répond pas
# Vérifier le statut
./start_deployer_agent.sh status
# Voir les logs
tail -50 /opt/splunk/var/log/splunk/deployer_agent.log
# Redémarrer
./start_deployer_agent.sh restart
Le bundle ne s'applique pas
- Vérifier que le pull a fonctionné :
ls -la /opt/splunk/etc/shcluster/apps/
- Vérifier les logs :
grep -i "bundle\|error" /opt/splunk/var/log/splunk/deployer_agent.log | tail -30
- Tester manuellement :
echo 'y' | /opt/splunk/bin/splunk apply shcluster-bundle -target https://CAPTAIN_IP:8089 -auth admin:'password' -preserve-lookups true
Vider le cache Splunk
rm -rf /opt/splunk/var/run/splunk/appserver/*
/opt/splunk/bin/splunk restart
📡 API Reference
Git Pusher Server (Port 9999)
| Méthode | Endpoint | Description |
|---|---|---|
GET |
/health |
Health check |
GET |
/license |
Statut de la licence |
GET |
/license/hostname |
Hostname Splunk |
GET |
/deployer/health |
Santé du SH Deployer |
GET |
/deployer/status |
Statut du SH Deployer |
GET |
/deployer/config |
Configuration du SH Deployer |
POST |
/license/upload |
Uploader une licence |
POST |
/push |
Pousser les applications |
Deployer Agent (Port 9998)
| Méthode | Endpoint | Description |
|---|---|---|
GET |
/health |
Health check (pas d'auth) |
GET |
/status |
Statut du déploiement |
GET |
/apps |
Liste des apps |
GET |
/history |
Historique des déploiements |
POST |
/pull |
Git pull |
POST |
/deploy |
Apply shcluster-bundle |
POST |
/pull-and-deploy |
Pull + Deploy en une opération |
Exemple : Push avec déploiement SH Cluster
curl -k -X POST "https://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&deploy_to_shcluster=true"
📝 Changelog
Version 2.1.0 (Février 2026)
- 🚀 Nouveau : Déploiement automatique vers Search Head Cluster
- 🔧 Nouveau : Agent Deployer pour le SH Deployer
- ⚙️ Nouveau : Interface de configuration du SH Deployer
- 🔐 Amélioration : Gestion des caractères spéciaux dans les mots de passe
- 🛠️ Correction : Mode non-interactif pour shcluster-bundle
Version 2.0.0 (Février 2026)
- ✨ Nouveau système de licence par fichier
.lic - 🔐 Credentials Splunk chiffrés
- 🔒 Support HTTPS avec certificats SSL
- 🎨 Interface utilisateur modernisée
- 📊 Badge de licence en temps réel
- 🔧 Script de gestion amélioré
- 🛡️ Options pour masquer les boutons d'édition du dashboard
- 📝 Logs détaillés
- 🐛 Correction des problèmes CORS
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 :
- Version de Git Pusher
- Version de Splunk
- Configuration (HTTP/HTTPS)
- Architecture (standalone, SH Cluster)
- Logs Git Pusher (
/opt/splunk/var/log/splunk/git_pusher.log) - Logs Deployer Agent (
/opt/splunk/var/log/splunk/deployer_agent.log) - Erreurs de la console navigateur (F12)
- É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
Made with ❤️ for Splunk administrators