Skip to content

Commit

Permalink
Test jumphost (#361)
Browse files Browse the repository at this point in the history
* Fix bug in jumphost connecting

* test jumphost

* add sudo
  • Loading branch information
MisterTea authored Nov 17, 2020
1 parent 9b377f5 commit a1a82b6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ on:
pull_request:

jobs:
ubsan:
ubsan_linux:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Setup
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
git submodule update --init
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo apt-get install -y git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
sudo ACCEPT_EULA=Y apt-get -y upgrade
ACCEPT_EULA=Y sudo apt-get -y upgrade
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
git submodule update --init
- name: Test with ubsan
run: |
Expand All @@ -33,23 +33,23 @@ jobs:
popd
rm -Rf build
asan:
asan_linux:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Setup
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
git submodule update --init
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo apt-get install -y git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
sudo ACCEPT_EULA=Y apt-get -y upgrade
ACCEPT_EULA=Y sudo apt-get -y upgrade
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
git submodule update --init
- name: Test with asan
run: |
Expand All @@ -61,23 +61,23 @@ jobs:
popd
rm -Rf build
msan:
msan_linux:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Setup
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
git submodule update --init
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo apt-get install -y git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
sudo ACCEPT_EULA=Y apt-get -y upgrade
ACCEPT_EULA=Y sudo apt-get -y upgrade
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
git submodule update --init
- name: Test with msan
run: |
Expand All @@ -89,23 +89,23 @@ jobs:
popd
rm -Rf build
tsan:
tsan_linux:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Setup
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
git submodule update --init
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
sudo apt-get update
sudo apt-get install -y git cmake gdb protobuf-compiler libsodium-dev libgflags-dev libprotobuf-dev libutempter-dev g++
sudo ACCEPT_EULA=Y apt-get -y upgrade
ACCEPT_EULA=Y sudo apt-get -y upgrade
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
git submodule update --init
- name: Test with tsan
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/mac_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
git submodule update --init
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew remove python@2; brew upgrade python; brew install cmake; brew install protobuf libsodium
brew install cmake; brew install protobuf libsodium
- name: Test with ubsan
run: |
Expand All @@ -45,7 +45,7 @@ jobs:
git submodule update --init
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew remove python@2; brew upgrade python; brew install cmake; brew install protobuf libsodium
brew install cmake; brew install protobuf libsodium
- name: Test with asan
run: |
Expand All @@ -71,7 +71,7 @@ jobs:
git submodule update --init
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew remove python@2; brew upgrade python; brew install cmake; brew install protobuf libsodium
brew install cmake; brew install protobuf libsodium
- name: Test with msan
run: |
Expand All @@ -97,7 +97,7 @@ jobs:
git submodule update --init
mkdir -p ~/.ssh/
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
brew remove python@2; brew upgrade python; brew install cmake; brew install protobuf libsodium
brew install cmake; brew install protobuf libsodium
- name: Test with tsan
run: |
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.server
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM centos:7 as base

ENV BUILD_REPOS="epel-release centos-release-scl" \
BUILD_DEPS="cmake3 boost-devel libsodium-devel ncurses-devel protobuf-devel \
protobuf-compiler gflags-devel protobuf-lite-devel git devtoolset-8"
protobuf-compiler gflags-devel protobuf-lite-devel git devtoolset-8"

WORKDIR /

Expand Down
4 changes: 2 additions & 2 deletions src/terminal/SshSetupHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ string SshSetupHandler::SetupSsh(const string& user, const string& host,
CLOG(INFO, "stdout") << "Error initializing connection" << err.what()
<< endl;
}

// start jumpclient daemon on jumphost.
if (!jumphost.empty()) {
/* If jumphost is set, we need to pass dst host and port to jumphost
* and connect to jumphost here */
string cmdoptions{"--verbose=" + std::to_string(vlevel)};
string jump_cmdoptions = cmdoptions + " --jump --dsthost=" + host +
" --dstport=" + to_string(port);
string SSH_SCRIPT_JUMP = genCommand(passkey, id, clientTerm, user, kill,
cmd_prefix, jump_cmdoptions);
// start command in interactive mode
SSH_SCRIPT_JUMP = "$SHELL -lc \'" + SSH_SCRIPT_JUMP + "\'";

string sshLinkBuffer =
SubprocessToStringInteractive("ssh", {jumphost, SSH_SCRIPT_JUMP});
Expand Down
2 changes: 1 addition & 1 deletion src/terminal/TerminalClientMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ int main(int argc, char** argv) {
}
string idpasskeypair = SshSetupHandler::SetupSsh(
username, destinationHost, host_alias, destinationPort, jumphost, jport,
result.count("x") > 0, result["v"].as<int>(),
result.count("x") > 0, result["verbose"].as<int>(),
result.count("prefix") ? result["prefix"].as<string>() : "",
serverFifo);

Expand Down

0 comments on commit a1a82b6

Please sign in to comment.