Prevent Master PDF Editor from accessing internet on Linux Mint via Firejail

Amith WG | Nov 29, 2024 min read

What is Firejail

Firejail is a lightweight sandbox program that lets you create a controlled space where applications run with limited permissions, keeping your system safer by restricting what they can do. For our usecase, it will come in handy as we can sandbox Master PDF Editor primiraily to block internet access (among other things).

Installing Firejail on Linux Mint

We can install firejail by simply running sudo apt update && sudo apt install firejail -y, BUT it is strongly recommended to install it from the PPA.

See: https://github.com/netblue30/firejail?tab=readme-ov-file#ubuntu

sudo add-apt-repository ppa:deki/firejail
sudo apt-get update
sudo apt-get install firejail firejail-profiles

Setting Up Firejail Profiles

After installing Firejail on our Linux Mint system, it’s time to set up Firejail so that it will block internet access to Master PDF Editor. We can do that by creating a profile for Master PDF in /etc/firejail.

However, by default, firejail already comes with profiles for well-known programs including Master PDF Editor. You can check the existing list of profiles for Master PDF Editor by running the command:

ls /etc/firejail | grep masterpdfeditor

result of the command ls /etc/firejail | grep masterpdfeditor

Do note that profiles here aren’t persistent; meaning, profiles will be overwritten after every install/update. To make our profile persistent, we need to make a .local version of the profile.

Note: I will be using the masterpdfeditor5.profile since that’s the version I have installed in my system.

sudo nano /etc/firejail/masterpdfeditor5.local

and add the followig:

# Whitelist access files and directories (optional, but recommended)

noblacklist "${HOME}/.config/Code Industry/Master PDF Editor 5.conf"
noblacklist ${HOME}/Documents
noblacklist ${HOME}/Downloads

# Block Internet access
net none

Firejail is now successfully set up to block internet access to Master PDF Editor.

Setting Master PDF Editor to always start with Firejail

To set Master PDF Editor to always launch with Firejail from the menu on Linux Mint, we need to modify its desktop entry to ensure it runs with Firejail by default.

The desktop entries for applications are typically stored in /usr/share/applications/ and ~/.local/share/applications/.

Let’s locate and modify these entries:

sudo nano /usr/share/applications/masterpdfeditor5.desktop

Find the Exec line. It will look something like this:

Exec=/opt/master-pdf-editor-5/masterpdfeditor5

Change it to:

Exec=/usr/bin/firejail /opt/master-pdf-editor-5/masterpdfeditor5

result after changing /usr/share/applications/masterpdfeditor5.desktop

Do the same with ~/.local/share/applications/masterpdfeditor5.desktop

nano ~/.local/share/applications/masterpdfeditor5.desktop

result after changing /usr/share/applications/masterpdfeditor5.desktop

That’s it. You are now successfully blocking Master PDF Editor from accessing internet! Hope you find it helpful. Thanks for reading! 😊