Skip to main content

Automatic Updates

via BitNinja Reliable Autoupdate

As of the release of BitNinja 3.10.23, we introduced the BitNinja Reliable Autoupdate package, which checks for a BitNinja Agent update every 6 hours.

Config Location: /var/lib/bitninja-reliable-auto-update/main.json

Default main.json Config:

{
"apiUrl": "api.bitninja.io:443",
"etcDir": "/etc/bitninja",
"periodicUpdate": 6,
"varDir": "/var/lib/bitninja-reliable-auto-update",
"versionType": "Stable"
}

Currently only working setting you are able to change (which has any effect) is the periodicUpdate. This setting allows you to change how often (in hours) you would like to check for updates.

Disabling Automatic Updates

If you wish to disable the Auto Updates, you may set periodicUpdate value to 0.

Once this change is done and you saved the file, you will need to restart BitNinja's Reliable Auto-Update service.

This can be achieved by running the following command: service bitninja-reliable-auto-update restart

The service will still be in the background, but you will no longer look or update for new BitNinja Agents automatically.

Enabling auto-updates for BitNinja is also possible with package managers, which depending on your Linux distribution you can setup with the steps below.

via Unattended Updates

RHEL/CentOS/CloudLinux

Using Yum-Curl - RHEL7 / CentOS 7

  1. Install Dependencies

sudo yum install yum-cron

  1. Edit the file.

sudo nano /etc/yum/yum-cron.conf

# Update packages automatically
update_cmd = default

# Apply security updates only
apply_updates = yes

# Send email notifications
emit_via = email
email_from = root@yourdomain.com
email_to = your-email@example.com
  1. Start and Enable Yum cron on boot.

sudo systemctl start yum-cron

sudo systemctl enable yum-cron


Using DNF - RHEL8+ / CentOS 8+

  1. Install dependencies

sudo yum install dnf-automatic

  1. Edit the file.

nano /etc/dnf/automatic.conf

download_updates = yes
apply_updates = no

sudo systemctl enable --now dnf-automatic.timer

Debian/Ubuntu

  1. Install Dependencies

sudo apt-get update

sudo apt-get install unattended-upgrades

  1. Edit the file.

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

Add BitNinja like this:

Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}";
"${distro_id}:${distro_codename}-security";
// Extended Security Maintenance; doesn't necessarily exist for
// every release and this system may not have it installed, but if
// available, the policy for updates is such that unattended-upgrades
// should also install from here by default.
"${distro_id}ESMApps:${distro_codename}-apps-security";
"${distro_id}ESM:${distro_codename}-infra-security";
// "${distro_id}:${distro_codename}-updates";
// "${distro_id}:${distro_codename}-proposed";
// "${distro_id}:${distro_codename}-backports";
// Bitninja Repository
"bitninja:${distro_codename}";
};
info

You can remove the rest and keep BitNinja, if you want to only autoupdate BitNinja itself and leave the OS's Security Updates, although this is isn't recommended.

  1. Save the changes and Restart the SystemD process.

sudo systemctl restart unattended-upgrades

Enjoy automatic updates for BitNinja!