Auto-restarting engine after auto-update of opnsensi in OpnSense

Comments

2 comments

  • Official comment
    SVN Support Team

    Hi John,

    Thank you for your valuable feedback; it's greatly appreciated. Zenarmor does not automatically restart the engine to avoid network interruptions after an update and does not update the engine on its own. You'll need to perform updates manually and can arrange for the engine to restart post-update. Did you configure an automatic engine update via a script?

    However, the Zenconsole agent and Application DB do update automatically, and essential services restart automatically as well. Zenarmor updates can be managed in the cloud by registering Zenarmor with Zenconsole, allowing for remote updates.

    Please don't hesitate to reach out if you have any further questions.

     

     

    Comment actions Permalink
  • John Gordon

    Yes, I created a script to test if there's an update and restart the engine if there was. Then I added it to GUI cron menu. Running the script manually seems to work. Via the GUI I schedule the cron job to run at 3am every day. 

     

    (1) SCRIPT (saved as /usr/local/opnsense/scripts/restart_zenarmor_if_updated.sh made executable with chmod 755.

     

    #!/bin/sh

    CURRENT_VERSION=$(pkg info os-sensei | sed -n '1p' | cut -d'-' -f3)

    AVAILABLE_VERSION=$(pkg rquery '%v' os-sensei)

    if [ "$CURRENT_VERSION" = "$AVAILABLE_VERSION" ]; then

       echo "no restart necessary"

    else

       # os-sensei was updated so restart Zenarmor engine/service

       /usr/local/sbin/zenarmorctl engine restart

    fi

     

    (2) ADDED IT TO CRON JOB

    Created  /usr/local/opnsense/service/conf/actions.d/actions_zenrestart.conf containing these lines:

     

    [restart]

    command:/usr/local/opnsense/scripts/restart_zenarmor_if_updated.sh

    parameters:

    type:script

    message:restart zenarmor

    description:Restart Zenarmor Engine

     

    (3) ran service configd restart

    (4) went to the GUI cron and selected if from the menu and scheduled it.

     

    NOTE: used SSH as root. After finishing, I disabled SSH and root option, deleted the keypairs from client machines and the public key from opnsense's root user and disabled root user, etc. All from the LAN.

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk