From a0e3b7979f8957baed7da7928084a84a22886cb5 Mon Sep 17 00:00:00 2001 From: rublon-jfr <115086620+rublon-jfr@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:34:06 +0200 Subject: [PATCH] vagrant: fix setup files, add rapidjson dependency (#3) --- .gitignore | 4 ++- PAM/ssh/CMakeLists.txt | 3 -- PAM/ssh/extern/rapidjson | 1 - PAM/ssh/include/rublon/json.hpp | 6 ++-- os/centos/stream9/Vagrantfile | 51 ++++++++++++--------------- os/debian/11/Vagrantfile | 62 +++++++++++++++------------------ os/debian/12/Vagrantfile | 55 +++++++++++++++-------------- os/ubuntu/20.04/Vagrantfile | 55 +++++++++++++++-------------- os/ubuntu/22.04/Vagrantfile | 57 +++++++++++++++--------------- 9 files changed, 141 insertions(+), 153 deletions(-) mode change 100644 => 100755 PAM/ssh/CMakeLists.txt delete mode 160000 PAM/ssh/extern/rapidjson mode change 100644 => 100755 os/centos/stream9/Vagrantfile mode change 100644 => 100755 os/debian/11/Vagrantfile mode change 100644 => 100755 os/debian/12/Vagrantfile mode change 100644 => 100755 os/ubuntu/20.04/Vagrantfile mode change 100644 => 100755 os/ubuntu/22.04/Vagrantfile diff --git a/.gitignore b/.gitignore index c377977..7a56b55 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,8 @@ CMakeLists.txt.user* *.dll *.exe -#Vagrant generated files +# Vagrant generated files *.vagrant +# Output files +build/ diff --git a/PAM/ssh/CMakeLists.txt b/PAM/ssh/CMakeLists.txt old mode 100644 new mode 100755 index 4e4af9f..1fa7cbd --- a/PAM/ssh/CMakeLists.txt +++ b/PAM/ssh/CMakeLists.txt @@ -1,6 +1,3 @@ -add_subdirectory(extern/rapidjson EXCLUDE_FROM_ALL) -include_directories(extern/rapidjson/include) - add_library(rublon-ssh INTERFACE ) diff --git a/PAM/ssh/extern/rapidjson b/PAM/ssh/extern/rapidjson deleted file mode 160000 index 973dc9c..0000000 --- a/PAM/ssh/extern/rapidjson +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 973dc9c06dcd3d035ebd039cfb9ea457721ec213 diff --git a/PAM/ssh/include/rublon/json.hpp b/PAM/ssh/include/rublon/json.hpp index a7b1dcf..a2ce1f2 100644 --- a/PAM/ssh/include/rublon/json.hpp +++ b/PAM/ssh/include/rublon/json.hpp @@ -1,8 +1,8 @@ #pragma once -#include "rapidjson/document.h" -#include "rapidjson/pointer.h" -#include "rapidjson/writer.h" #include "rublon/utils.hpp" +#include +#include +#include #include #include diff --git a/os/centos/stream9/Vagrantfile b/os/centos/stream9/Vagrantfile old mode 100644 new mode 100755 index 625eb58..4285ffe --- a/os/centos/stream9/Vagrantfile +++ b/os/centos/stream9/Vagrantfile @@ -1,13 +1,12 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -#Default user -#---------------------- -#login: vagrant -#pass: vagrant +# Default user +# ---------------------- +# login: vagrant +# pass: vagrant Vagrant.configure("2") do |config| - - #Basic configuration + # Basic configuration config.vm.provider "virtualbox" config.vm.box = "generic/centos9s" config.ssh.forward_agent = true @@ -17,45 +16,39 @@ Vagrant.configure("2") do |config| # your network. config.vm.network "public_network" + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + config.vm.synced_folder "../../..", "/home/vagrant/Rublon-Linux" + config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine - vb.gui = true + vb.gui = true + + # Fix for 'SSH auth method: Private key' stuck + vb.customize ["modifyvm", :id, "--cableconnected1", "on"] end - + # Enable provisioning with a shell script. Additional provisioners such as # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the # documentation for more information about their specific syntax and use. config.vm.provision "shell", inline: <<-SHELL yum update - yum install -y gcc openssl-devel curl-devel pam-devel git cmake + yum install -y gcc openssl-devel curl-devel pam-devel rapidjson-devel cmake + + # Building project + cd /home/vagrant/Rublon-Linux + cmake -B build && cmake --build build + sudo cmake --install build sed -i 's/UsePAM .*/UsePAM yes/' /etc/ssh/sshd_config sed -i 's/ChallengeResponseAuthentication .*/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config - - mkdir -p ~/.ssh - chmod 700 ~/.ssh - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - - git clone git@github.com:Rublon/rublon-ssh-cpp-private.git - - cd rublon-ssh-cpp-private/ - - #Temporary solution due to missing CMakeLists files in .../rapidjson and .../tl - touch PAM/ssh/extern/rapidjson/CMakeLists.txt - - #Building project - mkdir build - cd build/ - cmake .. - cmake --build . - grep -q -e 'auth required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aauth required pam_rublon.so' /etc/pam.d/sshd grep -q -e 'account required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aaccount required pam_rublon.so' /etc/pam.d/sshd - systemctl restart sshd.service - #service sshd restart - doesnt work SHELL diff --git a/os/debian/11/Vagrantfile b/os/debian/11/Vagrantfile old mode 100644 new mode 100755 index b3aa8b9..c9d603d --- a/os/debian/11/Vagrantfile +++ b/os/debian/11/Vagrantfile @@ -1,18 +1,12 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -#Default user -#---------------------- -#login: root -#pass: vagrant - -#Default files location -#---------------------- -# -#/home/vagrant +# Default +# ---------------------- +# login: root +# pass: vagrant Vagrant.configure("2") do |config| - - #Basic configuration + # Basic configuration config.vm.provider "virtualbox" config.vm.box = "debian/bullseye64" config.ssh.forward_agent = true @@ -22,41 +16,43 @@ Vagrant.configure("2") do |config| # your network. config.vm.network "public_network" + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + config.vm.synced_folder "../../..", "/home/vagrant/Rublon-Linux" + config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine - vb.gui = true + vb.gui = true + + # Fix for 'SSH auth method: Private key' stuck + vb.customize ["modifyvm", :id, "--cableconnected1", "on"] end # Enable provisioning with a shell script. Additional provisioners such as # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the # documentation for more information about their specific syntax and use. config.vm.provision "shell", inline: <<-SHELL - + DEBIAN_FRONTEND=noniteracactive\ apt-get update && apt-get install -y \ - gcc build-essential openssh-server libcurl4-openssl-dev\ - libpam0g-dev libssl-dev cmake git + gcc \ + build-essential \ + openssh-server \ + libcurl4-openssl-dev \ + libpam0g-dev \ + libssl-dev \ + rapidjson-dev \ + cmake + # Building project + cd /home/vagrant/Rublon-Linux + cmake -B build && cmake --build build + sudo cmake --install build + sed -i 's/UsePAM .*/UsePAM yes/' /etc/ssh/sshd_config sed -i 's/ChallengeResponseAuthentication .*/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config - - mkdir -p ~/.ssh - chmod 700 ~/.ssh - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - - git clone git@github.com:Rublon/rublon-ssh-cpp-private.git - - cd rublon-ssh-cpp-private/ - - #Temporary solution due to missing CMakeLists files in .../rapidjson and .../tl - touch PAM/ssh/extern/rapidjson/CMakeLists.txt - - #Building project - mkdir build - cd build/ - cmake .. - cmake --build . - grep -q -e 'auth required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aauth required pam_rublon.so' /etc/pam.d/sshd grep -q -e 'account required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aaccount required pam_rublon.so' /etc/pam.d/sshd diff --git a/os/debian/12/Vagrantfile b/os/debian/12/Vagrantfile old mode 100644 new mode 100755 index 045d94c..863d641 --- a/os/debian/12/Vagrantfile +++ b/os/debian/12/Vagrantfile @@ -1,13 +1,12 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -#Default -# -#login: root -#pass: vagrant +# Default +# ---------------------- +# login: root +# pass: vagrant Vagrant.configure("2") do |config| - - #Basic configuration + # Basic configuration config.vm.provider "virtualbox" config.vm.box = "debian/bookworm64" config.ssh.forward_agent = true @@ -17,9 +16,18 @@ Vagrant.configure("2") do |config| # your network. config.vm.network "public_network" + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + config.vm.synced_folder "../../..", "/home/vagrant/Rublon-Linux" + config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine - vb.gui = true + vb.gui = true + + # Fix for 'SSH auth method: Private key' stuck + vb.customize ["modifyvm", :id, "--cableconnected1", "on"] end # Enable provisioning with a shell script. Additional provisioners such as @@ -29,29 +37,22 @@ Vagrant.configure("2") do |config| DEBIAN_FRONTEND=noniteracactive\ apt-get update && apt-get install -y \ - gcc build-essential openssh-server libcurl4-openssl-dev\ - libpam0g-dev libssl-dev cmake git + gcc \ + build-essential \ + openssh-server \ + libcurl4-openssl-dev \ + libpam0g-dev \ + libssl-dev \ + rapidjson-dev \ + cmake + # Building project + cd /home/vagrant/Rublon-Linux + cmake -B build && cmake --build build + sudo cmake --install build + sed -i 's/UsePAM .*/UsePAM yes/' /etc/ssh/sshd_config sed -i 's/ChallengeResponseAuthentication .*/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config - - mkdir -p ~/.ssh - chmod 700 ~/.ssh - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - - git clone git@github.com:Rublon/rublon-ssh-cpp-private.git - - cd rublon-ssh-cpp-private/ - - #Temporary solution due to missing CMakeLists files in .../rapidjson and .../tl - touch PAM/ssh/extern/rapidjson/CMakeLists.txt - - #Building project - mkdir build - cd build/ - cmake .. - cmake --build . - grep -q -e 'auth required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aauth required pam_rublon.so' /etc/pam.d/sshd grep -q -e 'account required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aaccount required pam_rublon.so' /etc/pam.d/sshd diff --git a/os/ubuntu/20.04/Vagrantfile b/os/ubuntu/20.04/Vagrantfile old mode 100644 new mode 100755 index 76c4819..ece2ef7 --- a/os/ubuntu/20.04/Vagrantfile +++ b/os/ubuntu/20.04/Vagrantfile @@ -1,13 +1,12 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -#Default user -#---------------------- -#login: vagrant -#pass: vagrant +# Default user +# ---------------------- +# login: vagrant +# pass: vagrant Vagrant.configure("2") do |config| - - #Basic configuration + # Basic configuration config.vm.provider "virtualbox" config.vm.box = "ubuntu/focal64" config.ssh.forward_agent = true @@ -17,9 +16,18 @@ Vagrant.configure("2") do |config| # your network. config.vm.network "public_network" + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + config.vm.synced_folder "../../..", "/home/vagrant/Rublon-Linux" + config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine - vb.gui = true + vb.gui = true + + # Fix for 'SSH auth method: Private key' stuck + vb.customize ["modifyvm", :id, "--cableconnected1", "on"] end # Enable provisioning with a shell script. Additional provisioners such as @@ -29,29 +37,22 @@ Vagrant.configure("2") do |config| DEBIAN_FRONTEND=noniteracactive\ apt-get update && apt-get install -y \ - gcc build-essential openssh-server libcurl4-openssl-dev\ - libpam0g-dev libssl-dev cmake + gcc \ + build-essential \ + openssh-server \ + libcurl4-openssl-dev \ + libpam0g-dev \ + libssl-dev \ + rapidjson-dev \ + cmake + # Building project + cd /home/vagrant/Rublon-Linux + cmake -B build && cmake --build build + sudo cmake --install build + sed -i 's/UsePAM .*/UsePAM yes/' /etc/ssh/sshd_config sed -i 's/ChallengeResponseAuthentication .*/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config - - mkdir -p ~/.ssh - chmod 700 ~/.ssh - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - - git clone git@github.com:Rublon/rublon-ssh-cpp-private.git - - cd rublon-ssh-cpp-private/ - - #Temporary solution due to missing CMakeLists files in .../rapidjson and .../tl - touch PAM/ssh/extern/rapidjson/CMakeLists.txt - - #Building project - mkdir build - cd build/ - cmake .. - cmake --build . - grep -q -e 'auth required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aauth required pam_rublon.so' /etc/pam.d/sshd grep -q -e 'account required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aaccount required pam_rublon.so' /etc/pam.d/sshd diff --git a/os/ubuntu/22.04/Vagrantfile b/os/ubuntu/22.04/Vagrantfile old mode 100644 new mode 100755 index 28f1204..b652849 --- a/os/ubuntu/22.04/Vagrantfile +++ b/os/ubuntu/22.04/Vagrantfile @@ -1,13 +1,12 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -#Default user -#---------------------- -#login: vagrant -#pass: vagrant +# Default user +# ---------------------- +# login: vagrant +# pass: vagrant Vagrant.configure("2") do |config| - - #Basic configuration + # Basic configuration config.vm.provider "virtualbox" config.vm.box = "ubuntu/jammy64" config.ssh.forward_agent = true @@ -17,9 +16,18 @@ Vagrant.configure("2") do |config| # your network. config.vm.network "public_network" + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + config.vm.synced_folder "../../..", "/home/vagrant/Rublon-Linux" + config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine - vb.gui = true + vb.gui = true + + # Fix for 'SSH auth method: Private key' stuck + vb.customize ["modifyvm", :id, "--cableconnected1", "on"] end # Enable provisioning with a shell script. Additional provisioners such as @@ -29,34 +37,25 @@ Vagrant.configure("2") do |config| DEBIAN_FRONTEND=noniteracactive\ apt-get update && apt-get install -y \ - gcc build-essential openssh-server libcurl4-openssl-dev\ - libpam0g-dev libssl-dev cmake - + gcc \ + build-essential \ + openssh-server \ + libcurl4-openssl-dev \ + libpam0g-dev \ + libssl-dev \ + rapidjson-dev \ + cmake + # Building project + cd /home/vagrant/Rublon-Linux + cmake -B build && cmake --build build + sudo cmake --install build + sed -i 's/UsePAM .*/UsePAM yes/' /etc/ssh/sshd_config sed -i 's/ChallengeResponseAuthentication .*/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config - - mkdir -p ~/.ssh - chmod 700 ~/.ssh - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - - git clone git@github.com:Rublon/rublon-ssh-cpp-private.git - - cd rublon-ssh-cpp-private/ - - #Temporary solution due to missing CMakeLists files in .../rapidjson and .../tl - touch PAM/ssh/extern/rapidjson/CMakeLists.txt - - #Building project - mkdir build - cd build/ - cmake .. - cmake --build . - grep -q -e 'auth required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aauth required pam_rublon.so' /etc/pam.d/sshd grep -q -e 'account required pam_rublon.so' /etc/pam.d/sshd || sed -i '\$aaccount required pam_rublon.so' /etc/pam.d/sshd service sshd restart SHELL - end