Apache/PHP: Force execution of signed code only (o

2019-04-12 07:16发布

问题:

Just thought about hardening our Apache/PHP server installations and pondering about a general approach. Is it possible to create a configuration in that php code is only then executed, when it is "signed" or the hash sum (e.g. MD5) is known?

Has anyone a suggestion?

回答1:

Just a head's up: I wouldn't recommend MD5 here, at all.

That being said, PHP Archives (a.k.a. Phar) support code-signing through OpenSSL. This is used in random_compat (see: random_compat.phar and random_compat.phar.pubkey; the .asc file is a GPG signature of the .pubkey file).

The code we use to generate signed Phars is located here.