mirror of
				https://github.com/wazuh/wazuh-docker.git
				synced 2025-11-03 21:43:17 +00:00 
			
		
		
		
	Set defaultIndex and API creeds for Kibana, closes #17
This commit is contained in:
		@@ -61,6 +61,7 @@ services:
 | 
				
			|||||||
      - elasticsearch
 | 
					      - elasticsearch
 | 
				
			||||||
    links:
 | 
					    links:
 | 
				
			||||||
      - elasticsearch:elasticsearch
 | 
					      - elasticsearch:elasticsearch
 | 
				
			||||||
 | 
					      - wazuh
 | 
				
			||||||
    entrypoint: sh wait-for-it.sh elasticsearch
 | 
					    entrypoint: sh wait-for-it.sh elasticsearch
 | 
				
			||||||
#    environment:
 | 
					#    environment:
 | 
				
			||||||
#      - "WAZUH_KIBANA_PLUGIN_URL=http://your.repo/wazuhapp-2.1.0-5.5.1.zip"
 | 
					#      - "WAZUH_KIBANA_PLUGIN_URL=http://your.repo/wazuhapp-2.1.0-5.5.1.zip"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,4 +22,37 @@ else
 | 
				
			|||||||
  /usr/share/kibana/bin/kibana-plugin install ${WAZUH_KIBANA_PLUGIN_URL}
 | 
					  /usr/share/kibana/bin/kibana-plugin install ${WAZUH_KIBANA_PLUGIN_URL}
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sleep 30
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Configuring defaultIndex to wazuh-alerts-*"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					curl -s -XPUT http://$host:9200/.kibana/config/5.5.2 -d '{"defaultIndex" : "wazuh-alerts-*"}' > /dev/null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sleep 30
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Setting API credentials into Wazuh APP"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CONFIG_CODE=$(curl -s -o /dev/null -w "%{http_code}" -XGET http://$host:9200/.wazuh/wazuh-configuration/apiconfig)
 | 
				
			||||||
 | 
					if [ "x$CONFIG_CODE" = "x404" ]; then
 | 
				
			||||||
 | 
					  curl -s -XPOST http://$host:9200/.wazuh/wazuh-configuration/apiconfig -H 'Content-Type: application/json' -d'
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    "api_user": "foo",
 | 
				
			||||||
 | 
					    "api_password": "YmFy",
 | 
				
			||||||
 | 
					    "url": "http://wazuh",
 | 
				
			||||||
 | 
					    "api_port": "55000",
 | 
				
			||||||
 | 
					    "insecure": "true",
 | 
				
			||||||
 | 
					    "component": "API",
 | 
				
			||||||
 | 
					    "active": "true",
 | 
				
			||||||
 | 
					    "manager": "wazuh-manager",
 | 
				
			||||||
 | 
					    "extensions": {
 | 
				
			||||||
 | 
					      "oscap": true,
 | 
				
			||||||
 | 
					      "audit": true,
 | 
				
			||||||
 | 
					      "pci": true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  ' > /dev/null
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					  echo "Wazuh APP already configured"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exec $cmd
 | 
					exec $cmd
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user