diff options
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | README.md | 15 | ||||
-rw-r--r-- | bastion/CMakeLists.txt | 5 | ||||
-rw-r--r-- | external/CMakeLists.txt | 38 |
4 files changed, 39 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 38bc5f2..a61bd0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,14 @@ cmake_minimum_required (VERSION 3.0) project (bastion LANGUAGES C VERSION 0.1) set(CMAKE_VERBOSE_MAKEFILE FALSE) -set(CMAKE_BUILD_TYPE DEBUG) +set(CMAKE_BUILD_TYPE Release) +set(CMAKE_INSTALL_PREFIX /usr/local) set(CMAKE_C_FLAGS "-Wall -Werror -Wextra -pedantic") set(CMAKE_C_FLAGS_DEBUG "-g -ggdb -pg -fsanitize=address") -set(CMAKE_C_FLAGS_RELEASE "-Os") -set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os -g") +set(CMAKE_C_FLAGS_RELEASE "-O2") +set(CMAKE_C_FLAGS_MinSizeRel "-Os") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -pg -fsanitize=address") option(LIBSSH_VERBOSE_OUTPUT "whether or not verbose output for libssh mode is activated" OFF) option(SESSION_RECORDING "whether or not recording feature based on lib termrec is activated" ON) @@ -4,8 +4,9 @@ SSH bastion that features transparent connection and session recording. This project is inspired by https://github.com/moul/sshportal. I wrote this implementation to work around the fact that I couldn't get the go ssh lib to work properly with non interactive sessions, the bug has been open for a long time and I tend to belive it cannot be fixed -(https://github.com/moul/sshportal/issues/55). This one does work properly with non interactive sessions, which allows transparent ansible usage through -the bastion. +(https://github.com/moul/sshportal/issues/55). + +This bastion project does work properly with non interactive sessions, which allows transparent ansible usage through the bastion. ## Contents @@ -39,10 +40,14 @@ make install ``` You can customise the build with the following cmake flags : -- SESSION_RECORDING -For exemple this disables session recording : -`cmake .. -DSESSION_RECORDING=OFF` +- `CMAKE_BUILD_TYPE` : Debug|Release|RelWithDebInfo|MinSizeRel, defaults to Release +- `CMAKE_INSTALL_PREFIX` : path, defaults to `/usr/local` +- `SESSION_RECORDING` : ON|OFF, defaults to ON + +For exemple this disables session recording for a debug build and install it under /usr : + +`cmake .. -DCMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=/usr -DSESSION_RECORDING=OFF` ## Usage diff --git a/bastion/CMakeLists.txt b/bastion/CMakeLists.txt index 29a2754..858797a 100644 --- a/bastion/CMakeLists.txt +++ b/bastion/CMakeLists.txt @@ -4,5 +4,8 @@ include_directories("${bastion_SOURCE_DIR}/") file(GLOB_RECURSE SOURCES *.c) add_executable(bastion ${SOURCES}) -target_link_libraries(bastion libtty common) +target_link_libraries(bastion common) +if (${SESSION_RECORDING}) + target_link_libraries(bastion libtty) +endif() target_link_libraries(bastion bz2 lzma mysqlclient ssh z) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 7697b9b..3b2edd4 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,19 +1,21 @@ -# Build libtty from the termrec project -if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/termrec/) - message("Unable to find termrec, running git submodule update --init") - execute_process(COMMAND git submodule update --init -- termrec WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +if (${SESSION_RECORDING}) + # Build libtty from the termrec project + if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/termrec/) + message("Unable to find termrec, running git submodule update --init") + execute_process(COMMAND git submodule update --init -- termrec WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/termrec/configure) + message("Unable to find configure file for termrec, running autogen.sh") + execute_process(COMMAND ./autogen.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/termrec) + endif() + if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/termrec/config.h) + message("Unable to find config.h file for termrec, running configure script") + execute_process(COMMAND ./configure WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/termrec) + endif() + file(GLOB_RECURSE LIBTTY_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/termrec/libtty/*.c) + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/termrec/") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/termrec/libtty") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/termrec/sys") + ADD_LIBRARY(libtty STATIC ${LIBTTY_SOURCES}) + SET_TARGET_PROPERTIES(libtty PROPERTIES COMPILE_FLAGS "-Wno-all -Wno-error -Wno-extra -Wno-pedantic") endif() -if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/termrec/configure) - message("Unable to find configure file for termrec, running autogen.sh") - execute_process(COMMAND ./autogen.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/termrec) -endif() -if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/termrec/config.h) - message("Unable to find config.h file for termrec, running configure script") - execute_process(COMMAND ./configure WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/termrec) -endif() -file(GLOB_RECURSE LIBTTY_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/termrec/libtty/*.c) -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/termrec/") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/termrec/libtty") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/termrec/sys") -ADD_LIBRARY(libtty STATIC ${LIBTTY_SOURCES}) -SET_TARGET_PROPERTIES(libtty PROPERTIES COMPILE_FLAGS "-Wno-all -Wno-error -Wno-extra -Wno-pedantic") |