diff --git a/build-docker-images/wazuh-manager/Dockerfile b/build-docker-images/wazuh-manager/Dockerfile index 0433b503..5bc2cd2a 100644 --- a/build-docker-images/wazuh-manager/Dockerfile +++ b/build-docker-images/wazuh-manager/Dockerfile @@ -40,6 +40,10 @@ COPY config/filebeat.yml /etc/filebeat/ RUN chmod go-w /etc/filebeat/filebeat.yml +# Remove wazuh-authd default certs to force generation of new ones at container startup +RUN rm -f /var/ossec/etc/sslmanager.key && \ + rm -f /var/ossec/etc/sslmanager.cert + ADD https://raw.githubusercontent.com/wazuh/wazuh/$FILEBEAT_TEMPLATE_BRANCH/extensions/elasticsearch/7.x/wazuh-template.json /etc/filebeat RUN chmod go-w /etc/filebeat/wazuh-template.json diff --git a/build-docker-images/wazuh-manager/config/etc/cont-init.d/0-wazuh-init b/build-docker-images/wazuh-manager/config/etc/cont-init.d/0-wazuh-init index ec2903b5..044aee8a 100644 --- a/build-docker-images/wazuh-manager/config/etc/cont-init.d/0-wazuh-init +++ b/build-docker-images/wazuh-manager/config/etc/cont-init.d/0-wazuh-init @@ -6,8 +6,6 @@ source /permanent_data.env WAZUH_INSTALL_PATH=/var/ossec WAZUH_CONFIG_MOUNT=/wazuh-config-mount -AUTO_ENROLLMENT_ENABLED=${AUTO_ENROLLMENT_ENABLED:-true} - ############################################################################## # Aux functions @@ -215,13 +213,10 @@ main() { # Remove some files in permanent_data (i.e. .template.db) remove_data_files - # Generate wazuh-authd certs if AUTO_ENROLLMENT_ENABLED is true and does not exist - if [ $AUTO_ENROLLMENT_ENABLED == true ] + # Create wazuh-authd key and cert if not present + if [ ! -e ${WAZUH_INSTALL_PATH}/etc/sslmanager.key ] then - if [ ! -e ${WAZUH_INSTALL_PATH}/etc/sslmanager.key ] - then - create_ossec_key_cert - fi + create_ossec_key_cert fi # Mount selected files (WAZUH_CONFIG_MOUNT) to container