diff --git a/docker-compose.yml b/docker-compose.yml index 883d80ba..6d3614cc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -66,12 +66,10 @@ services: # environment: # - "WAZUH_KIBANA_PLUGIN_URL=http://your.repo/wazuhapp-2.1.0-5.5.1.zip" nginx: - image: nginx:latest + image: wazuh/wazuh-nginx hostname: nginx restart: always - command: bash /configure.sh - volumes: - - ./nginx/configure.sh:/configure.sh + entrypoint: sh /configure.sh environment: - NGINX_PORT=443 ports: diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 00000000..f6da2fab --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx:latest + +RUN apt-get update && apt-get install -y openssl apache2-utils + +COPY ./configure.sh /configure.sh diff --git a/nginx/configure.sh b/nginx/configure.sh index 2877a2ee..758bdd81 100644 --- a/nginx/configure.sh +++ b/nginx/configure.sh @@ -4,20 +4,14 @@ set -e if [ ! -d /etc/pki/tls/certs ]; then echo "Generating SSL certificates" - if [ ! -x /usr/bin/openssl ]; then - apt-get update >/dev/null - apt-get -y install openssl >/dev/null - fi mkdir -p /etc/pki/tls/certs /etc/pki/tls/private openssl req -x509 -batch -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/kibana-access.key -out /etc/pki/tls/certs/kibana-access.pem >/dev/null +else + echo "SSL certificates already present" fi if [ ! -f /etc/nginx/conf.d/kibana.htpasswd ]; then - echo "Setting kibana credentials" - if [ ! -x /usr/bin/htpasswd ]; then - apt-get update >/dev/null - apt-get -y install apache2-utils >/dev/null - fi + echo "Setting Nginx credentials" echo bar|htpasswd -i -c /etc/nginx/conf.d/kibana.htpasswd foo >/dev/null else echo "Kibana credentials already configured"