Skip to content

Commit

Permalink
proxy: enable PIE
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent 63a7ef2 commit 21fbb4c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
2 changes: 2 additions & 0 deletions proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ add_executable(hood_proxy
src/network.cpp src/tls_security_policy.cpp src/tls_check_certificate.cpp src/tls_check_certificate_worker.cpp
src/name_service_client.cpp
)
set_property(TARGET hood_proxy PROPERTY POSITION_INDEPENDENT_CODE TRUE)

if(MSVC)
target_compile_options(hood_proxy PRIVATE /W4 /WX)
else()
target_compile_options(hood_proxy PRIVATE -Wall -Wextra -Werror -fstack-protector)
endif()


target_link_libraries( hood_proxy ${Boost_LIBRARIES} pthread ${OPENSSL_LIBRARIES} )
2 changes: 1 addition & 1 deletion proxy/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ done
mkdir -p $script_dir/build/$type/$arch
cd $script_dir/build/$type/$arch

cmake -DCMAKE_BUILD_TYPE=$type -DOPENSSL_ROOT_DIR=$script_dir/libs/$system/$arch/openssl -DBOOST_ROOT=$script_dir/libs/$system/$arch/boost ..
cmake -DCMAKE_BUILD_TYPE=$type -DOPENSSL_ROOT_DIR=$script_dir/libs/$system/$arch/openssl -DBOOST_ROOT=$script_dir/libs/$system/$arch/boost $script_dir
make -j $(nproc --all)
37 changes: 20 additions & 17 deletions proxy/install_dependencies_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,24 @@ fi

export TAR_OPTIONS=--no-same-owner

echo "Downloading openssl."
openssl_src=$(curl -s https://www.openssl.org/source/|grep "tar.gz</a"|tail -n 1|sed -r -e "s/.*gz\">([^<]*).*/\1/")
curl -L -O -C - https://www.openssl.org/source/$openssl_src
echo "Extracting openssl."
tar -xmf $openssl_src
openssl_src=$(echo $openssl_src |sed "s/.......$//")
cd $openssl_src
install_dir=../$(uname -s)/$arch/openssl
mkdir -p $install_dir
install_dir=$(realpath $install_dir)
./Configure no-ssl2 no-ssl3 no-shared no-weak-ssl-ciphers no-rc2 no-rc4 no-md2 no-md4 no-des no-unit-test no-apps --prefix=$install_dir
make -j ${HOOD_PROXY_BUILD_CONCURRENCY}
make install_sw
cd ..
if [ -d ./$(uname -s)/$arch/openssl ] ; then
echo "${BOOST_FILE_NAME} already installed."
else
echo "Downloading openssl."
openssl_src=$(curl -s https://www.openssl.org/source/|grep "tar.gz</a"|tail -n 1|sed -r -e "s/.*gz\">([^<]*).*/\1/")
curl -L -O -C - https://www.openssl.org/source/$openssl_src
echo "Extracting openssl."
tar -xmf $openssl_src
openssl_src=$(echo $openssl_src |sed "s/.......$//")
cd $openssl_src
install_dir=../$(uname -s)/$arch/openssl
mkdir -p $install_dir
install_dir=$(realpath $install_dir)
./Configure no-ssl2 no-ssl3 no-shared no-weak-ssl-ciphers no-rc2 no-rc4 no-md2 no-md4 no-des no-unit-test no-apps --prefix=$install_dir
make -j ${HOOD_PROXY_BUILD_CONCURRENCY}
make install_sw
cd ..
fi

# ---- begin code copied and modified from carla Simulator which is MIT License
# ==============================================================================
Expand All @@ -56,7 +60,7 @@ cd ..
BOOST_VERSION="1.84.0"
BOOST_FILE_NAME=$(echo boost_$BOOST_VERSION|tr '.' '_')

if [ -d /$(uname -s)/$arch/boost ] ; then
if [ -d ./$(uname -s)/$arch/boost ] ; then
echo "${BOOST_FILE_NAME} already installed."
else
if [ ! -d "${BOOST_FILE_NAME}-source" ]; then
Expand All @@ -68,9 +72,8 @@ else
tar -xmf $BOOST_FILE_NAME.tar.gz --exclude "libs" --exclude "doc" --exclude "example" --exclude "test"
tar -xmf $BOOST_FILE_NAME.tar.gz --exclude "test" --exclude "example" --exclude "doc" ${BOOST_FILE_NAME}/libs/
mkdir -p $(uname -s)/$arch/boost/include
mv ${BOOST_FILE_NAME} ${BOOST_FILE_NAME}-source
fi
cd ${BOOST_FILE_NAME}-source
cd ${BOOST_FILE_NAME}

if [ ! -f "b2" ] ; then
./bootstrap.sh --prefix="../$(uname -s)/$arch/boost"
Expand Down
Binary file modified scripts/hood_proxy_x64
Binary file not shown.

0 comments on commit 21fbb4c

Please sign in to comment.