From 89e52d2687b88949163d78a77ee02c3f03236c85 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Jul 2024 10:21:31 +0200 Subject: [PATCH] chenged Vagrantfile to create script for automating package generation --- os/centos/stream9/Vagrantfile | 36 ++++++---------------- os/debian/11/Vagrantfile | 45 ++++++++++----------------- os/debian/12/Vagrantfile | 45 ++++++++++----------------- os/rhel/9/Vagrantfile | 58 ++++++++++++----------------------- os/ubuntu/20.04/Vagrantfile | 5 --- os/ubuntu/22.04/Vagrantfile | 52 ++++++++++++------------------- os/ubuntu/24.04/Vagrantfile | 55 ++++++++++++--------------------- 7 files changed, 103 insertions(+), 193 deletions(-) diff --git a/os/centos/stream9/Vagrantfile b/os/centos/stream9/Vagrantfile index efb86cc..5c5f5ae 100755 --- a/os/centos/stream9/Vagrantfile +++ b/os/centos/stream9/Vagrantfile @@ -34,43 +34,27 @@ Vagrant.configure("2") do |config| # 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 - + export BASE=/home/vagrant/Rublon-Linux + export DISTRO=centos09 + export BUILDDIR=${BASE}/${DISTRO} yum update - yum install -y gcc openssl-devel libcurl-devel pam-devel git rapidjson-devel cmake policycoreutils-devel checkpolicy + yum install -y gcc openssl-devel libcurl-devel pam-devel git rapidjson-devel cmake policycoreutils-devel checkpolicy rpm-build lsb-release # get dependencies + mkdir ${BUILDDIR} -p; cd ${BUILDDIR} git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git mkdir socket.io-client-cpp/build; cd socket.io-client-cpp/build cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release .. cmake --build . --target install - #handle semodule - cd /home/vagrant/Rublon-Linux/service - checkmodule -M -m -o login_rublon.mod login_rublon.te - semodule_package -o login_rublon.pp -m login_rublon.mod - # Build project - cd /home/vagrant/Rublon-Linux - cmake -B build && cmake --build build - - # Install - sudo cmake --install build - sudo install -m 644 rsc/rublon.config.defaults /etc/rublon.config - - #handle semodule - cd /home/vagrant/Rublon-Linux/service - semodule -i login_rublon.pp - - # Register Rublon pam - #grep -q -e '#auth substack password-auth' /etc/pam.d/sshd || sed -i -e 's/auth substack password-auth/#auth substack password-auth/g' /etc/pam.d/sshd - #grep -q -e 'auth requisite pam_unix.so' /etc/pam.d/sshd || sed -i '\$aauth requisite pam_unix.so' /etc/pam.d/sshd - #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 - + # Build project + cd ${BUILDDIR} + cmake -B rublon_ssh-build .. + cmake --build rublon_ssh-build -- -j + cmake --build rublon_ssh-build --target package -- -j useradd -s /bin/bash -m bwi echo "bwi:bwi"|chpasswd - - systemctl restart sshd.service SHELL end diff --git a/os/debian/11/Vagrantfile b/os/debian/11/Vagrantfile index 06e4b8e..5cf3d37 100755 --- a/os/debian/11/Vagrantfile +++ b/os/debian/11/Vagrantfile @@ -23,7 +23,7 @@ Vagrant.configure("2") do |config| config.vm.synced_folder "../../..", "/home/vagrant/Rublon-Linux" config.vm.provider "virtualbox" do |vb| - vb.memory = 1024 + vb.memory = 4048 vb.cpus = 4 # Display the VirtualBox GUI when booting the machine vb.gui = true @@ -36,7 +36,9 @@ Vagrant.configure("2") do |config| # 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 - + export BASE=/home/vagrant/Rublon-Linux + export DISTRO=debian11 + export BUILDDIR=${BASE}/${DISTRO} DEBIAN_FRONTEND=noniteracactive\ apt-get update && apt-get install -y \ gcc \ @@ -50,33 +52,20 @@ Vagrant.configure("2") do |config| cmake # get dependencies - git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git - mkdir socket.io-client-cpp/build; cd socket.io-client-cpp/build - cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --target install + mkdir ${BUILDDIR} -p; cd ${BUILDDIR} + git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git + cmake -B socket.io-build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release socket.io-client-cpp + cmake --build socket.io-build --target install -- -j # Build project - cd /home/vagrant/Rublon-Linux - cmake -B buildir && cmake --build buildir - - # Install - sudo cmake --install buildir - sudo install -m 644 rsc/rublon.config.defaults /etc/rublon.config - - # Register Rublon pam - SSHD_CONF=/etc/ssh/sshd_config - SSHD_PAM_CONF=/etc/pam.d/sshd - - grep -qe "^PasswordAuthentication" $SSHD_CONF && sed -i 's/^#*PasswordAuthentication[[:space:]]\+.*/PasswordAuthentication yes/' $SSHD_CONF || echo "PasswordAuthentication yes" >> $SSHD_CONF - grep -qe "^ChallengeResponseAuthentication" $SSHD_CONF && sed -i 's/^#*ChallengeResponseAuthentication[[:space:]]\+.*/ChallengeResponseAuthentication yes/' $SSHD_CONF || echo "ChallengeResponseAuthentication yes" >> $SSHD_CONF - grep -qe "^UsePAM" $SSHD_CONF && sed -i 's/^#*UsePAM[[:space:]]\+.*/UsePAM yes/' $SSHD_CONF || echo "UsePAM yes" >> $SSHD_CONF - - grep -qe 'auth required pam_rublon.so' $SSHD_PAM_CONF || sed -i '\$aauth required pam_rublon.so' $SSHD_PAM_CONF - grep -qe 'account required pam_rublon.so' $SSHD_PAM_CONF || sed -i '\$aaccount required pam_rublon.so' $SSHD_PAM_CONF - - useradd -s /bin/bash -m bwi - echo "bwi:bwi"|chpasswd - - service sshd restart + cd ${BUILDDIR} + cmake -B rublon_ssh-build .. + cmake --build rublon_ssh-build -- -j + cmake --build rublon_ssh-build --target package -- -j + # Register Rublon pam + + useradd -s /bin/bash -m bwi + echo "bwi:bwi"|chpasswd + sudo dpkg -i /home/vagrant/Rublon-Linux/${BUILDDIR}/*rublon*Debian* SHELL end diff --git a/os/debian/12/Vagrantfile b/os/debian/12/Vagrantfile index b8b8f35..b7e266c 100755 --- a/os/debian/12/Vagrantfile +++ b/os/debian/12/Vagrantfile @@ -25,7 +25,7 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine vb.gui = true - vb.memory = 1024 + vb.memory = 4044 vb.cpus = 4 # Fix for 'SSH auth method: Private key' stuck @@ -36,7 +36,9 @@ Vagrant.configure("2") do |config| # 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 - + export BASE=/home/vagrant/Rublon-Linux + export DISTRO=debian12 + export BUILDDIR=${BASE}/${DISTRO} DEBIAN_FRONTEND=noniteracactive\ apt-get update && apt-get install -y \ gcc \ @@ -50,33 +52,20 @@ Vagrant.configure("2") do |config| cmake # get dependencies - git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git - mkdir socket.io-client-cpp/build; cd socket.io-client-cpp/build - cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --target install + mkdir ${BUILDDIR} -p; cd ${BUILDDIR} + git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git + cmake -B socket.io-build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release socket.io-client-cpp + cmake --build socket.io-build --target install -- -j # Build project - cd /home/vagrant/Rublon-Linux - cmake -B build && cmake --build build - - # Install - sudo cmake --install build - sudo install -m 644 rsc/rublon.config.defaults /etc/rublon.config - - # Register Rublon pam - SSHD_CONF=/etc/ssh/sshd_config - SSHD_PAM_CONF=/etc/pam.d/sshd - - grep -qe "^PasswordAuthentication" $SSHD_CONF && sed -i 's/^#*PasswordAuthentication[[:space:]]\+.*/PasswordAuthentication yes/' $SSHD_CONF || echo "PasswordAuthentication yes" >> $SSHD_CONF - grep -qe "^ChallengeResponseAuthentication" $SSHD_CONF && sed -i 's/^#*ChallengeResponseAuthentication[[:space:]]\+.*/ChallengeResponseAuthentication yes/' $SSHD_CONF || echo "ChallengeResponseAuthentication yes" >> $SSHD_CONF - grep -qe "^UsePAM" $SSHD_CONF && sed -i 's/^#*UsePAM[[:space:]]\+.*/UsePAM yes/' $SSHD_CONF || echo "UsePAM yes" >> $SSHD_CONF - - grep -qe 'auth required pam_rublon.so' $SSHD_PAM_CONF || sed -i '\$aauth required pam_rublon.so' $SSHD_PAM_CONF - grep -qe 'account required pam_rublon.so' $SSHD_PAM_CONF || sed -i '\$aaccount required pam_rublon.so' $SSHD_PAM_CONF - - useradd -s /bin/bash -m bwi - echo "bwi:bwi"|chpasswd - - service sshd restart + cd ${BUILDDIR} + cmake -B rublon_ssh-build .. + cmake --build rublon_ssh-build -- -j + cmake --build rublon_ssh-build --target package -- -j + # Register Rublon pam + + useradd -s /bin/bash -m bwi + echo "bwi:bwi"|chpasswd + sudo dpkg -i /home/vagrant/Rublon-Linux/${BUILDDIR}/*rublon*Debian* SHELL end diff --git a/os/rhel/9/Vagrantfile b/os/rhel/9/Vagrantfile index 047ec8c..8903e60 100755 --- a/os/rhel/9/Vagrantfile +++ b/os/rhel/9/Vagrantfile @@ -23,8 +23,8 @@ Vagrant.configure("2") do |config| config.vm.synced_folder "../../..", "/home/vagrant/Rublon-Linux" config.vm.provider "virtualbox" do |vb| - vb.memory = 1024 - vb.cpus = 4 + vb.memory = 4024 + # Display the VirtualBox GUI when booting the machine vb.gui = true @@ -36,48 +36,28 @@ Vagrant.configure("2") do |config| # 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 - + export BASE=/home/vagrant/Rublon-Linux + export DISTRO=rhel9 + export BUILDDIR=${BASE}/${DISTRO} + cp ${BASE}/helpers/centos-base_9.repo /etc/yum.repos.d/centos-base_9.repo yum update - yum install -y gcc openssl-devel libcurl systemd-pam git-review rapidjson-devel cmake - wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.4.tar.xz - tar -xf git* - cd git* - sudo make configure - sudo ./configure --prefix=/usr - sudo make all - sudo make install + yum install -y gcc openssl-devel openssh libcurl systemd-pam git rapidjson-devel cmake rpm-build lsb-release pam-devel libcurl-devel policycoreutils + useradd -s /bin/bash -m bwi + echo "bwi:bwi"|chpasswd # get dependencies - git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git - mkdir socket.io-client-cpp/build; cd socket.io-client-cpp/build - cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --target install - - #handle semodule - cd /home/vagrant/Rublon-Linux/service - checkmodule -M -m -o login_rublon.mod login_rublon.te - semodule_package -o login_rublon.pp -m login_rublon.mod + mkdir ${BUILDDIR} -p; cd ${BUILDDIR} + git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git + cmake -B socket.io-build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release socket.io-client-cpp + cmake --build socket.io-build --target install -- -j # Build project - cd /home/vagrant/Rublon-Linux - cmake -B build && cmake --build build - # Install - sudo cmake --install build - sudo install -m 644 /home/vagrant/Rublon-Linux/rsc/rublon.config.defaults /etc/rublon.config + cd ${BUILDDIR} + cmake -B rublon_ssh-build .. + cmake --build rublon_ssh-build -- -j + cmake --build rublon_ssh-build --target package -- -j + # Register Rublon pam + rpm -U ./rublon_ssh-build/rublon*.rpm - #handle semodule - cd /home/vagrant/Rublon-Linux/service - semodule -i login_rublon.pp - - # Register Rublon pam - sed -i 's/UsePAM .*/UsePAM yes/' /etc/ssh/sshd_config - sed -i 's/ChallengeResponseAuthentication .*/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config - 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 - - useradd -s /bin/bash -m bwi - echo "bwi:bwi"|chpasswd - - systemctl restart sshd.service SHELL end diff --git a/os/ubuntu/20.04/Vagrantfile b/os/ubuntu/20.04/Vagrantfile index f7acaaf..5b46370 100755 --- a/os/ubuntu/20.04/Vagrantfile +++ b/os/ubuntu/20.04/Vagrantfile @@ -24,7 +24,6 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |vb| vb.memory = 2560 - vb.vcpu = 4 # Display the VirtualBox GUI when booting the machine vb.gui = false @@ -66,12 +65,8 @@ Vagrant.configure("2") do |config| cmake --build rublon_ssh-build --target package -- -j # Register Rublon pam - SSHD_CONF=/etc/ssh/sshd_config - grep -qe "^PasswordAuthentication" $SSHD_CONF && sed -i 's/^#*PasswordAuthentication[[:space:]]\+.*/PasswordAuthentication yes/' $SSHD_CONF useradd -s /bin/bash -m bwi echo "bwi:bwi"|chpasswd sudo dpkg -i /home/vagrant/Rublon-Linux/${BUILDDIR}/*pam_* - cp /home/vagrant/Rublon-Linux/rublon.config /etc/rublon.config - service sshd restart SHELL end diff --git a/os/ubuntu/22.04/Vagrantfile b/os/ubuntu/22.04/Vagrantfile index 8e1d0f3..28b2b34 100755 --- a/os/ubuntu/22.04/Vagrantfile +++ b/os/ubuntu/22.04/Vagrantfile @@ -23,8 +23,7 @@ Vagrant.configure("2") do |config| config.vm.synced_folder "../../..", "/home/vagrant/Rublon-Linux" config.vm.provider "virtualbox" do |vb| - vb.memory = 2560 - vb.vcpu = 4 + vb.memory = 4000 # Display the VirtualBox GUI when booting the machine vb.gui = false @@ -36,7 +35,9 @@ Vagrant.configure("2") do |config| # 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 - + export BASE=/home/vagrant/Rublon-Linux + export DISTRO=ubuntu2204 + export BUILDDIR=${BASE}/${DISTRO} DEBIAN_FRONTEND=noniteracactive\ apt-get update && apt-get install -y \ gcc \ @@ -49,34 +50,21 @@ Vagrant.configure("2") do |config| rapidjson-dev \ cmake - # get dependencies - git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git - mkdir socket.io-client-cpp/build; cd socket.io-client-cpp/build - cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --target install - - # Build project - cd /home/vagrant/Rublon-Linux - cmake -B build && cmake --build build - - # Install - sudo cmake --install build - sudo install -m 644 rsc/rublon.config.defaults /etc/rublon.config - - # Register Rublon pam - SSHD_CONF=/etc/ssh/sshd_config - SSHD_PAM_CONF=/etc/pam.d/sshd - SSHD_CONFD=/etc/ssh/sshd_config.d/60-cloudimg-settings.conf - - grep -qe "^PasswordAuthentication" $SSHD_CONF && sed -i 's/^#*PasswordAuthentication[[:space:]]\+.*/PasswordAuthentication yes/' $SSHD_CONF - sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' $SSHD_CONFD - - useradd -s /bin/bash -m bwi - echo "bwi:bwi"|chpasswd - cd ./build - make package - sudo dpkg -i /home/vagrant/Rublon-Linux/build/*pam_* - cp /home/vagrant/Rublon-Linux/rublon.config /etc/rublon.config - service sshd restart + # get dependencies + mkdir ${BUILDDIR} -p; cd ${BUILDDIR} + git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git + cmake -B socket.io-build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release socket.io-client-cpp + cmake --build socket.io-build --target install -- -j + ln -s /usr/bin/make /usr/bin/gmake + # Build project + cd ${BUILDDIR} + cmake -B rublon_ssh-build .. + cmake --build rublon_ssh-build -- -j + cmake --build rublon_ssh-build --target package -- -j + # Register Rublon pam + + useradd -s /bin/bash -m bwi + echo "bwi:bwi"|chpasswd + sudo dpkg -i /home/vagrant/Rublon-Linux/${BUILDDIR}/*pam_* SHELL end diff --git a/os/ubuntu/24.04/Vagrantfile b/os/ubuntu/24.04/Vagrantfile index b4b719e..416bd51 100644 --- a/os/ubuntu/24.04/Vagrantfile +++ b/os/ubuntu/24.04/Vagrantfile @@ -22,8 +22,7 @@ Vagrant.configure("2") do |config| config.vm.synced_folder "../../..", "/home/vagrant/Rublon-Linux" config.vm.provider "virtualbox" do |vb| - vb.memory = 2560 - vb.vcpu = 4 + vb.memory = 4000 # Display the VirtualBox GUI when booting the machine vb.gui = false @@ -35,7 +34,9 @@ Vagrant.configure("2") do |config| # 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 - + export BASE=/home/vagrant/Rublon-Linux + export DISTRO=ubuntu2404 + export BUILDDIR=${BASE}/${DISTRO} DEBIAN_FRONTEND=noniteracactive\ apt-get update && apt-get install -y \ gcc \ @@ -48,37 +49,21 @@ Vagrant.configure("2") do |config| rapidjson-dev \ cmake - # get dependencies - git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git - mkdir socket.io-client-cpp/build; cd socket.io-client-cpp/build - cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --target install - - # Build project - cd /home/vagrant/Rublon-Linux - cmake -B build && cmake --build build - - # Install - sudo cmake --install build - sudo install -m 644 rsc/rublon.config.defaults /etc/rublon.config - - # Register Rublon pam - SSHD_CONF=/etc/ssh/sshd_config - SSHD_PAM_CONF=/etc/pam.d/sshd - - grep -qe "^PasswordAuthentication" $SSHD_CONF && sed -i 's/^#*PasswordAuthentication[[:space:]]\+.*/PasswordAuthentication yes/' $SSHD_CONF || echo "PasswordAuthentication yes" >> $SSHD_CONF - grep -qe "^ChallengeResponseAuthentication" $SSHD_CONF && sed -i 's/^#*ChallengeResponseAuthentication[[:space:]]\+.*/ChallengeResponseAuthentication yes/' $SSHD_CONF || echo "ChallengeResponseAuthentication yes" >> $SSHD_CONF - grep -qe "^UsePAM" $SSHD_CONF && sed -i 's/^#*UsePAM[[:space:]]\+.*/UsePAM yes/' $SSHD_CONF || echo "UsePAM yes" >> $SSHD_CONF - - grep -qe 'auth required pam_rublon.so' $SSHD_PAM_CONF || sed -i '\$aauth required pam_rublon.so' $SSHD_PAM_CONF - grep -qe 'account required pam_rublon.so' $SSHD_PAM_CONF || sed -i '\$aaccount required pam_rublon.so' $SSHD_PAM_CONF - - useradd -s /bin/bash -m bwi - echo "bwi:bwi"|chpasswd -cd ./build -make package -sudo dpkg -i /home/vagrant/Rublon-Linux/build/*pam_* - cp /home/vagrant/Rublon-Linux/rublon.config /etc/rublon.config - service sshd restart + # get dependencies + mkdir ${BUILDDIR} -p; cd ${BUILDDIR} + git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git + cmake -B socket.io-build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release socket.io-client-cpp + cmake --build socket.io-build --target install -- -j + ln -s /usr/bin/make /usr/bin/gmake + # Build project + cd ${BUILDDIR} + cmake -B rublon_ssh-build .. + cmake --build rublon_ssh-build -- -j + cmake --build rublon_ssh-build --target package -- -j + # Register Rublon pam + + useradd -s /bin/bash -m bwi + echo "bwi:bwi"|chpasswd + sudo dpkg -i /home/vagrant/Rublon-Linux/${BUILDDIR}/*pam_* SHELL end