Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    System Patches package version 2.2.5

    Scheduled Pinned Locked Moved pfSense Packages
    17 Posts 8 Posters 3.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Bob.DigB
      Bob.Dig LAYER 8 @JonathanLee
      last edited by

      @JonathanLee Here it was.

      1 Reply Last reply Reply Quote 0
      • GertjanG
        Gertjan @JonathanLee
        last edited by Gertjan

        @JonathanLee said in System Patches package version 2.2.5:

        I was wondering if anyone else has this yet

        Can't miss it.

        If a package gets available, I'll get a Phone popup right away :

        Notifications in this message: 1
        ================================
        07:01:06 The following updates are available and can be installed using System > Package Manager:
        
        System_Patches: 2.2.5 ==> 2.2.6
        
        Some packages are part of the base system and will not show up in Package Manager. If any such updates are listed below, run `pkg upgrade` from the shell to install them:
        
        pfSense-pkg-System_Patches: 2.2.5 -> 2.2.6 [pfSense]
        

        edit : Even non-pfSense-GUI packages, the classic FreeBSD packages for pfSense get notified this way.

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        Bob.DigB 1 Reply Last reply Reply Quote 0
        • Bob.DigB
          Bob.Dig LAYER 8 @Gertjan
          last edited by

          @Gertjan said in System Patches package version 2.2.5:

          If a package gets available, I'll get a Phone popup right away :

          Interesting, this is not in the pfSense-GUI.

          GertjanG 1 Reply Last reply Reply Quote 0
          • GertjanG
            Gertjan @Bob.Dig
            last edited by

            @Bob-Dig said in System Patches package version 2.2.5:

            this is not in the pfSense-GUI.

            Well ... it is.

            This list :

            53aecac8-ed87-462e-8600-a38141b30fbd-image.png

            is updates ones in while - several times a day.
            But you have to visit the GUI to be aware of it.

            There is a small shell (PHP) script somewhere in this part of the forum that executes 'when ever you want' (cron task) that mails you if there are candidates...

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            Bob.DigB 1 Reply Last reply Reply Quote 0
            • Bob.DigB
              Bob.Dig LAYER 8 @Gertjan
              last edited by

              @Gertjan said in System Patches package version 2.2.5:

              There is a small shell (PHP) script somewhere in this part of the forum that executes 'when ever you want' (cron task) that mails you if there are candidates...

              That is the part I meant.

              GertjanG 1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan @Bob.Dig
                last edited by

                @Bob-Dig

                Here :

                <?php
                
                  require_once("pkg-utils.inc");
                  require_once("notices.inc");
                  require_once("util.inc");
                
                  $msg = null;
                  $pmsg = null;
                  $p = 0;
                
                  // log_error("Starting update check");
                  //echo "test";
                  // pfSense base system check
                  $system_version = get_system_pkg_version(false, true);
                  if ($system_version === false) {
                    printf("%s\n", 'Unable to check for updates');
                    log_error("Unable to check for updates, exiting");
                    exit;
                  }
                
                  if (!is_array($system_version) ||
                    !isset($system_version['version']) ||
                    !isset($system_version['installed_version'])) {
                    printf("%s\n", 'Error in version information');
                    log_error("Error in version information, exiting");
                    exit;
                  }
                
                  switch ($system_version['pkg_version_compare']) {
                    case '<':
                      printf("%s%s%s\n", "pfSense version ", $system_version['version'], " is available");
                      $msg = "An update to pfSense version " . $system_version['version'] . " is available\n\n";
                      break;
                    case '=':
                      printf("%s%s%s\n", "pfSense version ", $system_version['version'], " (installed) is current");
                      break;
                    case '>':
                      printf("%s%s%s\n", "pfSense version ", $system_version['installed_version'], " is NEWER than the latest available version ", $system_version['version']);
                      $msg = "pfSense version " . $system_version['version'] . " is available (downgrade)\n\n";
                      break;
                    default:
                      printf("%s\n", 'Error comparing installed with latest version available');
                      log_error("Error comparing installed with latest version available");
                      break;
                  }
                
                  // package check
                  $package_list = get_pkg_info('all', true, true);
                  $installed_packages = array_filter($package_list, function($v) {
                    return (isset($v['installed']) && isset($v['name']));
                  });
                
                  if (empty($installed_packages)) {
                    printf("%s\n", 'No packages installed');
                    log_error("No packages installed, exiting");
                    exit;
                  }
                
                  foreach ($installed_packages as $pkg) {
                    if (isset($pkg['installed_version']) && isset($pkg['version'])) {
                      //printf("%s%s%s\n", $pkg['shortname'], ': ', $pkg['installed_version']);
                      $version_compare = pkg_version_compare($pkg['installed_version'], $pkg['version']);
                      if ($version_compare != '=') {
                        $p++;
                        $pmsg .= "\n".$pkg['shortname'].': '.$pkg['installed_version'].' ==> '.$pkg['version'];
                        if ($version_compare == '>') {
                          $pmsg .= ' (downgrade)';
                        }
                        printf("%s%s%s%s%s\n", $pkg['shortname'], ': ', $pkg['installed_version'], ' ==> ', $pkg['version']);
                      }
                    }
                  }
                
                  if ($p > 0) {
                    $msg = $msg . "The following updates are available and can be installed using System > Package Manager:\n" . $pmsg;
                  }
                
                  // check for updates to builtin packages
                  exec("/usr/sbin/pkg upgrade -n | /usr/bin/sed -ne '/UPGRADED/,/^$/p'", $output, $retval);
                  if (($retval == 0) && (count($output))) {
                    $msg .= "\n\n" . "Some packages are part of the base system and will not show up in Package Manager. If any such updates are listed below, run `pkg upgrade` from the shell to install them:\n\n";
                    array_shift($output);
                    $msg .= implode("\n", array_map('ltrim', $output));
                  }
                
                  if (!empty($msg)) {
                    log_error("Updates were found - sending email");
                    echo $msg;
                    notify_via_smtp($msg);
                  }
                
                //  log_error("Update check complete");
                

                call it / chmod it :

                -rwxr-xr-x  1 root  wheel  3325 Jan 20  2023 /root/pkg_check.php
                

                Cron it :

                730ba71a-6a50-4a38-88b5-0d73b896a125-image.png

                About the last line in the scrip :

                notify_via_smtp($msg);
                

                That's because my notify system has been set up using smtp. Nothing else.

                Type :

                cat /etc/inc/notices.inc
                

                and look at the end.
                Pick whatever you prefer, or go "all out" with

                notify_all_remote($msg)
                

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 3
                • D
                  DBMandrake @jimp
                  last edited by

                  @jimp Does the patch for (Redmine #14545) also include the fix in the patch for (Redmine #14517) given that the two patches conflict and can't be applied at the same time ? Or do we have to choose one or the other ?

                  jimpJ 1 Reply Last reply Reply Quote 1
                  • jimpJ
                    jimp Rebel Alliance Developer Netgate @JonathanLee
                    last edited by jimp

                    @JonathanLee said in System Patches package version 2.2.5:

                    I was able to do a pkg update and install a new patch update for certificates issues. I was wondering if anyone else has this yet as it did not show up as a full update form package manage as of 8/7/23

                    It shows up as a package update for me here. I checked Plus amd64 and arm instances of 23.05.1, and CE instance of 2.7.0, and they all show it:

                    bbb098cf-9d48-449e-a0b2-96e7d7718867-image.png

                    EDIT: It's also worth noting that if you are running dev snapshots (Plus 23.09, CE 2.8.0) then the patches are unnecessary as they are a part of the dev builds, so they will come in when they get built overnight. No recommended patches entries will show for those versions either since they already have all the latest code.

                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 1
                    • jimpJ
                      jimp Rebel Alliance Developer Netgate @DBMandrake
                      last edited by

                      @DBMandrake said in System Patches package version 2.2.5:

                      @jimp Does the patch for (Redmine #14545) also include the fix in the patch for (Redmine #14517) given that the two patches conflict and can't be applied at the same time ? Or do we have to choose one or the other ?

                      They do not conflict, one depends on the other.

                      Since they depend on each other, you have to apply them in the correct order (top down) or revert them in the correct order (bottom up) which is why they are placed how they are in the list.

                      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                      Need help fast? Netgate Global Support!

                      Do not Chat/PM for help!

                      1 Reply Last reply Reply Quote 1
                      • jimpJ jimp unpinned this topic on
                      • jimpJ
                        jimp Rebel Alliance Developer Netgate
                        last edited by

                        Any further questions about the change in 2.2.6 should go over in the new thread:

                        https://forum.netgate.com/topic/182725/system-patches-package-version-2-2-6

                        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                        Need help fast? Netgate Global Support!

                        Do not Chat/PM for help!

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.