From mboxrd@z Thu Jan  1 00:00:00 1970
From: Bernhard Bitsch <bbitsch@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH] index.cgi: Display a warning if the last Core Update was
 installed more than 90 days ago
Date: Sun, 16 Jan 2022 10:42:12 +0100
Message-ID: <52bd61be-1ecb-4600-c264-db66202e514e@ipfire.org>
In-Reply-To: <9e7f86f1-3db1-cdab-f246-a786fde22c79@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1829053133575136866=="
List-Id: <development.lists.ipfire.org>

--===============1829053133575136866==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Acked-by: Bernhard Bitsch <bbitsch(a)ipfire.org>
Reviewed-by: Bernhard Bitsch <bbitsch(a)ipfire.org>


Am 15.01.2022 um 10:15 schrieb Peter M=C3=BCller:
> At the time of writing, Fireinfo reports more 51.67% of all
> installations reporting back to us are running at least two Core Updates
> older than the latest one.
>=20
> While I doubt we can expect our userbase to patch their systems within
> 24 hours (which is the recommended timespan given for critical
> infrastructures by multiple CERTs), if they the last Core Update was
> installed more than 90 days ago, we can safely consider the system in
> question being outdated and insecure.
>=20
> Therefore, this patch displays a warning on index.cgi, in addition to
> the "an update is available" message - in the hope to nudge people to
> keep their IPFire machines up to date.
>=20
> Signed-off-by: Peter M=C3=BCller <peter.mueller(a)ipfire.org>
> ---
>   html/cgi-bin/index.cgi | 10 +++++++++-
>   langs/de/cgi-bin/de.pl |  1 +
>   langs/en/cgi-bin/en.pl |  1 +
>   3 files changed, 11 insertions(+), 1 deletion(-)
>=20
> diff --git a/html/cgi-bin/index.cgi b/html/cgi-bin/index.cgi
> index 2b7ccdb0f..fbd656988 100644
> --- a/html/cgi-bin/index.cgi
> +++ b/html/cgi-bin/index.cgi
> @@ -2,7 +2,7 @@
>   #########################################################################=
######
>   #                                                                        =
     #
>   # IPFire.org - A linux based firewall                                    =
     #
> -# Copyright (C) 2007-2014  IPFire Team  <info(a)ipfire.org>               =
      #
> +# Copyright (C) 2007-2022  IPFire Team  <info(a)ipfire.org>               =
      #
>   #                                                                        =
     #
>   # This program is free software: you can redistribute it and/or modify   =
     #
>   # it under the terms of the GNU General Public License as published by   =
     #
> @@ -541,6 +541,14 @@ if ( ! -e "/var/ipfire/main/send_profile") {
>   	$warnmessage .=3D "<li><a style=3D'color: white;' href=3D'fireinfo.cgi'>=
$Lang::tr{'fireinfo please enable'}</a></li>";
>   }
>  =20
> +# Running on likely outdated Core Update (last update was more than 90 day=
s ago)
> +my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $=
ctime, $blksize, $blocks) =3D stat "/opt/pakfire/db/core/mine";
> +my $core_update_age =3D time() - $mtime;
> +
> +if ( "$core_update_age" > "7776000" ) {
> +	$warnmessage .=3D "<li>$Lang::tr{'outdated installation warning'}</li>";
> +}
> +
>   # EOL architecture
>   my ($sysname, $nodename, $release, $version, $machine) =3D &POSIX::uname(=
);
>   if ($machine =3D~ m/^i.86$/) {
> diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
> index c81b28fea..2ae0f948c 100644
> --- a/langs/de/cgi-bin/de.pl
> +++ b/langs/de/cgi-bin/de.pl
> @@ -1878,6 +1878,7 @@
>   'otherport' =3D> 'Anderer Port',
>   'our donors' =3D> 'Unsere Unterst=C3=BCtzer',
>   'out' =3D> 'Aus',
> +'outdated installation warning' =3D> 'Diese IPFire-Installation ist veralt=
et, was ein Sicherheitsrisiko darstellt. Bitte aktualisieren Sie das System s=
chnellstm=C3=B6glich.',
>   'outgoing' =3D> 'ausgehend',
>   'outgoing compression in bytes per second' =3D> 'Abgehende Kompression',
>   'outgoing firewall' =3D> 'Ausgehende Firewall',
> diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
> index 2f7038fb1..8d1eb3e2d 100644
> --- a/langs/en/cgi-bin/en.pl
> +++ b/langs/en/cgi-bin/en.pl
> @@ -1914,6 +1914,7 @@
>   'otherport' =3D> 'other Port',
>   'our donors' =3D> 'Our donors',
>   'out' =3D> 'Out',
> +'outdated installation warning' =3D> 'This IPFire installation is outdated=
, which is a security risk. Please check for and install updates as soon as p=
ossible.',
>   'outgoing' =3D> 'outgoing',
>   'outgoing compression in bytes per second' =3D> 'Outgoing compression',
>   'outgoing firewall' =3D> 'Outgoing Firewall',

--===============1829053133575136866==--