Skip to content

Commit

Permalink
Hide PHP version (#209)
Browse files Browse the repository at this point in the history
Add option to hide PHP version by adding `expose_php = Off` to `php.ini` for security reasons
Co-authored-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
patschi authored and ibennetch committed Dec 23, 2019
1 parent 7d8a3e5 commit 2313c19
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma
* ``PMA_PORTS`` - define comma separated list of ports of the MySQL servers
* ``PMA_USER`` and ``PMA_PASSWORD`` - define username to use for config authentication method
* ``PMA_ABSOLUTE_URI`` - define user-facing URI
* ``HIDE_PHP_VERSION`` - if defined, will hide the php version (`expose_php = Off`). Set to any value (such as HIDE_PHP_VERSION=true).

For usage with Docker secrets, appending ``_FILE`` to any environment variable is allowed:
```
Expand Down
5 changes: 5 additions & 0 deletions apache/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ EOT
fi
fi

if [ ! -z "${HIDE_PHP_VERSION}" ]; then
echo "PHP version is now hidden."
echo 'expose_php = Off' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
fi

exec "$@"
5 changes: 5 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ EOT
fi
fi

if [ ! -z "${HIDE_PHP_VERSION}" ]; then
echo "PHP version is now hidden."
echo -e 'expose_php = Off\n' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
fi

exec "$@"
5 changes: 5 additions & 0 deletions fpm-alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ EOT
fi
fi

if [ ! -z "${HIDE_PHP_VERSION}" ]; then
echo "PHP version is now hidden."
echo 'expose_php = Off' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
fi

exec "$@"
5 changes: 5 additions & 0 deletions fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ EOT
fi
fi

if [ ! -z "${HIDE_PHP_VERSION}" ]; then
echo "PHP version is now hidden."
echo 'expose_php = Off' > $PHP_INI_DIR/conf.d/phpmyadmin-hide-php-version.ini
fi

exec "$@"

0 comments on commit 2313c19

Please sign in to comment.