Giter VIP home page Giter VIP logo

Comments (1)

ibotty avatar ibotty commented on June 28, 2024

Just for others that want something similar, I amended the php image by adding the the following file in /usr/share/container-scripts/php/pre-start/99-kubernetes-tls-secret.sh.

#!/bin/bash
# /usr/share/container-scripts/php/pre-start/99-kubernetes-tls-secret.sh
# this is an adapted copy of process_ssl_certs in /usr/share/container-scripts/php/common.sh
process_kubernetes_tls_certs() {
  local dir
  dir="$1"
  if [ -d ${dir} ]; then
    echo "---> Looking for SSL certs for httpd in $dir ..."
    local ssl_cert="$dir/tls.crt"
    local ssl_private="$dir/tls.key"
    if [ -f "${ssl_cert}" ] ; then
      # do sed for SSLCertificateFile and SSLCertificateKeyFile
      echo "---> Setting SSL cert file for httpd..."
      sed -i -e "s|^SSLCertificateFile .*$|SSLCertificateFile ${ssl_cert}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
      if [ -f "${ssl_private}" ]; then
        echo "---> Setting SSL key file for httpd..."
        sed -i -e "s|^SSLCertificateKeyFile .*$|SSLCertificateKeyFile ${ssl_private}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
      else
        echo "---> Removing SSL key file settings for httpd..."
        sed -i '/^SSLCertificateKeyFile .*/d'  ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
      fi
    fi
  fi
}

enable_http2() {
  if [ "${ENABLE_HTTP2:-}" = yes ]; then
    sed -i '/<VirtualHost.*:8443>/aProtocols h2 h2c http/1.1' ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
  fi
}

process_kubernetes_tls_certs "${HTTPD_CERT_DIR:=/run/secrets/tls-certs}"
enable_http2

from s2i-php-container.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.