下载
git clone https://codeup.aliyun.com/6306306f95064d67d44656e5/lxr1907/ContactDiscoveryService-Icelake.git
或github地址
git clone https://github.com/signalapp/ContactDiscoveryService-Icelake
按照Readme安装
Building
git submodule init
git submodule update
mvn verify
Enclave releases
To create a new enclave release, run the following Maven command:
./mvnw exec:exec@enclave-release
...and commit the new files in src/main/resources/org/signal/cdsi/enclave.
运行命令
./mvnw mn:run -Dmicronaut.environments=dev
报错
查看/c目录下的Readme,根据环境要求安装
Install the Open Enclave SDK (Ubuntu 20.04)
参考:https://github.com/openenclave/openenclave/blob/master/docs/GettingStartedDocs/install_oe_sdk-Ubuntu_20.04.md
安装过程
echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add -
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" | sudo tee /etc/apt/sources.list.d/llvm-toolchain-focal-11.list
wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/20.04/prod focal main" | sudo tee /etc/apt/sources.list.d/msprod.list
wget -qO - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt update
Install the Intel SGX DCAP Driver
Some versions of Ubuntu come with the SGX driver already installed. You can check by running with the following:
$ dmesg | grep -i sgx
[ 106.775199] sgx: intel_sgx: Intel SGX DCAP Driver {version}
若没有上述信息,表明未安装,则执行下面命令
sudo apt update
sudo apt -y install dkms
wget https://download.01.org/intel-sgx/sgx-linux/2.19/distro/ubuntu20.04-server/sgx_linux_x64_driver_2.11.54c9c4c.bin -O sgx_linux_x64_driver.bin
chmod +x sgx_linux_x64_driver.bin
sudo ./sgx_linux_x64_driver.bin
这里要注意提示信息:
You may need to run "/sbin/modprobe intel_sgx " or reboot system manually!
根据信息我们输入
/sbin/modprobe intel_sgx
会报错modprobe: ERROR: could not insert 'intel_sgx': Operation not permitted
因此只能reboot
重启后,系统会进入界面
选Enroll Mok
下个界面选Continue,然后重启
再次进入系统后,会发现命令不再报错
/sbin/modprobe intel_sgx
安装依赖
Install the Intel and Open Enclave packages and dependencies
sudo apt -y install clang-11 libssl-dev gdb libsgx-enclave-common libsgx-quote-ex libprotobuf17 libsgx-dcap-ql libsgx-dcap-ql-dev az-dcap-client open-enclave
Configure environment variables for Open Enclave SDK for Linux
For ease of development, we recommend adding:
Open Enclave SDK bin folder to PATH, for use of our tools (such as oegdb and oeedger8r).
Open Enclave SDK install folder to CMAKE_PREFIX_PATH, for use of the CMake package.
Open Enclave SDK pkgconfig folder to PKG_CONFIG_PATH, for use of pkg-config.
You can do this by sourcing the openenclaverc file that is distributed with the SDK:
source /opt/openenclave/share/openenclave/openenclaverc
再次运行
./mvnw mn:run -Dmicronaut.environments=dev
该报错可能是安装sgx_linux_x64_driver版本有误
参考
https://github.com/intel/linux-sgx/issues/900
改为如下版本
https://download.01.org/intel-sgx/sgx-linux/2.19/distro/ubuntu20.04-server/sgx_linux_x64_driver_1.41.bin
修改版本安装前,需要卸载老版本
运行/opt/intel目录下,所有组件目录中,cleanup.sh或者uninstall.sh
再再运行
./mvnw mn:run -Dmicronaut.environments=dev
服务启动成功,但仍有报错