③-在 Linux VDI 上启用设备重定向
liuian 2025-01-21 19:29 44 浏览
在日常使用过程中,您可能需要将不同类型的设备重定向到Ubuntu VDI。本次分享将向您展示如何准备用于设备重定向的 Ubuntu 主映像。
- USB设备
- 智能卡重定向
安装根CA证书
安装智能卡驱动程序
下载并编译PCSC
3.使用设备重定向重新安装 Horizon Agent。
设置C编译器(基本程序)
C 编译器对于设置设备重定向至关重要。许多驱动程序需要编译器进行设置。请按照以下步骤在 Ubuntu 上安装 GCC 编译器。
- 登录Ubuntu。
- 打开终端。
- 运行以下命令安装 C 编译器包。
- 须藤apt更新
- 须藤 apt install make
- sudo apt安装gcc
- sudo apt安装cmake
- 运行命令“ gcc --version ”。确保 Ubuntu 上安装了 GCC。
1.USB设备
要启用 USB 重定向,首先需要在 Ubuntu 上安装 VHCI 驱动程序。
驱动程序的源代码可以在以下链接中找到。
https://sourceforge.net/projects/usb-vhci/files/linux%20kernel%20module/
登录到 Ubuntu 桌面。下载最新的 Web 浏览器驱动程序并将其放置到 Ubuntu 桌面下载文件夹中。本次分享以vchi-hcd 1.15为例。
在设置驱动程序之前,您必须确定 Horizon Agent 软件包中包含的修补文件的路径。安装过程中将需要修补文件。
如果您按照我之前的帖子 ( https://www.tech-fellow.com/post/creating-full-clone-desktop-with-ubuntu#viewer-73imt )来设置 Horizon Agent,则该补丁应该位于类似~/Downloads/VMware-horizonagent-linux-x86_64-2111.1-8.4.0-19066680/resources/vhci/patch/vhci.patch之类的地方。/补丁/vhci.补丁。
- 登录Ubuntu。
- 打开终端。
- 运行以下命令集来安装驱动程序。
- cd ~/下载
- sudo tar -xzvf vhci-hcd-1.15.tar.gz
- cd vhci-hcd-1.15
- sudo patch -p1 < ~/Downloads/VMware-horizonagent-linux-x86_64-2111.1-8.4.0-19066680/resources/vhci/patch/vhci.patch
- 须藤清理
- 须藤使
- 须藤进行安装
** 请注意,如果您的 Linux 内核更改为新版本,则必须重新编译并重新安装 VHCI 驱动程序,但不需要重新安装 Horizon for Linux。为了避免这种情况,您还可以将动态内核模块支持 (DKMS) 添加到 VHCI 驱动程序,如下所示。
- cd ~/下载
- sudo apt install linux-headers-`uname -r`
- sudo apt install dkms
- sudo cp -r vhci-hcd-1.15 /usr/src/usb-vhci-hcd-1.15
- sudo touch /usr/src/usb-vhci-hcd-1.15/dkms.conf
- sudo nano /usr/src/usb-vhci-hcd-1.15/dkms.conf
将以下内容添加到 dkms.conf 文件中。
PACKAGE_NAME="usb-vhci-hcd"
PACKAGE_VERSION=1.15
MAKE_CMD_TMPL="使 KVERSION=$kernelver"
CLEAN="$MAKE_CMD_TMPL 清理"
BUILT_MODULE_NAME[0]="usb-vhci-iocifc"
DEST_MODULE_LOCATION[0]="/kernel/drivers/usb/host"
MAKE[0]="$MAKE_CMD_TMPL"
BUILT_MODULE_NAME[1]="usb-vhci-hcd"
DEST_MODULE_LOCATION[1]="/kernel/drivers/usb/host"
MAKE[1]="$MAKE_CMD_TMPL"
自动安装=“是”
通过以下命令在 dkms 中添加并构建此 VHCI 驱动程序。
- sudo dkms 添加 usb-vhci-hcd/1.15
- sudo dkms 构建 usb-vhci-hcd/1.15
- sudo dkms 安装 usb-vhci-hcd/1.15
下一步将使用相应的设置修改 VMware 配置文件。
- 通过命令“ sudo nano /etc/vmware/config编辑配置文件 ”编辑配置文件”。
- 在配置文件中添加一行“ 在配置文件中添加一行“ viewusb.IncludeFamily ”。
- 添加您允许重定向的设备系列。以下示例启用除键盘和鼠标之外的所有 HID USB 进行重定向。
- 按照上一节“使用设备重定向重新安装Horizon Agent ”中的过程重新安装 Horizon Agent。
*** 您可以使用相同的语法启用其他设备类型。以下是可供参考的器件系列的完整列表。
音频 | 任何音频输入或音频输出设备。 |
音频输入 | 音频输入设备,例如麦克风。 |
音频输出 | 音频输出设备,例如扬声器和耳机。 |
蓝牙 | 蓝牙连接设备。 |
通讯 | 通信设备,例如调制解调器和有线网络适配器。 |
隐藏 | 人机接口设备,不包括键盘和指点设备。 |
hid 可启动 | 启动时可用的人机界面设备,不包括键盘和指点设备。 |
成像 | 成像设备,例如扫描仪。 |
键盘 | 键盘设备。 |
老鼠 | 指点设备,例如鼠标。 |
其他 | 家庭未指定。 |
掌上电脑 | 个人数字助理。 |
身体的 | 力反馈设备,例如力反馈操纵杆。 |
打印机 | 打印设备。 |
安全 | 安全设备,例如指纹读取器。 |
智能卡 | 智能卡设备。 |
贮存 | 大容量存储设备,例如闪存驱动器和外部硬盘驱动器。 |
未知 | 家人不详。 |
小贩 | 具有供应商特定功能的设备。 |
视频 | 视频输入设备。 |
无线的 | 无线网络适配器。 |
乌斯巴 | 无线 USB 设备。 |
2. 智能卡重定向
如果要启用智能卡重定向,您需要按照以下步骤在Ubuntu上安装智能卡读卡器软件并进行相应配置。
要为运行 Ubuntu 的桌面设置智能卡方向,您应该首先将 Ubuntu 虚拟机与 Active Directory 域集成。
如果你还没有加入Ubuntu to AD,请关注下面的分享。
https://www.tech-fellow.com/post/join-ubuntu-linux-to-active-directory
2a.获取根CA证书
为智能卡服务安装根 CA 对于重定向发挥作用至关重要。为此,我们需要 AD 域的根证书。该根证书可以通过与AD域集成的MS CA服务器获取。
如果您的域中没有 CA 服务器,您可以参考 Microsoft 文档来设置 CA 服务器。
第一步将从 AD 域导出根 CA 证书。
- 登录到Microsoft CA 服务器。
- 打开命令提示符。
- 通过命令“ sudo certutil -ca.cert c:\Path_to_Store_File\ca_root.cer ”导出根证书。
- 将导出的根证书上传到 Ubuntu。
2b.安装根CA证书
接下来将返回 Ubuntu 主映像进行进一步配置。
- 登录Ubuntu。
- 打开终端。
- 将目录更改为存储根证书的路径。
- 通过命令安装所需的库:
- sudo apt-get install -y pcscd pcsc-tools pkg-config libpam-pkcs11 opensc libengine-pkcs11-openssl libnss3-tools
- 通过命令将其转换为PEM格式:
- sudo openssl x509 -inform der -in ./ca_root.cer -out ./ca_root.pem
- 通过以下命令初始化证书数据库。
- 须藤 mkdir /etc/pki/nssdb
- sudo certutil -A -d /etc/pki/nssdb -n "根 CA 证书" -t "CT,C,C" -i ./ca_root.pem
- 通过以下命令将根 CA 证书复制到/etc/pam_pkcs11/cacerts 目录。
- sudo mkdir -p /etc/pam_pkcs11/cacerts
- sudo cp ./ca_root.pem /etc/pam_pkcs11/cacerts
- 通过以下命令创建 pkcs11 哈希文件。
- 须藤 chmod a+r ./ca_root.pem
- 须藤 pkcs11_make_hash_link
- 通过命令“ sudo certutil -L -d /etc/pki/nssdb ”验证是否已成功加载所需的证书。
- 将显示类似的结果如下。
- 通过命令“ sudo modutil -dbdir /etc/pki/nssdb -list ”验证是否已成功添加所需的库。
- 将显示类似的结果如下。
PKCS #11模块列表
--------------------------------------------------- ----------
1. NSS 内部 PKCS #11模块
插槽:附有 2 个插槽
状态:已加载
插槽:NSS 内部加密服务
令牌:NSS 通用加密服务
slot:NSS 用户私钥和证书服务
令牌:NSS 证书数据库
--------------------------------------------------- ----------
2b.安装智能卡 PIV 驱动程序
为了支持智能卡的PIV功能,还需要添加PIV智能卡驱动程序。以下步骤以 Yubikey PIV 版本 2.3.0 为例。如果您使用不同的产品,您可以参考您的产品文档。
- 从 Yubikey 下载 PIV 驱动程序并将文件放入“下载”文件夹中。
https://developers.yubico.com/yubico-piv-tool/Releases/
- Open the Terminal.
- Run following commands to setup the PIV drivers
- cd ~/Downloads/
- sudo apt install cmake build-essential libssl-dev check gengetopt help2man libtool pkg-config libpcsclite-dev
- sudo tar -zxvf yubico-piv-tool-2.3.0.tar.gz
- cd yubico-piv-tool-2.3.0
- sudo mkdir build
- cd build
- sudo cmake ..
- sudo make
- sudo make install
2c. Adding PIV drivers to nssdb
After making the CA cert ready, next will be installing the smart card PIV drivers on Ubuntu. This sharing I am using Yubikey as an example.
First you need to copy the PIV driver files to /usr/lib/ by following commands.
- cd /usr/local/lib/
- sudo cp libykcs11.a /usr/lib/
- sudo cp libykcs11.so /usr/lib/
- sudo cp libykcs11.so.2 /usr/lib/
- sudo cp libykcs11.so.2.3.0 /usr/lib/
- sudo cp libykpiv.a /usr/lib/
- sudo cp libykpiv.so /usr/lib/
- sudo cp libykpiv.so.2 /usr/lib/
Then you can add the drivers to the nssdb.
- Change directory to the path storing the root cert. Run following commands.
- sudo cp /usr/local/lib/libykpiv.so /usr/lib/
- sudo certutil -N -d /etc/pki/nssdb
- sudo certutil -A -n rootca -i ca_root.pem -t "CT,CT,CT" -d /etc/pki/nssdb
- sudo modutil -dbdir /etc/pki/nssdb/ -add "piv card" -libfile /usr/lib/libykcs11.so
- Verify that the expected libraries are added successfully by command "sudo modutil -dbdir /etc/pki/nssdb -list".
- Similar result as follow will be shown.
Listing of PKCS #11 Modules
–-----------------------------------------------------------
1. NSS Internal PKCS #11 Module
slots: 2 slots attached
status: loaded
slot: NSS Internal Cryptographic Services
token: NSS Generic Crypto Services
slot: NSS User Private Key and Certificate Services
token: NSS Certificate DB
2. piv card 2.0
library name: /usr/lib/libcmP11.so
slots: There are no slots attached to this module
status: loaded
–-----------------------------------------------------------
2d. Configure pam_pkcs11 library
After applied the PIV library, there also have corresponding configuration on pam_pkcs11 library.
- Copy and create configuration file by command:
- sudo mkdir /etc/pam_pkcs11
- sudo cp /usr/share/doc/libpam-pkcs11/examples/pam_pkcs11.conf.example /etc/pam_pkcs11/pam_pkcs11.conf
- Edit the configuration file by command:
- sudo nano /etc/pam_pkcs11/pam_pkcs11.conf
- Edit the configuration file as shown in following:
use_pkcs11_module = mysc;
pkcs11_module mysc {
module = /usr/lib/libcmP11.so;
description = "LIBCMP11";
slot_num = 0;
ca_dir = /etc/pki/cacerts;
nss_dir = /etc/pki/nssdb;
cert_policy = ca;
}
...
use_mappers = cn, null;
...
mapper cn {
debug = false;
module = internal;
# module = /lib/pam_pkcs11/cn_mapper.so;
ignorecase = true;
mapfile = file:///etc/pam_pkcs11/cn_map;
# mapfile = "none";
}
- Edit the configuration file by command:
- sudo nano /etc/pam_pkcs11/cn_map
- Edit the configuration file as shown in following:
Common name -> Login ID
- Edit the configuration file by command:
- sudo nano /etc/pam.d/gdm-password
- Edit the configuration file as shown in following. Please place the pam_pkcs11.so authorization line before the common-auth line
#%PAM-1.0
auth requisite pam_nologin.so
auth required pam_succeed_if.so user != root quiet_success
auth sufficient pam_pkcs11.so
@include common-auth
auth optional pam_gnome_keyring.so
@include common-account
2e. Download and compile PCSC
The next step will be installing the smart card reader. The package and version must be exactly pcsclite 1.8.8. Other versions are not compatible with Horizon Agent
- Run following set of commands to instal the pcsc 1.8.8.
- cd ~/Downloads
- sudo apt-get install -y git autoconf automake libtool flex libudev-dev
- sudo git clone https://salsa.debian.org/rousseau/PCSC.git
- cd PCSC/
- sudo git checkout -b pcsc-1.8.8 1.8.8
- sudo ./bootstrap
- sudo ./configure --prefix=/usr --sysconfdir=/etc --libdir=/lib/x86_64-linux-gnu/ CFLAGS="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security" LIBS="-ldl" LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro" CPPFLAGS="-Wdate-time -D_FORTIFY_SOURCE=2"
- sudo make
- sudo make install
- Run command "sudo systemctl enable pcscd.service".
- Test the installation by command "sudo pcsc_scan".
- Similar result as follow will be shown.
- Reinstall Horizon Agent with procedure on last section "Reinstall Horizon Agent with Device Redirection".
3. Reinstall Horizon Agent with Device Redirection.
At last, you will have to reinstall the Horizon Agent with device redirection enabled.
- Refer the Horizon agent installation sharing (https://www.tech-fellow.com/post/creating-full-clone-desktop-with-ubuntu#viewer-73imt) But replace the Horizon Agent installation command with following parameters.
"sudo ./install_viewagent.sh -m yes -U yes -A yes".
Following table is the most common parameters to enable different features on Horizon Linux VDI.
Full details of parameter can be found on following link.
https://docs.vmware.com/en/VMware-Horizon/2203/linux-desktops-setup/GUID-09A3F97C-47FE-4ABF-B68C-E42AE26632CC.html#GUID-09A3F97C-47FE-4ABF-B68C-E42AE26632CC
-a yes|no | Install or bypass audio input redirection support. Default is yes. |
-f yes|no | Install or bypass support of the cryptographic modules designed for Federal Information Processing Standards (FIPS) 140-2. Default is no. For more information, see the FIPS 140-2 Mode description in Features of Horizon Linux Desktops. |
-j | JMS SSL keystore password. By default, installer generates a random string. |
-m yes|no | Install or bypass the smart card redirection support. Default is no. |
-r yes|no | Restart the system automatically after installation. Default is no. |
-s | Self signed cert subject DN. By default, installer uses Blast. |
-C yes|no | Install or bypass Clipboard Redirection support. Default is yes. |
-F yes|no | Install or bypass CDR support. Default is yes. |
-M yes|no | Upgrade the Linux Agent to managed or unmanaged agent. Default is yes. |
-S yes|no | Install or bypass Single Sign-on (SSO) support. Default is yes. |
-T yes|no | Install or bypass True Single Sign-on (True SSO) support. Default is no. |
-U yes|no | Install or bypass USB support. Default is no. |
相关推荐
- 佳能打印机驱动安装视频教程
-
电脑搜索“佳能驱动”。02进入首页点击“服务于支持”。03然后选择“下载与支持”点击进入。04然后选择你使用的打印机种类图片。05然后在选择产品页面逐一选择产品的种类、系列、型号、下载的文件类型。06...
- 班级优化大师官网登录(班级优化大师官网登录网址)
-
班级优化大师可以在另一个手机上重新下载安装该应用,并使用之前绑定的账户进行登录操作,即可同步之前的班级信息和配置。如果之前未绑定账户,则需要通过“找回密码”或“注册新账户”的方式来登录应用,并重新配置...
- 什么是chatgpt(什么是ai技术)
-
ChatGPT是由美国人工智能实验室OpenAI开发的一个对话AI模型,于2022年11月正式推出。它能够通过学习和理解人类的语言来进行对话互动,并协助人类完成一系列任务。chatGPT实际上是美国o...
- 无线网显示不可上网是怎么回事
-
可能有几下几方面原因:1、无线路由器网络参数设置错误,无法拨通ISP运营商的局端设备,无法接入互联网;2、宽带线路出现故障,路由器无法拨通ISP运营商的局端设备,无法连通;3、宽带DNS服务器由于某种...
- 电脑最好的显卡(电脑显卡最好的是什么型号)
-
华硕比较好点。挑选显卡的方法:1、独立显卡中分为A卡和N卡,A卡即AMD(原ATI公司,现被AMD公司收购)公司生产的显卡,N卡即nVidia公司生产的显卡。A卡中一线品牌有:蓝宝石,微星,华硕,F...
- windows7怎么下载主题(windows 7主题下载)
-
1、打开win7系统电脑左下角“开始”菜单,找到【控制面板】点击打开;2、进入控制面板界面,右上方【查看方式】更改为“小图标”,然后找到【管理工具】打开;3、进入“管理工具”,点击打开【服务】选项;4...
- 计算机计算器(计算机计算器区别)
-
计算器是现代人发明的可以进行数字运算的电子机器。现代的电子计算器能进行数学运算的手持电子机器,拥有集成电路芯片,但结构比电脑简单得多,可以说是第一代的电子计算机(电脑),且功能也较弱,但较为方便与廉价...
- 联想台式电脑价格(联想台式电脑价格一览表)
-
配置如下主板sis-651CPUIntelCeleronProcessor2.00GHz硬盘希捷ST3160215A(150G)新显示器即插即用监视器(LCSA771LXH-GJ769F3)显卡SiS...
- 华为手机驱动官网下载(华为手机驱动官网下载不了)
-
华为手机驱动程序安装方法:1:首先把华为手机连接电脑,在手机下拉通知栏中选择“设备文件管理(MTP)”或者“作为USB存储设备连接”或者“仅充电”的模式选择,进入USB计算机连接菜单选择“PC助手(...
- win7系统设置定时关机任务(win7定时关机怎么设置方法)
-
在Win7系统中,可以通过“任务计划程序”来设置定时自动关机。首先打开“任务计划程序”,选择“创建基本任务”,按照向导步骤设置任务名称、触发器(选择“按计划时间安排”并设置时间)、操作(选择“程序启动...
- 126免费邮箱登录入口官网电脑版
-
126邮箱是网易的一个免费邮箱登录入口在浏览器输入:mail.126.com浏览器进入126邮箱网站之后,即可自行登录126邮箱账号。如何在手机上登录126邮箱1、打开手机,找到并打开网易邮箱软件。2...
- windows优化大师软件平台(windows优化大师是实用程序吗)
-
最新版本:优化大师V7.99Build10.1221,最新的优化大师版本已可以兼容Vista,开发小组,将发布7.99.10.621的全新版本,带全新首页专业版的功能,免费。you...
- 台式电脑如何更换鼠标(台式电脑怎么换鼠标键盘)
-
是的,台式电脑可以更换键盘和鼠标。键盘和鼠标通常使用标准的USB接口连接到电脑,因此只需拔下原有的键盘和鼠标,然后插入新的键盘和鼠标即可。这样可以根据个人喜好和需求选择适合自己的键盘和鼠标,提高使用体...
- 笔记本电脑如何重置系统(笔记本电脑重置系统会怎么样)
-
重装系统建议使用U盘来完成。用U盘(16G左右就行)装系统,应先将U盘制作为可引导系统的盘(就是启动盘)。然后将系统文件复制到该U盘的GHO文件夹或ISO文件夹中(系统文件是GHO文件就复制到GHO中...
- 一周热门
-
-
飞牛OS入门安装遇到问题,如何解决?
-
如何在 iPhone 和 Android 上恢复已删除的抖音消息
-
Boost高性能并发无锁队列指南:boost::lockfree::queue
-
大模型手册: 保姆级用CherryStudio知识库
-
用什么工具在Win中查看8G大的log文件?
-
如何在 Windows 10 或 11 上通过命令行安装 Node.js 和 NPM
-
威联通NAS安装阿里云盘WebDAV服务并添加到Infuse
-
Trae IDE 如何与 GitHub 无缝对接?
-
idea插件之maven search(工欲善其事,必先利其器)
-
如何修改图片拍摄日期?快速修改图片拍摄日期的6种方法
-
- 最近发表
- 标签列表
-
- python判断字典是否为空 (50)
- crontab每周一执行 (48)
- aes和des区别 (43)
- bash脚本和shell脚本的区别 (35)
- canvas库 (33)
- dataframe筛选满足条件的行 (35)
- gitlab日志 (33)
- lua xpcall (36)
- blob转json (33)
- python判断是否在列表中 (34)
- python html转pdf (36)
- 安装指定版本npm (37)
- idea搜索jar包内容 (33)
- css鼠标悬停出现隐藏的文字 (34)
- linux nacos启动命令 (33)
- gitlab 日志 (36)
- adb pull (37)
- python判断元素在不在列表里 (34)
- python 字典删除元素 (34)
- vscode切换git分支 (35)
- python bytes转16进制 (35)
- grep前后几行 (34)
- hashmap转list (35)
- c++ 字符串查找 (35)
- mysql刷新权限 (34)
