Skip to content

Commit 4cd0c68

Browse files
committed
Specify supports-safe-private-file-access=true and update build
1 parent ddd01c4 commit 4cd0c68

File tree

5 files changed

+23
-30
lines changed

5 files changed

+23
-30
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# NetworkManager-anyconnect
22

3-
NetworkManager-anyconnect is a VPN plugin for NetworkManager. It extends NetworkManager in a similar way to [other VPN plugins](https://wiki.gnome.org/Projects/NetworkManager/VPN) and provides a wrapper to the proprietary Cisco AnyConnect VPN client.
3+
NetworkManager-anyconnect is a VPN plugin for NetworkManager. It extends NetworkManager in a similar way to [other VPN plugins](https://wiki.gnome.org/Projects/NetworkManager/VPN) and provides a wrapper to the proprietary Cisco AnyConnect VPN client.
44

55
## Usage
66

7-
Since NetworkManager-anyconnect provides a wrapper around the AnyConnect client, you should ensure that you can first connect via AnyConnect. Set up your certificates and connection using the proprietary client and test your connection. Once successfully set up and with NetworkManager-anyconnect installed on your system, you should see a `Cisco AnyConnect` option when adding a new VPN connection. Select this option to configure your VPN and you will be presented with the configuration screen (shown below). Configuration is very simple, since you have your certificates set up already you just need to choose the VPN gateway to connect to from the drop down list and give your VPN connection a name.
7+
Since NetworkManager-anyconnect provides a wrapper around the AnyConnect client, you should ensure that you can first connect via AnyConnect. Set up your certificates and connection using the proprietary client and test your connection. Once successfully set up and with NetworkManager-anyconnect installed on your system, you should see a `Cisco AnyConnect` option when adding a new VPN connection. Select this option to configure your VPN and you will be presented with the configuration screen (shown below). Configuration is very simple, since you have your certificates set up already you just need to choose the VPN gateway to connect to from the drop down list and give your VPN connection a name.
88

99
![AnyConnect Configuration](https://user-images.githubusercontent.com/1632332/86220337-5e8ea680-bb7b-11ea-93c7-a95dfa3340f1.png "AnyConnect Configuration")
1010

1111
### Known Issue and Work Around
1212

1313
Whether you hit this problem will depend on two things being true:
14+
1415
1. Your AnyConnect gateway needs to be configured to require downloading data to VPN clients
1516
2. Your NetworkManager must be started by systemd using `ProtectHome=read-only`
1617

17-
As outlined in the [AnyConnect Manual](https://www.cisco.com/c/en/us/td/docs/security/vpn_client/anyconnect/anyconnect48/administration/guide/b_AnyConnect_Administrator_Guide_4-8.pdf), certificates must live in the `~/.cisco/` directory. Similarly, AnyConnect may download data from the VPN server during the connection attempt and if so, this downloaded data is also written to the `~/.cisco/` directory. However, in many Linux distributions the NetworkManager service is started with read-only access to the entire `/home` directory structure using the `ProtectHome=read-only` [configuration from systemd](https://www.freedesktop.org/software/systemd/man/systemd.exec.html). In these cases where AnyConnect needs to write to `~/.cisco/` but cannot, the connection attempt will fail.
18+
As outlined in the [AnyConnect Manual](https://www.cisco.com/c/en/us/td/docs/security/vpn_client/anyconnect/anyconnect48/administration/guide/b_AnyConnect_Administrator_Guide_4-8.pdf), certificates must live in the `~/.cisco/` directory. Similarly, AnyConnect may download data from the VPN server during the connection attempt and if so, this downloaded data is also written to the `~/.cisco/` directory. However, in many Linux distributions the NetworkManager service is started with read-only access to the entire `/home` directory structure using the `ProtectHome=read-only` [configuration from systemd](https://www.freedesktop.org/software/systemd/man/systemd.exec.html). In these cases where AnyConnect needs to write to `~/.cisco/` but cannot, the connection attempt will fail.
1819

19-
The work-around for this issue is to move your certificates elsewhere within your home directory and create a `~/.cisco` directory in another branch of the file system that is writeable to your user id. This can be achieved using the `/var/tmp/` directory using the following commands that should be run under your own user ID (not root) as an example:
20+
The work-around for this issue is to move your certificates elsewhere within your home directory and create a `~/.cisco` directory in another branch of the file system that is writeable to your user id. This can be achieved using the `/var/tmp/` directory using the following commands that should be run under your own user ID (not root) as an example:
2021

2122
```shell
2223
mv ~/.cisco ~/.cisco2
@@ -26,20 +27,21 @@ ln -s ~/.cisco2/certificates /var/tmp/${USER}-cisco
2627
```
2728

2829
The above commands:
30+
2931
1. move your `~/.cisco/` directory out of the way so it can be replaced with a symbolic link
3032
2. create a new directory that will be writeable to NetworkManager sub-processes
3133
3. link the writeable directory from your `~/.cisco/` directory
3234
4. keep your certificates in your home directory and link those to the writeable directory (they will remain read-only)
3335

34-
The `/var/tmp/` directory is recommended for this work-around since it is considered more persistent than `/tmp/`. However, you may find that the sub-directory you created there is wiped out from time to time so you may want to set something up perhaps with a systemd timer or cron to make sure the directory remains in place for when you need it for your VPN connections.
36+
The `/var/tmp/` directory is recommended for this work-around since it is considered more persistent than `/tmp/`. However, you may find that the sub-directory you created there is wiped out from time to time so you may want to set something up perhaps with a systemd timer or cron to make sure the directory remains in place for when you need it for your VPN connections.
3537

3638
## Building
3739

38-
You will need gcc and the GNU autotools installed on your build system. There is a `autogen.sh` script you can use to generate the required build files. Then it's the standard configure and make script you'd expect. The `autogen.sh` script is set to run the configure script but you may choose to reconfigure the build. An example is shown below:
40+
You will need gcc and the GNU autotools installed on your build system. There is a `autogen.sh` script you can use to generate the required build files. Then it's the standard configure and make script you'd expect. The `autogen.sh` script is set to run the configure script but you may choose to reconfigure the build. An example is shown below:
3941

4042
```shell
4143
cd NetworkManager-anyconnect
42-
meson builddir
44+
meson setup builddir
4345
cd builddir
4446
ninja
4547
sudo ninja install
@@ -55,7 +57,7 @@ meson builddir
5557
cd builddir
5658
meson dist
5759
rpmbuild -bs --define "_sourcedir meson-dist" NetworkManager-anyconnect.spec --define "_srcrpmdir ." --undefine dist
58-
mock --arch=x86_64 --resultdir="mock/NetworkManager-anyconnect-1.2.3-1" NetworkManager-anyconnect-1.2.3-1.src.rpm
60+
mock --arch=x86_64 --resultdir="mock/NetworkManager-anyconnect-1.2.4-1" NetworkManager-anyconnect-1.2.4-1.src.rpm
5961
```
6062

6163
Note 1: the `meson dist` command will only build a tar file from the currently committed code i.e. if you have local changes these will **not** be added to the build.
@@ -71,5 +73,5 @@ Since the SELinux policy isn't required on all machines where NetworkManager-any
7173
```shell
7274
cd NetworkManager-anyconnect/rpm/selinux/
7375
rpmbuild -bs --define "_sourcedir ." NetworkManager-anyconnect-selinux.spec --define "_srcrpmdir ." --undefine dist
74-
mock --arch=x86_64 --resultdir="mock/NetworkManager-anyconnect-selinux-1.0.0-1" NetworkManager-anyconnect-selinux-1.0.0-1.src.rpm
76+
mock --arch=x86_64 --resultdir="mock/NetworkManager-anyconnect-selinux-1.0.0-2" NetworkManager-anyconnect-selinux-1.0.0-2.src.rpm
7577
```

meson.build

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project('NetworkManager-anyconnect', 'c',
22
license : 'GPL2',
3-
version : '1.2.3',
3+
version : '1.2.4',
44
default_options: ['warning_level=2']
55
)
66

@@ -186,24 +186,10 @@ asresources = gnome.compile_resources(
186186
c_name : 'as')
187187

188188
# glib-compile-resources
189-
glib_resources_path = join_paths(meson.build_root(), 'properties/')
190-
r = run_command('mkdir', glib_resources_path)
191-
if r.returncode() != 0
192-
message('Could not compile glib resources:')
193-
message(r.stderr().strip())
194-
endif
195-
196-
r = run_command('glib-compile-resources', '--target', join_paths(glib_resources_path, 'resources.h'), '--sourcedir=properties/', '--generate-header', 'properties/gresource.xml')
197-
if r.returncode() != 0
198-
message('Could not compile glib resources:')
199-
error(r.stderr().strip())
200-
endif
201-
202-
r = run_command('glib-compile-resources', '--target', join_paths(glib_resources_path, 'resources.c'), '--sourcedir=properties/', '--generate-source', 'properties/gresource.xml')
203-
if r.returncode() != 0
204-
message('Could not compile glib resources:')
205-
error(r.stderr().strip())
206-
endif
189+
glib_resources_path = join_paths(meson.project_build_root(), 'properties/')
190+
r = run_command('mkdir', glib_resources_path, check: true)
191+
r = run_command('glib-compile-resources', '--target', join_paths(glib_resources_path, 'resources.h'), '--sourcedir=properties/', '--generate-header', 'properties/gresource.xml', check: true)
192+
r = run_command('glib-compile-resources', '--target', join_paths(glib_resources_path, 'resources.c'), '--sourcedir=properties/', '--generate-source', 'properties/gresource.xml', check: true)
207193

208194
# Generate appdata
209195
conf_nm_service = configuration_data()

nm-anyconnect-service.name.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name=anyconnect
33
service=org.freedesktop.NetworkManager.anyconnect
44
program=@LIBEXECDIR@/nm-anyconnect-service
55
supports-multiple-connections=true
6+
supports-safe-private-file-access=true
67

78
[libnm]
89
plugin=libnm-vpn-plugin-anyconnect.so

po/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ i18n.gettext(
1414
meson.project_name(),
1515
args: [
1616
'--add-comments=TRANSLATORS:',
17-
'--directory=@0@'.format(meson.source_root()),
18-
'--directory=@0@'.format(meson.build_root()),
17+
'--directory=@0@'.format(meson.project_source_root()),
18+
'--directory=@0@'.format(meson.project_build_root()),
1919
'--files-from=@0@'.format(meson.current_build_dir() / 'POTFILES'),
2020
'--package-version=@0@'.format(meson.project_version()),
2121
'--sort-output',

rpm/NetworkManager-anyconnect.spec.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ the anyconnect server with NetworkManager (GNOME files).
8686
%endif
8787

8888
%changelog
89+
* Fri Dec 12 2025 Graham White - 1.2.4-1
90+
- Update the build
91+
- Specify supports-safe-private-file-access=true
92+
8993
* Fri Feb 12 2021 Graham White - 1.2.3-1
9094
- Add SELinux policy (required for permission fix script)
9195
- Add notifications using libnotify

0 commit comments

Comments
 (0)