From 2b74f640ce89abb5cbde94e6a78da4b7836b7b76 Mon Sep 17 00:00:00 2001 From: Splunk Git Pusher Date: Sat, 14 Feb 2026 00:06:16 +0100 Subject: [PATCH] Update+README Pushed by: admin License: DD386DFD-398 (Essai) Timestamp: 2026-02-14T00:06:16.092384 --- apps/pusher_app_prem/README.md | 638 ++++++++++-------- .../license_validator.cpython-39.pyc | Bin .../bin/credentials_manager.py | 0 apps/pusher_app_prem/bin/git_pusher.pid | 2 +- apps/pusher_app_prem/local/.credentials | 0 apps/pusher_app_prem/local/.key | 0 apps/pusher_app_prem/local/certs/server.crt | 0 apps/pusher_app_prem/local/certs/server.key | 0 .../git_pusher_-_deploy_applications.xml | 0 apps/pusher_app_prem/local/usage_stats.json | 2 +- apps/pusher_app_prem/metadata/local.meta | 0 11 files changed, 353 insertions(+), 289 deletions(-) mode change 100644 => 100755 apps/pusher_app_prem/bin/__pycache__/license_validator.cpython-39.pyc mode change 100644 => 100755 apps/pusher_app_prem/bin/credentials_manager.py mode change 100644 => 100755 apps/pusher_app_prem/bin/git_pusher.pid mode change 100644 => 100755 apps/pusher_app_prem/local/.credentials mode change 100644 => 100755 apps/pusher_app_prem/local/.key mode change 100644 => 100755 apps/pusher_app_prem/local/certs/server.crt mode change 100644 => 100755 apps/pusher_app_prem/local/certs/server.key mode change 100644 => 100755 apps/pusher_app_prem/local/data/ui/views/git_pusher_-_deploy_applications.xml mode change 100644 => 100755 apps/pusher_app_prem/local/usage_stats.json mode change 100644 => 100755 apps/pusher_app_prem/metadata/local.meta diff --git a/apps/pusher_app_prem/README.md b/apps/pusher_app_prem/README.md index 5a06d955..da92895d 100644 --- a/apps/pusher_app_prem/README.md +++ b/apps/pusher_app_prem/README.md @@ -1,6 +1,6 @@ # 🚀 Git Pusher for Splunk -**Version 2.0** | Application Splunk pour déployer vos applications vers Git +**Version 2.1** | Application Splunk pour déployer vos applications vers Git et le Search Head Cluster --- @@ -9,7 +9,8 @@ - [Présentation](#-présentation) - [Fonctionnalités](#-fonctionnalités) - [Architecture](#-architecture) -- [Installation](#-installation) +- [Installation - Serveur Source](#-installation---serveur-source) +- [Installation - SH Deployer Agent](#-installation---sh-deployer-agent) - [Configuration](#-configuration) - [Configuration HTTPS](#-configuration-https) - [Système de Licence](#-système-de-licence) @@ -25,13 +26,21 @@ ## 🎯 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. +**Git Pusher** est une application Splunk Enterprise qui permet de : +1. **Versionner** vos applications Splunk dans un repository Git +2. **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 --- @@ -40,6 +49,7 @@ Idéal pour : | 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 | @@ -52,7 +62,38 @@ Idéal pour : ## 🏗 Architecture ``` -pusher_app_prem/ +┌─────────────────────────────────────────────────────────────────┐ +│ 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 @@ -72,26 +113,20 @@ pusher_app_prem/ │ ├── server.crt │ └── server.key └── README.md -``` - -### Flux de données -``` -┌─────────────────┐ ┌────────────────────┐ ┌─────────────┐ -│ Splunk │────▶│ Git Pusher │────▶│ Git Repo │ -│ Dashboard │ │ Server:9999 │ │ (Remote) │ -│ (HTTPS) │ │ (HTTP/HTTPS) │ │ │ -└─────────────────┘ └────────────────────┘ └─────────────┘ - │ - ┌──────┴──────┐ - │ /opt/splunk/etc/apps/ │ - │ (Applications locales)│ - └─────────────────────┘ +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 +## 📥 Installation - Serveur Source ### Prérequis @@ -135,7 +170,20 @@ Confirm Password: ******** #### 3. Configurer HTTPS (si Splunk est en HTTPS) -Voir la section [Configuration HTTPS](#-configuration-https). +```bash +# 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 @@ -160,25 +208,97 @@ sudo ufw allow 9999/tcp /opt/splunk/bin/splunk restart ``` -#### 7. Accéder au dashboard +#### 7. Accepter le certificat dans le navigateur + +1. Ouvrir : `https://VOTRE_IP_SPLUNK:9999/health` +2. Accepter le certificat auto-signé +3. Rafraîchir le dashboard (Ctrl+Shift+R) + +--- + +## 📥 Installation - SH Deployer Agent + +### Sur le serveur SH Deployer + +#### 1. Créer l'application + +```bash +# 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 + +```bash +nano /opt/splunk/etc/apps/deployer_agent/bin/deployer_agent.py +``` + +Modifier la ligne `AUTH_TOKEN` : +```python +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 : +```python +target_uri = "https://IP_DU_CAPTAIN:8089" +``` + +#### 4. Générer les certificats SSL -Ouvrez votre navigateur et allez sur : +```bash +cd /opt/splunk/etc/apps/deployer_agent/bin/ +./start_deployer_agent.sh gencerts ``` -http://VOTRE_IP_SPLUNK:8000/app/pusher_app_prem/git_pusher_-_deploy_applications + +#### 5. Définir les permissions + +```bash +chown -R splunk:splunk /opt/splunk/etc/apps/deployer_agent ``` -Ou en HTTPS : +#### 6. Ouvrir le firewall + +```bash +sudo firewall-cmd --add-port=9998/tcp --permanent +sudo firewall-cmd --reload ``` -https://VOTRE_IP_SPLUNK:8000/app/pusher_app_prem/git_pusher_-_deploy_applications + +#### 7. Démarrer l'agent + +```bash +./start_deployer_agent.sh start ``` +#### 8. Vérifier le statut + +```bash +./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 du script de gestion +### Commandes Git Pusher (Serveur Source) ```bash +cd /opt/splunk/etc/apps/pusher_app_prem/bin/ + # Démarrer le serveur ./start_git_pusher.sh start @@ -201,94 +321,84 @@ https://VOTRE_IP_SPLUNK:8000/app/pusher_app_prem/git_pusher_-_deploy_application ./start_git_pusher.sh credentials delete ``` -### Variables d'environnement (optionnel) - -Si vous préférez ne pas utiliser le credentials manager : +### Commandes Deployer Agent (SH Deployer) ```bash -export SPLUNK_USERNAME=admin -export SPLUNK_PASSWORD=your_password -export SPLUNK_HOME=/opt/splunk +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 ``` -### Fichiers de configuration +### Configuration du SH Deployer dans l'interface -| Fichier | Description | -|---------|-------------| -| `local/license.lic` | Fichier de licence | -| `local/.credentials` | Credentials Splunk chiffrés | -| `local/.key` | Clé de chiffrement (générée automatiquement) | -| `local/certs/server.crt` | Certificat SSL | -| `local/certs/server.key` | Clé privée SSL | +1. Ouvrir le dashboard Git Pusher +2. Cliquer sur **⚙️ Configure** dans la section "Deploy to Search Head Cluster" +3. Remplir : + - **Host** : IP du SH Deployer (ex: 10.10.40.14) + - **Port** : 9998 + - **Token** : Le même token que dans `deployer_agent.py` +4. Cliquer sur **Save & Test** --- ## 🔒 Configuration HTTPS -Si votre Splunk est configuré en HTTPS, le serveur Git Pusher doit également être en HTTPS pour éviter les erreurs "Mixed Content" du navigateur. - -### 1. Générer les certificats SSL +### Git Pusher Server (Port 9999) ```bash -# 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/ ``` -### 2. Redémarrer le serveur +### Deployer Agent (Port 9998) ```bash -./start_git_pusher.sh restart -``` - -### 3. Vérifier que HTTPS fonctionne - -```bash -curl -k https://127.0.0.1:9999/health -``` - -Vous devriez voir : -```json -{"status": "ok", "service": "git_pusher", "timestamp": "..."} -``` - -### 4. Accepter le certificat dans le navigateur - -Comme le certificat est auto-signé, le navigateur ne lui fait pas confiance par défaut. +mkdir -p /opt/splunk/etc/apps/deployer_agent/local/certs -1. Ouvrez un nouvel onglet -2. Allez sur : `https://VOTRE_IP_SPLUNK:9999/health` -3. Cliquez sur **"Avancé"** puis **"Accepter le risque et continuer"** -4. Retournez sur le dashboard Splunk et rafraîchissez (Ctrl+Shift+R) - -### 5. (Optionnel) Désactiver HTTPS - -Si vous souhaitez forcer le mode HTTP : +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" -```bash -cd /opt/splunk/etc/apps/pusher_app_prem/bin/ -python3 git_pusher.py --no-ssl +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érification dans les logs +### Vérifier HTTPS ```bash -tail -20 /opt/splunk/var/log/splunk/git_pusher.log -``` +# Git Pusher +curl -k https://localhost:9999/health -Vous devriez voir : -``` -SSL enabled using: /opt/splunk/etc/apps/pusher_app_prem/local/certs/server.crt -Git Pusher server listening on 0.0.0.0:9999 (HTTPS) +# Deployer Agent +curl -k https://localhost:9998/health ``` --- @@ -304,88 +414,47 @@ Git Pusher utilise un système de licence par fichier `.lic` pour activer les fo | **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 +| **Enterprise** | 1 an | Illimité | Illimité | + SH Cluster deployment, API | -# Mode rapide -python3 license_generator.py quick "Client Name" "email@client.com" "hostname" "professional" +### Activer une licence -# Valider une licence -python3 license_generator.py validate -``` +1. Ouvrir le dashboard Git Pusher +2. Glisser-déposer le fichier `.lic` +3. Cliquer sur "Activer" --- ## 📖 Utilisation -### Pousser des applications vers Git +### Workflow complet : Push Git + Déploiement SH Cluster 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` +2. **Sélectionner les applications** à déployer -3. **Sélectionner les applications** - - Cocher les applications à déployer - - Utiliser "Select All" pour tout sélectionner +3. **Configurer Git** : + - Repository URL : `https://github.com/user/repo.git` + - Branch : `main` + - Token : Personal Access Token -4. **Écrire le message de commit** - - Décrivez les changements effectués +4. **Activer le déploiement SH Cluster** : + - Cocher "Enable automatic deployment" + - (Optionnel) Remplir les credentials Splunk si différents de l'admin par défaut 5. **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 -1. Settings → Developer settings → Personal access tokens → Tokens (classic) +1. Settings → Developer settings → Personal access tokens 2. Generate new token 3. Cocher : `repo` (Full control) @@ -404,44 +473,29 @@ python3 license_generator.py validate ### 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 -``` +- **Jamais visibles** en clair ### Communication HTTPS -- Le serveur Git Pusher supporte HTTPS avec certificats SSL -- Les certificats auto-signés sont supportés -- Communication chiffrée entre le navigateur et le serveur - -### 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é) +- SSL/TLS entre tous les composants +- Certificats auto-signés supportés +- Validation du token d'authentification -### Licence +### Token Deployer Agent -- Signature HMAC-SHA256 anti-falsification -- Binding au hostname Splunk -- Vérification de l'expiration +- Authentification par token entre Git Pusher et Deployer Agent +- Token configurable dans les deux composants +- Doit être identique des deux côtés -### Recommandations +### Bonnes pratiques -1. ✅ Utiliser HTTPS pour Splunk et Git Pusher -2. ✅ Utiliser des tokens Git avec permissions minimales -3. ✅ Renouveler les tokens régulièrement -4. ✅ Utiliser HTTPS pour les repositories Git -5. ✅ Restreindre l'accès au dashboard aux administrateurs +1. ✅ Utiliser HTTPS pour tous les composants +2. ✅ Changer le token par défaut du Deployer Agent +3. ✅ Utiliser des tokens Git avec permissions minimales +4. ✅ Restreindre l'accès réseau au port 9998/9999 +5. ✅ Renouveler les certificats régulièrement --- @@ -449,14 +503,11 @@ Les credentials Splunk sont : ### Masquer les boutons d'édition -Pour empêcher la modification du dashboard par les utilisateurs, éditez le fichier XML : - ```bash nano /opt/splunk/etc/apps/pusher_app_prem/default/data/ui/views/git_pusher_-_deploy_applications.xml ``` -Modifiez la première ligne : - +Modifier la première ligne : ```xml ``` @@ -483,99 +534,131 @@ rm -rf /opt/splunk/var/run/splunk/appserver/* ## 🔧 Dépannage -### Le serveur ne démarre pas - -```bash -# Vérifier les logs -tail -f /opt/splunk/var/log/splunk/git_pusher.log +### Les boutons ne fonctionnent pas -# Vérifier si le port est utilisé -ss -tlnp | grep 9999 +Le fichier JavaScript doit exposer les fonctions globalement. Vérifier que le bloc suivant est présent à la fin de `git_pusher.js` : -# Vérifier les permissions -ls -la /opt/splunk/etc/apps/pusher_app_prem/bin/ +```javascript +// 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 : +```bash +rm -rf /opt/splunk/var/run/splunk/appserver/* +/opt/splunk/bin/splunk restart ``` -### Erreur "Connexion refusée" +Et dans le navigateur : **Ctrl+Shift+R** -```bash -# Vérifier que le serveur tourne -ps aux | grep git_pusher +### Erreur 401 Unauthorized (Deployer) -# Vérifier le firewall -sudo firewall-cmd --list-ports +Le token ne correspond pas entre les deux composants. -# Ouvrir le port -sudo firewall-cmd --add-port=9999/tcp --permanent -sudo firewall-cmd --reload +1. Vérifier le token sur le SH Deployer : +```bash +grep "AUTH_TOKEN" /opt/splunk/etc/apps/deployer_agent/bin/deployer_agent.py ``` -### Erreur CORS - -Les fichiers JavaScript doivent utiliser l'adresse IP du serveur automatiquement. +2. Configurer le même token dans l'interface (⚙️ Configure) -Vérifier : +3. Tester : ```bash -head -10 /opt/splunk/etc/apps/pusher_app_prem/appserver/static/license_validation.js +curl -k -H "X-Auth-Token: VOTRE_TOKEN" https://IP_DEPLOYER:9998/status ``` -Doit contenir : -```javascript -const LICENSE_API_URL = window.location.protocol + '//' + window.location.hostname + ':9999'; -``` - -### Erreur CORS avec HTTPS +### Erreur "tcsetattr: Inappropriate ioctl for device" -Si vous voyez une erreur CORS avec HTTPS et un certificat auto-signé : +La commande `splunk apply shcluster-bundle` attend une entrée interactive. -1. Ouvrez `https://VOTRE_IP:9999/health` dans un nouvel onglet -2. Acceptez le certificat -3. Retournez sur Splunk et rafraîchissez +Solution : Modifier la fonction `apply_shcluster_bundle` dans `deployer_agent.py` pour utiliser `echo 'y' |` : -### Erreur SSL "wrong version number" +```python +shell_cmd = f"echo 'y' | {SPLUNK_BIN} apply shcluster-bundle -target {target_uri} -auth {auth_user}:'{escaped_pass}' -preserve-lookups true" +``` -Le serveur n'a pas activé SSL. Vérifiez : +### Erreur CORS +Vider le cache Splunk et navigateur : ```bash -# Les certificats existent-ils ? -ls -la /opt/splunk/etc/apps/pusher_app_prem/local/certs/ - -# Les logs montrent-ils SSL enabled ? -grep -i ssl /opt/splunk/var/log/splunk/git_pusher.log +rm -rf /opt/splunk/var/run/splunk/appserver/* +/opt/splunk/bin/splunk restart ``` +Puis **Ctrl+Shift+R** dans le navigateur. -Si les certificats n'existent pas, créez-les (voir section HTTPS). - -### Les applications ne sont pas poussées +### Le SH Deployer ne répond pas ```bash -# Vérifier les logs -tail -50 /opt/splunk/var/log/splunk/git_pusher.log +# Vérifier le statut +./start_deployer_agent.sh status -# Tester manuellement -curl -k https://localhost:9999/health +# Voir les logs +tail -50 /opt/splunk/var/log/splunk/deployer_agent.log + +# Redémarrer +./start_deployer_agent.sh restart ``` -### Erreur de licence +### Le bundle ne s'applique pas +1. Vérifier que le pull a fonctionné : ```bash -# Vérifier le hostname -hostname - -# Vérifier la licence -python3 /opt/splunk/etc/apps/pusher_app_prem/bin/license_validator.py status +ls -la /opt/splunk/etc/shcluster/apps/ ``` -### Les boutons ne fonctionnent pas - -Vérifiez la console du navigateur (F12). Si les fonctions ne sont pas définies, videz le cache : - +2. Vérifier les logs : ```bash -rm -rf /opt/splunk/var/run/splunk/appserver/* -/opt/splunk/bin/splunk restart +grep -i "bundle\|error" /opt/splunk/var/log/splunk/deployer_agent.log | tail -30 ``` -Puis dans le navigateur : **Ctrl+Shift+R** +3. Tester manuellement : +```bash +echo 'y' | /opt/splunk/bin/splunk apply shcluster-bundle -target https://CAPTAIN_IP:8089 -auth admin:'password' -preserve-lookups true +``` ### Vider le cache Splunk @@ -588,69 +671,48 @@ rm -rf /opt/splunk/var/run/splunk/appserver/* ## 📡 API Reference -### Endpoints +### 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 | -### Exemple : Health Check - -```bash -curl -k https://localhost:9999/health -``` - -```json -{ - "status": "ok", - "service": "git_pusher", - "timestamp": "2026-01-31T12:00:00.000000" -} -``` - -### Exemple : Statut de licence +### Deployer Agent (Port 9998) -```bash -curl -k https://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 - } -} -``` +| 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 +### Exemple : Push avec déploiement SH Cluster ```bash -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" -``` - -```json -{ - "status": "success", - "message": "Successfully pushed 1 application(s) to Git", - "apps_pushed": 1, - "license_type": "Professional" -} +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 @@ -683,9 +745,11 @@ Incluez dans votre rapport : 1. Version de Git Pusher 2. Version de Splunk 3. Configuration (HTTP/HTTPS) -4. Logs (`/opt/splunk/var/log/splunk/git_pusher.log`) -5. Erreurs de la console navigateur (F12) -6. Étapes pour reproduire le problème +4. Architecture (standalone, SH Cluster) +5. Logs Git Pusher (`/opt/splunk/var/log/splunk/git_pusher.log`) +6. Logs Deployer Agent (`/opt/splunk/var/log/splunk/deployer_agent.log`) +7. Erreurs de la console navigateur (F12) +8. Étapes pour reproduire le problème --- @@ -699,4 +763,4 @@ Git Pusher est un logiciel propriétaire. Une licence valide est requise pour so

Made with ❤️ for Splunk administrators -

\ No newline at end of file +

diff --git a/apps/pusher_app_prem/bin/__pycache__/license_validator.cpython-39.pyc b/apps/pusher_app_prem/bin/__pycache__/license_validator.cpython-39.pyc old mode 100644 new mode 100755 diff --git a/apps/pusher_app_prem/bin/credentials_manager.py b/apps/pusher_app_prem/bin/credentials_manager.py old mode 100644 new mode 100755 diff --git a/apps/pusher_app_prem/bin/git_pusher.pid b/apps/pusher_app_prem/bin/git_pusher.pid old mode 100644 new mode 100755 index 049d42b3..d18a9fa7 --- a/apps/pusher_app_prem/bin/git_pusher.pid +++ b/apps/pusher_app_prem/bin/git_pusher.pid @@ -1 +1 @@ -2311220 +770390 diff --git a/apps/pusher_app_prem/local/.credentials b/apps/pusher_app_prem/local/.credentials old mode 100644 new mode 100755 diff --git a/apps/pusher_app_prem/local/.key b/apps/pusher_app_prem/local/.key old mode 100644 new mode 100755 diff --git a/apps/pusher_app_prem/local/certs/server.crt b/apps/pusher_app_prem/local/certs/server.crt old mode 100644 new mode 100755 diff --git a/apps/pusher_app_prem/local/certs/server.key b/apps/pusher_app_prem/local/certs/server.key old mode 100644 new mode 100755 diff --git a/apps/pusher_app_prem/local/data/ui/views/git_pusher_-_deploy_applications.xml b/apps/pusher_app_prem/local/data/ui/views/git_pusher_-_deploy_applications.xml old mode 100644 new mode 100755 diff --git a/apps/pusher_app_prem/local/usage_stats.json b/apps/pusher_app_prem/local/usage_stats.json old mode 100644 new mode 100755 index 7163ffaf..04fbdb9b --- a/apps/pusher_app_prem/local/usage_stats.json +++ b/apps/pusher_app_prem/local/usage_stats.json @@ -1 +1 @@ -{"pushes_today": 7, "pushes_total": 28, "last_push_date": "2026-02-06", "apps_pushed": []} \ No newline at end of file +{"pushes_today": 2, "pushes_total": 46, "last_push_date": "2026-02-13", "apps_pushed": []} \ No newline at end of file diff --git a/apps/pusher_app_prem/metadata/local.meta b/apps/pusher_app_prem/metadata/local.meta old mode 100644 new mode 100755