I’ve done a lot of the work and packaged the proprietary azure VPN from the deb file they provide for Ubuntu. But now I’ve hit a roadblock.
I can successfully authorize myself, but then I get a certificate error. I suspect that is, because I can’t select a certificate here:
The dropdown is empty, and I cannot open it, this is what it looks like on Ubuntu:
So I’ve tried all sorts of things, but I suspect the issue might be, that NixOS doesn’t populate all the certificates at /etc/ssl/certs
, but only a bundle. I did an strace:
strace -f -e trace=open,openat,stat,stat64 ./result/bin/microsoft-azurevpnclient > strace.log 2>&1
And found that the program seems to be accessing the certificate directory:
[pid 28889] openat(AT_FDCWD, "/etc/ssl/certs/", O_RDONLY|O_DIRECTORY) = 24
I found that the cacert
package has an unbundled
output. And I’ve tried supplying that to the NixOS configuration, just to get it to run. I’ve even ended up deleting all the contents of the directory, and doing:
environment.etc."ssl/certs".source = "${pkgs.cacert.unbundled}/etc/ssl/certs/*";
Not even that helped… Does anyone have an idea what might be happening here?
Here is my derivation, don't make too much fun of it :smiley:
{
lib,
stdenv,
fetchurl,
dpkg,
autoPatchelfHook,
makeWrapper,
openssl,
gtk3,
libsecret,
cairo,
nss,
nspr,
libuuid,
at-spi2-core,
libdrm,
mesa,
gtk2,
glib,
pango,
atk,
curl,
zenity,
cacert,
openvpn,
# libxcb,
# cairo-xcb,
# libX11,
# libXcomposite,
# libXdamage,
# libXext,
# libXfixes,
# libXrandr,
# libxkbcommon,
# libxshmfence,
}:
stdenv.mkDerivation rec {
pname = "microsoft-azurevpnclient";
version = "3.0.0";
src = fetchurl {
url = "https://packages.microsoft.com/ubuntu/22.04/prod/pool/main/m/microsoft-azurevpnclient/microsoft-azurevpnclient_${version}_amd64.deb";
hash = "sha256-nl02BDPR03TZoQUbspplED6BynTr6qNRVdHw6fyUV3s=";
};
runtimeDependencies = [ zenity ];
nativeBuildInputs = [
dpkg
autoPatchelfHook
makeWrapper
];
buildInputs = [
zenity
openssl
gtk3
libsecret
cairo
# libxcb
nss
nspr
libuuid
stdenv.cc.cc.lib
at-spi2-core
libdrm
mesa
gtk2
glib
pango
atk
curl
cacert # Add this
openvpn
# cairo-xcb
# libX11
# libXcomposite
# libXdamage
# libXext
# libXfixes
# libXrandr
# libxkbcommon
# libxshmfence
];
unpackPhase = ''
dpkg-deb -x $src .
'';
# addAutoPatchelfSearchPath ${jre8}/lib/openjdk/jre/lib/
# preBuild = ''
# addAutoPatchelfSearchPath opt/microsoft/microsoft-azurevpnclient/lib
# '';
# runtimeDependencies = [ "$out/lib" ];
installPhase = ''
mkdir -p $out
cp -r opt $out
cp -r usr/* $out
mkdir -p $out/bin
ln -s $out/opt/microsoft/microsoft-azurevpnclient/microsoft-azurevpnclient $out/bin/microsoft-azurevpnclient
ln -s $out/opt/microsoft/microsoft-azurevpnclient/lib $out
wrapProgram $out/bin/microsoft-azurevpnclient \
--prefix PATH : "${openvpn}/bin" \
--prefix PATH : "${zenity}/bin" \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} \
--prefix LD_LIBRARY_PATH : "$out/lib"
# TODO:
# Fix desktop file location
# mkdir -p $out/share/applications
# mv $out/share/applications/azurevpnclient.desktop $out/share/applications/
'';
meta = {
description = "Microsoft Azure VPN Client";
homepage = "https://azure.microsoft.com/en-us/services/vpn-gateway/";
# TODO:
# license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = [ ];
};
}
Here some additional information that might be less important:
The error I get when trying to connect “without” a certificate selected:
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8547] No cert verification callback from client
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8547] Invalid certificate data at index 0
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8547] Verification result for certificate chain: 0
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8547] [Primary] OPENVPNFRAMING: OpenVpnFraming hit error processing packet, initiating teardown of tunnel error: 610970100000012 from tls_openssl_common.cpp line 151, facility MobileAccess with detail: Root cert validation failed
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8547] OPENVPNBUILDER:Terminating datapath connection as tcp connection is terminated.
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8547] [Primary] OPENVPNCONNECTIONSTATE: Changing state to failed
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8547] Adding Control path state change event
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8383] OPENVPNBUILDER:Connection Failed! Last OpenVpnSessionState: 0
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8547] Xpoll fds destroyed
Feb 14 18:11:29 callisto AzureVPNClient[8262]: TId:[8547] [Primary] FDTRANSPORT: OS closed
This seems to be only the start of a longer error chain, though, I can provide more if it’s interesting.
Microsoft specifically states on their website, that this dropdown should not be left empty, that’s why I’m pursuing this:
View the connection profile information. Change the Certificate Information value to show the default DigiCert_Global_Root G2.pem or DigiCert_Global_Root_CA.pem. Don’t leave blank.