Skip to content

Commit f18bc31

Browse files
committed
feat(2fa): Enable 2FA token request proxying
Enables qctap-proxy in chrome VM, using givc to forward requests to gui VM which owns the authentication tokens.
1 parent 93eb002 commit f18bc31

File tree

5 files changed

+55
-18
lines changed

5 files changed

+55
-18
lines changed

flake.lock

Lines changed: 15 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@
8282

8383
# A set of useful nix packages and utilities for ghaf
8484
ghafpkgs = {
85-
#url = "github:tiiuae/ghafpkgs?ref=pull/142/head";
86-
url = "github:tiiuae/ghafpkgs";
85+
url = "github:slakkala/ghafpkgs/qubes-ctap";
8786
inputs = {
8887
nixpkgs.follows = "nixpkgs";
8988
flake-parts.follows = "flake-parts";
@@ -106,7 +105,7 @@
106105

107106
# Ghaf Inter VM communication and control library
108107
givc = {
109-
url = "github:tiiuae/ghaf-givc";
108+
url = "github:slakkala/ghaf-givc/dev/ctap";
110109
inputs = {
111110
nixpkgs.follows = "nixpkgs";
112111
flake-parts.follows = "flake-parts";

modules/common/services/yubikey.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ in
3535
config = mkIf cfg.enable {
3636
# Enable service and package for Yubikey
3737
services.pcscd.enable = true;
38-
environment.systemPackages = [ pkgs.pam_u2f ];
38+
environment.systemPackages = [
39+
pkgs.pam_u2f
40+
pkgs.qubes-ctap
41+
];
3942

4043
security.pam.services = {
4144
sudo.u2fAuth = true;

modules/givc/guivm.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ in
4141
admin = lib.head config.ghaf.givc.adminConfig.addresses;
4242
tls.enable = config.ghaf.givc.enableTls;
4343
enableUserTlsAccess = true;
44+
enableExecModule = true;
4445
notifier.enable = true;
4546
socketProxy =
4647
lib.optionals (builtins.elem netvmName config.ghaf.common.vms) [
@@ -86,6 +87,9 @@ in
8687
}
8788
];
8889
};
90+
systemd.services.givc-gui-vm = {
91+
path = [ pkgs.qubes-ctap ];
92+
};
8993
systemd.services.dbus-proxy-networkmanager = {
9094
description = "DBus proxy for Network Manager ${guivmName}";
9195
serviceConfig = {

modules/reference/appvms/google-chrome.nix

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,22 @@
77
config,
88
...
99
}:
10+
let
11+
qrexec = pkgs.writeShellApplication {
12+
name = "qrexec-client-vm";
13+
runtimeInputs = [ pkgs.givc-cli ];
14+
text = ''
15+
shift
16+
exec givc-cli ${config.ghaf.givc.cliArgs} ctap "$@"
17+
'';
18+
};
19+
in
1020
{
1121
chrome = {
12-
packages = lib.optional config.ghaf.development.debug.tools.enable pkgs.alsa-utils;
22+
packages = lib.optional config.ghaf.development.debug.tools.enable pkgs.alsa-utils ++ [
23+
pkgs.qubes-ctap
24+
qrexec
25+
];
1326
ramMb = 6144;
1427
cores = 4;
1528
borderColor = "#9C0000";
@@ -114,6 +127,22 @@
114127
]);
115128
extraModules = [
116129
{
130+
services.udev.extraRules = ''
131+
ACTION=="remove", GOTO="qctap_hidraw_end"
132+
SUBSYSTEM=="hidraw", MODE="0660", GROUP="users"
133+
LABEL="qctap_hidraw_end"
134+
'';
135+
systemd.services.ctapproxy = {
136+
enable = true;
137+
description = "CTAP Proxy";
138+
serviceConfig = {
139+
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p /var/log/qubes";
140+
ExecStart = "${pkgs.qubes-ctap}/bin/qctap-proxy --qrexec ${qrexec}/bin/qrexec-client-vm dummy";
141+
Type = "notify";
142+
KillMode = "process";
143+
};
144+
wantedBy = [ "multi-user.target" ];
145+
};
117146
microvm.devices = [ ];
118147
imports = [
119148
../services/wireguard-gui/wireguard-gui.nix

0 commit comments

Comments
 (0)