version: improved crypto flavour reading

product_flavour is embedded in the release package but the
package itself does not insist on a particular flavour other
than having knowledge about the flavour the package was
built for originally.  This is ok and direct crypto deps
seem to have failed to produce reliable upgrade / sidegrade
results in recent tests anyway.

Long story short: find out the real crypto flavour installed
from the OpenSSL binary or fall back to the metadata if said
binary cannot be found.
This commit is contained in:
Franco Fichtner 2018-09-26 20:10:01 +02:00
parent 63d38e58a7
commit a7dbe83957
4 changed files with 19 additions and 13 deletions

View File

@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd Sep 24, 2018
.Dd Sep 26, 2018
.Dt OPNSENSE-VERSION 8
.Os
.Sh NAME
@ -58,6 +58,9 @@ Return the firmware ABI string.
Return the product contact e-mail address.
.It Fl f
Return the cryptography flavour.
The correct flavour will be read from the installed OpenSSL
binary, or from release package metadata if the binary could
not be found.
.It Fl H
Return the release package commit hash.
.It Fl N

View File

@ -34,14 +34,9 @@ require_once("interfaces.inc");
require_once("util.inc");
require_once("plugins.inc.d/openssh.inc");
$hostname = $config['system']['hostname'];
$domain = $config['system']['domain'];
$flavour = $g['product_flavour'];
$version = $g['product_version'];
$product = $g['product_name'];
$machine = $g['product_arch'];
$version = trim(shell_exec('opnsense-version'));
echo "\n*** {$hostname}.{$domain}: {$product} {$version} ({$machine}/${flavour}) ***\n";
echo "\n*** {$config['system']['hostname']}.{$config['system']['domain']}: {$version} ***\n";
$iflist = legacy_config_get_interfaces(array('virtual' => false));

View File

@ -24,6 +24,7 @@
# POSSIBILITY OF SUCH DAMAGE.
VERSION="/usr/local/opnsense/version/opnsense"
OPENSSL="/usr/local/bin/openssl"
OUTPUT=
if [ ! -f ${VERSION} ]; then
@ -75,4 +76,9 @@ if [ -z "${OUTPUT}" ]; then
OUTPUT="\${product_name} \${product_version} \(\${product_arch}/\${product_flavour}\)"
fi
if [ -z "${OUTPUT%%*product_flavour*}" -a -f ${OPENSSL} ]; then
RESULT=$(${OPENSSL} version)
product_flavour=${RESULT%% *}
fi
eval echo ${OUTPUT}

View File

@ -65,14 +65,16 @@ include('head.inc');
$plugins = implode(' ', explode("\n", shell_exec('pkg info -g "os-*"')));
$crash_report_header = sprintf(
"%s\n%s %s (%s/%s)\n%sTime %s\n",
"%s %s\n%s %s %s\n%sTime %s\n%s\nPHP %s\n",
php_uname('v'),
$g['product_name'],
"{$g['product_version']}-{$g['product_hash']}",
$g['product_arch'],
$g['product_flavour'],
$g['product_name'],
$g['product_version'],
$g['product_hash'],
empty($plugins) ? '' : "Plugins $plugins\n",
date('r')
date('r'),
OPENSSL_VERSION_TEXT,
PHP_VERSION
);
if (isset($_SERVER['HTTP_USER_AGENT'])) {