Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docker-files/mpc/Dockerfile-wedpr-mpc-base-centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM centos:7

ENV PPC_MPC_LIB=/data/app/wedpr/scripts/wedpr-mpc:/data/app/wedpr/scripts/wedpr-mpc/local/lib/:/usr/local/lib/
ENV PPC_MPC_NO_GATEWAY_LIB=/data/app/wedpr/scripts/wedpr-mpc-no-gateway:/data/app/wedpr/scripts/wedpr-mpc-no-gateway/local/lib/:/usr/local/lib/

COPY ./config/mpc-node-conf.tar.gz /data/app/wedpr/scripts/
COPY ./config/ssl_cert.tar.gz /data/app/wedpr/scripts/
COPY ./config/CentOS-Base.repo /etc/yum.repos.d/
COPY ./config/CentOS-SCLo-scl.repo /etc/yum.repos.d/
COPY ./config/CentOS-SCLo-scl-rh.repo /etc/yum.repos.d/
COPY ./config/.gitconfig /root/
COPY ./scripts/build-mpc-base.sh /data/app/wedpr/scripts/
COPY ./scripts/wedpr-mpc-node.sh /data/app/wedpr/scripts/

WORKDIR /data/app/wedpr

RUN cd /data/app/wedpr/scripts/ && \
bash build-mpc-base.sh
16 changes: 16 additions & 0 deletions docker-files/mpc/Dockerfile-wedpr-mpc-base-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# FROM fiscoorg/wedpr-image:v3.0.0
FROM ubuntu:22.04

ENV PPC_MPC_LIB=/data/app/wedpr/scripts/wedpr-mpc:/data/app/wedpr/scripts/wedpr-mpc/local/lib/:/usr/local/lib/
ENV PPC_MPC_NO_GATEWAY_LIB=/data/app/wedpr/scripts/wedpr-mpc-no-gateway:/data/app/wedpr/scripts/wedpr-mpc-no-gateway/local/lib/:/usr/local/lib/

COPY ./config/mpc-node-conf.tar.gz /data/app/wedpr/scripts/
COPY ./config/ssl_cert.tar.gz /data/app/wedpr/scripts/
COPY ./config/.gitconfig /root/
COPY ./scripts/build-mpc-base-ubuntu.sh /data/app/wedpr/scripts/
COPY ./scripts/wedpr-mpc-node.sh /data/app/wedpr/scripts/

WORKDIR /data/app/wedpr

RUN cd /data/app/wedpr/scripts/ && \
bash build-mpc-base-ubuntu.sh
1 change: 1 addition & 0 deletions docker-files/mpc/build-mpc-base-centos-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build -f Dockerfile-wedpr-mpc-base-centos -t fiscoorg/wedpr-mpc-base-centos:v3.0.0 .
1 change: 1 addition & 0 deletions docker-files/mpc/build-mpc-base-ubuntu-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build -f Dockerfile-wedpr-mpc-base-ubuntu -t fiscoorg/wedpr-mpc-base-ubuntu:v3.0.0 .
11 changes: 11 additions & 0 deletions docker-files/mpc/config/.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[pager]
branch = false
[url "https://mirror.ghproxy.com/github.com"]
insteadOf = https://github.com
[http]
version = HTTP/1.1
postBuffer = 524288000
[https]
sslVerify = false
[core]
editor = vim
43 changes: 43 additions & 0 deletions docker-files/mpc/config/CentOS-Base.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - repo.huaweicloud.com
baseurl=https://repo.huaweicloud.com/centos/$releasever/os/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - repo.huaweicloud.com
baseurl=https://repo.huaweicloud.com/centos/$releasever/updates/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - repo.huaweicloud.com
baseurl=https://repo.huaweicloud.com/centos/$releasever/extras/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - repo.huaweicloud.com
baseurl=https://repo.huaweicloud.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-7
33 changes: 33 additions & 0 deletions docker-files/mpc/config/CentOS-SCLo-scl-rh.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# CentOS-SCLo-rh.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=http://mirrors.aliyun.com/centos/7/sclo/$basearch/rh/
#mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-rh-testing]
name=CentOS-7 - SCLo rh Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/rh/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-rh-source]
name=CentOS-7 - SCLo rh Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-rh-debuginfo]
name=CentOS-7 - SCLo rh Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
33 changes: 33 additions & 0 deletions docker-files/mpc/config/CentOS-SCLo-scl.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# CentOS-SCLo-scl.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=http://mirrors.aliyun.com/centos/7/sclo/$basearch/sclo/
#mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-testing]
name=CentOS-7 - SCLo sclo Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/sclo/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-source]
name=CentOS-7 - SCLo sclo Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-debuginfo]
name=CentOS-7 - SCLo sclo Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
Binary file added docker-files/mpc/config/mpc-node-conf.tar.gz
Binary file not shown.
Binary file added docker-files/mpc/config/ssl_cert.tar.gz
Binary file not shown.
120 changes: 120 additions & 0 deletions docker-files/mpc/scripts/build-mpc-base-ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/bin/bash

set -e
LANG=en_US.UTF-8

LOG_INFO() {
local content=${1}
echo -e "\033[32m[INFO] ${content}\033[0m"
}

LOG_ERROR() {
local content=${1}
echo -e "\033[31m[ERROR] ${content}\033[0m"
}


install_spdz_deps() {
# 安装基本依赖
apt update
apt install -y wget dos2unix vim automake make yasm git libboost-dev libboost-thread-dev libssl-dev libtool m4 python3 texinfo yasm libgmp-dev libsodium-dev
# 安装特定版本的GCC(类似于CentOS中的devtoolset)
apt install -y software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/test
apt update
apt install -y g++-11 g++-11-multilib

# 配置环境变量以使用新安装的GCC版本
echo "export CC=/usr/bin/gcc-11" >> ~/.bashrc
echo "export CXX=/usr/bin/g++-11" >> ~/.bashrc
source ~/.bashrc
ln -sf /usr/bin/g++-11 /usr/bin/g++
ln -sf /usr/bin/gcc-11 /usr/bin/gcc
g++ -v

# 安装OpenSSL 1.1(类似于CentOS中的openssl11)
apt install -y openssl libssl-dev
# Ubuntu中不需要创建符号链接,因为软件包会自动处理版本问题
# openssl rand -writerand /root/.rnd 命令在Ubuntu中同样适用
openssl rand -writerand /root/.rnd
}

cp_wedpr_node_script() {
dos2unix /data/app/wedpr/scripts/*.sh
chmod +x /data/app/wedpr/scripts/wedpr-mpc-node.sh
cp /data/app/wedpr/scripts/wedpr-mpc-node.sh /etc/init.d/
}

install_cmake(){
cd /usr/local/lib/
wget https://cmake.org/files/v3.21/cmake-3.21.4.tar.gz
tar -xf cmake-3.21.4.tar.gz
cd cmake-3.21.4
g++-11 -v
./configure
make -j4
make install
rm -rf /usr/local/lib/cmake-3.21.4.tar.gz
}

install_spdz() {
cd /data/app/wedpr/scripts/
git clone https://github.com/WeDPR-Team/MP-SPDZ.git
cp -r MP-SPDZ wedpr-mpc-no-gateway
cp -r MP-SPDZ wedpr-mpc

cd /data/app/wedpr/scripts/wedpr-mpc-no-gateway
git checkout ppc-2.0.0-no-gateway
do_compile_spdz


cd /data/app/wedpr/scripts/wedpr-mpc
git checkout ppc-2.0.0
do_compile_spdz

cd /data/app/wedpr/scripts
rm -rf MP-SPDZ
}

do_compile_spdz(){
echo CXX=g++ >> CONFIG.mine
echo AVX_OT=0 >> CONFIG.mine
# echo USE_NTL=1 > CONFIG.mine
make setup
sed -i "s/std::aligned_alloc/aligned_alloc/g" ./local/include/boost/asio/detail/memory.hpp
make -j4 replicated-ring-party.x
make -j4 hemi-party.x
make -j4 shamir-party.x
make -j4 mascot-party.x
make -j4 sy-rep-ring-party.x
strip mascot-party.x replicated-ring-party.x shamir-party.x hemi-party.x sy-rep-ring-party.x


mkdir Player-Data
tar xf /data/app/wedpr/scripts/ssl_cert.tar.gz
cp -r ssl_cert/* Player-Data/

rm -rf ./git ./GC ./Machines ./deps ./Math ./Processor ./FHEOffline ./OT ./Networking ./FHE ./ECDSA
rm -rf BMR ExternalIO Yao Utils bin doc Dockerfile Makefile License.txt README.md CHANGELOG.md azure-pipelines.yml setup.py Tools
}

install_mpc_nodes() {
cd /data/app/wedpr/
tar -xf wedpr-mpc-node.tar.gz
rm -rf wedpr-mpc-node.tar.gz

chmod +x /data/app/wedpr/wedpr-mpc-node/wedpr-mpc
chmod +x /data/app/wedpr/wedpr-mpc-node/*.sh
dos2unix /data/app/wedpr/wedpr-mpc-node/*.sh
}

install_spdz_deps
echo "install_spdz_deps ok"
cp_wedpr_node_script
echo "cp_wedpr_node_script ok"
install_cmake
echo "install_cmake ok"
install_spdz
echo "install_spdz ok"
#install_mpc_nodes
#echo "install_mpc_nodes ok"
Loading
Loading