Skip to content

Commit ea344c2

Browse files
committed
Merge branch 'ubuntu-add-apparmor-profile'
2 parents 72be78c + 0a04a28 commit ea344c2

File tree

5 files changed

+36
-0
lines changed

5 files changed

+36
-0
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Line wrap the file at 100 chars. Th
2525
### Added
2626
- Add custom bridge settings in GUI.
2727

28+
### Fixed
29+
#### Linux
30+
- Fix GUI not working on Ubuntu 24.04 by adding an AppArmor profile.
31+
2832

2933
## [2024.2] - 2024-04-29
3034
### Fixed

Diff for: dist-assets/linux/after-install.sh

+17
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,20 @@ chmod u+s "/usr/bin/mullvad-exclude"
66
systemctl enable "/usr/lib/systemd/system/mullvad-daemon.service"
77
systemctl start mullvad-daemon.service || echo "Failed to start mullvad-daemon.service"
88
systemctl enable "/usr/lib/systemd/system/mullvad-early-boot-blocking.service"
9+
10+
# return 0 if version $1 is greater than or equal to $2
11+
function version_is_ge {
12+
[ "$1" = "$2" ] && return 0
13+
printf '%s\n' "$2" "$1" | sort -C -V
14+
}
15+
16+
# Ubuntu 24.04 or newer: Install apparmor profile to allow Electron sandbox to work
17+
# This disables user namespace restrictions
18+
os=$(grep -oP '^ID=\K.+' /etc/os-release | tr -d '"')
19+
version=$(grep -oP '^VERSION_ID=\K.+' /etc/os-release | tr -d '"')
20+
21+
if [[ "$os" == "ubuntu" ]] && version_is_ge "$version" "24.04"; then
22+
echo "Creating apparmor profile"
23+
cp /opt/Mullvad\ VPN/resources/apparmor_mullvad /etc/apparmor.d/mullvad
24+
apparmor_parser -r /etc/apparmor.d/mullvad || echo "Failed to reload apparmor profile"
25+
fi

Diff for: dist-assets/linux/after-remove.sh

+6
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,9 @@ esac
7474
# Different electron versions can have incompatible GPU caches. Clearing it on upgrades makes sure
7575
# the same cache is not used across versions.
7676
clear_gpu_cache
77+
78+
# Remove apparmor profile
79+
if apparmor_parser -R /etc/apparmor.d/mullvad &>/dev/null; then
80+
echo "Removing apparmor profile"
81+
rm -f /etc/apparmor.d/mullvad || echo "Failed to delete apparmor profile"
82+
fi

Diff for: dist-assets/linux/apparmor_mullvad

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
abi <abi/4.0>,
2+
include <tunables/global>
3+
4+
profile mullvad /opt/Mullvad\ VPN/mullvad-gui flags=(unconfined) {
5+
userns,
6+
# Site-specific additions and overrides. See local/README for details.
7+
include if exists <local/mullvad>
8+
}

Diff for: gui/tasks/distribution.js

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ const config = {
175175
{ from: distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-problem-report')), to: '.' },
176176
{ from: distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-setup')), to: '.' },
177177
{ from: distAssets(path.join(getLinuxTargetSubdir(), 'libtalpid_openvpn_plugin.so')), to: '.' },
178+
{ from: distAssets(path.join('linux', 'apparmor_mullvad')), to: '.' },
178179
{ from: distAssets(path.join('binaries', '${env.TARGET_TRIPLE}', 'openvpn')), to: '.' },
179180
],
180181
},

0 commit comments

Comments
 (0)