Compare commits
2 Commits
f224e974b0
...
c8aca90278
| Author | SHA1 | Date | |
|---|---|---|---|
| c8aca90278 | |||
| 3c6f49ae31 |
@@ -62,7 +62,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./files/icinga2:/data
|
- ./files/icinga2:/data
|
||||||
ports:
|
ports:
|
||||||
- ${ICINGA_API_PORT:5665}:5665 # only need if you plan to use api from other sources as icingaweb2
|
- ${ICINGA_API_PORT:-5665}:5665 # only need if you plan to use api from other sources as icingaweb2
|
||||||
networks:
|
networks:
|
||||||
- icinga
|
- icinga
|
||||||
#- backend
|
#- backend
|
||||||
|
|||||||
41
init.sh
41
init.sh
@@ -22,6 +22,27 @@ if [ -z "$(ls -A /data)" ]; then
|
|||||||
mv $ICINGA2_CONF_DIR/hosts.conf $ICINGA2_ZONE_MASTER/
|
mv $ICINGA2_CONF_DIR/hosts.conf $ICINGA2_ZONE_MASTER/
|
||||||
mv $ICINGA2_CONF_DIR/*.conf $ICINGA2_GLOBAL_TEMPLATES/
|
mv $ICINGA2_CONF_DIR/*.conf $ICINGA2_GLOBAL_TEMPLATES/
|
||||||
mv $ICINGA2_GLOBAL_TEMPLATES/api-users.conf $ICINGA2_CONF_DIR/
|
mv $ICINGA2_GLOBAL_TEMPLATES/api-users.conf $ICINGA2_CONF_DIR/
|
||||||
|
|
||||||
|
## only on inital setup create a icingaweb api user if env var is set
|
||||||
|
## permission source: https://icinga.com/docs/icinga-web/latest/modules/monitoring/doc/05-Command-Transports/
|
||||||
|
if [ ! -z "$ICINGA2_API_USER_ICINGAWEB_PASS" ]; then
|
||||||
|
echo set inital icingadb api user
|
||||||
|
echo 'object ApiUser "icingaweb2" {' >> $ICINGA2_FILE_API_USER_CONF
|
||||||
|
echo " password = \"$ICINGA2_API_USER_ICINGAWEB_PASS\"" >> $ICINGA2_FILE_API_USER_CONF
|
||||||
|
echo ' permissions = [ "status/query", "actions/*", "objects/modify/*", "objects/query/*" ]' >> $ICINGA2_FILE_API_USER_CONF
|
||||||
|
echo '}' >> $ICINGA2_FILE_API_USER_CONF
|
||||||
|
fi
|
||||||
|
|
||||||
|
## only on inital setup create a pki-ticket api user if env var is set
|
||||||
|
## permission source: https://icinga.com/docs/icinga-2/latest/doc/06-distributed-monitoring/#csr-auto-signing-on-the-master
|
||||||
|
if [ ! -z "$ICINGA2_API_USER_SATELLITE_PASS" ]; then
|
||||||
|
echo set inital pki-ticket api user
|
||||||
|
echo 'object ApiUser "pki-ticket" {' >> $ICINGA2_FILE_API_USER_CONF
|
||||||
|
echo " password = \"$ICINGA2_API_USER_SATELLITE_PASS\"" >> $ICINGA2_FILE_API_USER_CONF
|
||||||
|
echo ' permissions = [ "actions/generate-ticket" ]' >> $ICINGA2_FILE_API_USER_CONF
|
||||||
|
echo '}' >> $ICINGA2_FILE_API_USER_CONF
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -31,26 +52,6 @@ if [ ! -z "$ICINGA2_API_USER_ROOT_PASS" ]; then
|
|||||||
sed -i "s|password = \".*\"|password = \"$ICINGA2_API_USER_ROOT_PASS\"|g" $ICINGA2_FILE_API_USER_CONF
|
sed -i "s|password = \".*\"|password = \"$ICINGA2_API_USER_ROOT_PASS\"|g" $ICINGA2_FILE_API_USER_CONF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## only on inital setup create a icingaweb api user if env var is set
|
|
||||||
## permission source: https://icinga.com/docs/icinga-web/latest/modules/monitoring/doc/05-Command-Transports/
|
|
||||||
if [ ! -z "$ICINGA2_API_USER_ICINGAWEB_PASS" ]; then
|
|
||||||
echo set inital icingadb api user
|
|
||||||
echo 'object ApiUser "icingaweb2" {' >> $ICINGA2_FILE_API_USER_CONF
|
|
||||||
echo " password = \"$ICINGA2_API_USER_ICINGAWEB_PASS\"" >> $ICINGA2_FILE_API_USER_CONF
|
|
||||||
echo ' permissions = [ "status/query", "actions/*", "objects/modify/*", "objects/query/*" ]' >> $ICINGA2_FILE_API_USER_CONF
|
|
||||||
echo '}' >> $ICINGA2_FILE_API_USER_CONF
|
|
||||||
fi
|
|
||||||
|
|
||||||
## only on inital setup create a pki-ticket api user if env var is set
|
|
||||||
## permission source: https://icinga.com/docs/icinga-2/latest/doc/06-distributed-monitoring/#csr-auto-signing-on-the-master
|
|
||||||
if [ ! -z "$ICINGA2_API_USER_SATELLITE_PASS" ]; then
|
|
||||||
echo set inital icingadb api user
|
|
||||||
echo 'object ApiUser "pki-ticket" {' >> $ICINGA2_FILE_API_USER_CONF
|
|
||||||
echo " password = \"$ICINGA2_API_USER_SATELLITE_PASS\"" >> $ICINGA2_FILE_API_USER_CONF
|
|
||||||
echo ' permissions = [ "actions/generate-ticket" ]' >> $ICINGA2_FILE_API_USER_CONF
|
|
||||||
echo '}' >> $ICINGA2_FILE_API_USER_CONF
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
## enable icingadb feature if not active
|
## enable icingadb feature if not active
|
||||||
if [ ! -f "$ICINGA2_FILE_ICINGADB_CONF" ]; then
|
if [ ! -f "$ICINGA2_FILE_ICINGADB_CONF" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user