From 5100809baa7e148abba1db6a3b1e5dbc120094d4 Mon Sep 17 00:00:00 2001 From: priv <140729444+scriptprivate@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:06:26 -0300 Subject: [PATCH 01/11] feat: add openSUSE support (#162) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(config): create openSUSE torrc configurationĀ file * feat(device): add openSUSE detection * feat(install): add openSUSE installation command --- .configs/opensuse-torrc | 20 ++++++++++++++++++++ lib/Nipe/Utils/Device.pm | 7 ++++++- lib/Nipe/Utils/Install.pm | 5 +++-- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 .configs/opensuse-torrc diff --git a/.configs/opensuse-torrc b/.configs/opensuse-torrc new file mode 100644 index 0000000..4f5535d --- /dev/null +++ b/.configs/opensuse-torrc @@ -0,0 +1,20 @@ +DataDirectory /var/lib/tor +PidFile /var/run/tor/tor.pid +RunAsDaemon 1 +User tor + +ControlSocket /var/run/tor/control +ControlSocketsGroupWritable 1 + +CookieAuthentication 1 +CookieAuthFileGroupReadable 1 +CookieAuthFile /var/run/tor/control.authcookie + +Log notice file /var/log/tor/log + +ClientOnly 1 +TransPort 9051 +DNSPort 9061 + +VirtualAddrNetwork 10.66.0.0/255.255.0.0 +AutomapHostsOnResolve 1 diff --git a/lib/Nipe/Utils/Device.pm b/lib/Nipe/Utils/Device.pm index 23ade61..5747829 100644 --- a/lib/Nipe/Utils/Device.pm +++ b/lib/Nipe/Utils/Device.pm @@ -28,8 +28,13 @@ package Nipe::Utils::Device { $device{distribution} = "void"; } + elsif (($id_like =~ /[S,s]use/) || ($id_distro =~ /[O,o]pen[S,s]use/)) { + $device{username} = "tor"; + $device{distribution} = "opensuse"; + } + return %device; } } -1; \ No newline at end of file +1; diff --git a/lib/Nipe/Utils/Install.pm b/lib/Nipe/Utils/Install.pm index 1b2ff09..9b240f0 100644 --- a/lib/Nipe/Utils/Install.pm +++ b/lib/Nipe/Utils/Install.pm @@ -12,7 +12,8 @@ package Nipe::Utils::Install { "fedora" => "dnf install -y tor iptables", "centos" => "yum -y install epel-release tor iptables", "void" => "xbps-install -y tor iptables", - "arch" => "pacman -S --noconfirm tor iptables" + "arch" => "pacman -S --noconfirm tor iptables", + "opensuse" => "zypper install -y tor iptables" ); if ($device{distribution} eq "void") { @@ -29,4 +30,4 @@ package Nipe::Utils::Install { } } -1; \ No newline at end of file +1; From 92d66fcff8e853f8503ba86dd3478e93988b87d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:44:26 -0300 Subject: [PATCH 02/11] Update cpanfile --- cpanfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpanfile b/cpanfile index 2ed7c1a..1641b13 100644 --- a/cpanfile +++ b/cpanfile @@ -1,3 +1,3 @@ requires "JSON", "4.07"; requires "Try::Tiny", "0.31"; -requires "Config::Simple", "4.58"; \ No newline at end of file +requires "Config::Simple"; From 00f107d5eb180f7f8e92ccf39fe2f6fe7d0cc457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:59:29 -0300 Subject: [PATCH 03/11] Update cpanfile --- cpanfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpanfile b/cpanfile index 1641b13..9a21d8f 100644 --- a/cpanfile +++ b/cpanfile @@ -1,3 +1,5 @@ +requires "Net::SSL"; +requires "IO::Socket::SSL"; requires "JSON", "4.07"; requires "Try::Tiny", "0.31"; requires "Config::Simple"; From a7cb670e8696f2d103673f190fc454ca0cc83129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:30:15 -0300 Subject: [PATCH 04/11] Create zarn.yml --- .github/workflows/zarn.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/zarn.yml diff --git a/.github/workflows/zarn.yml b/.github/workflows/zarn.yml new file mode 100644 index 0000000..ef58357 --- /dev/null +++ b/.github/workflows/zarn.yml @@ -0,0 +1,25 @@ +name: ZARN SAST + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '28 23 * * 1' + +jobs: + zarn: + name: Security Static Analysis with ZARN + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Perform Static Analysis + uses: htrgouvea/zarn@0.0.9 + + - name: Send result to Github Security + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: result.sarif From 4ef1d7496ae1ee47fa836af34d5ef1ae34519c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:30:50 -0300 Subject: [PATCH 05/11] Create linter.yml --- .github/workflows/linter.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..cba9251 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,16 @@ +name: Linter / Perl Critic + +on: + pull_request: + branches: + - main + +jobs: + critic: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run Perl::Critic + uses: natanlao/perl-critic-action@v1.1 + with: + files: critic From fb2f065e7411a4829eea4bba4df559fb185ff6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:31:16 -0300 Subject: [PATCH 06/11] Create .perlcriticrc --- .perlcriticrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .perlcriticrc diff --git a/.perlcriticrc b/.perlcriticrc new file mode 100644 index 0000000..745932b --- /dev/null +++ b/.perlcriticrc @@ -0,0 +1,3 @@ +severity = 5 + +[-TestingAndDebugging::RequireUseStrict] From f505208e0fda888132e98c036fb315f3e7b354b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:03:57 -0300 Subject: [PATCH 07/11] Update test-ubuntu.yml --- .github/workflows/test-ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml index 1101838..f9020fb 100644 --- a/.github/workflows/test-ubuntu.yml +++ b/.github/workflows/test-ubuntu.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v1 - name: Install dependencies run: | - sudo apt install -y perl cpanminus gcc make + sudo apt install -y perl cpanminus gcc make zlib1g-dev sudo cpanm --installdeps . sudo perl nipe.pl install - name: Verify Nipe status From dff63c48677dd2157b1d6af0e8885ee63ef72d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:05:20 -0300 Subject: [PATCH 08/11] Create test-debian.yml --- .github/workflows/test-debian.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/test-debian.yml diff --git a/.github/workflows/test-debian.yml b/.github/workflows/test-debian.yml new file mode 100644 index 0000000..d72a7fc --- /dev/null +++ b/.github/workflows/test-debian.yml @@ -0,0 +1,18 @@ +name: Test Nipe on Debian +on: [push] + +jobs: + build: + runs-on: debian-latest + + steps: + - uses: actions/checkout@v1 + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y perl cpanminus gcc make zlib1g-dev + sudo cpanm --installdeps . + sudo perl nipe.pl install + - name: Verify Nipe status + run: | + sudo perl nipe.pl status From 788d0934bfe1e14252c633e66ee62f4ea10c9520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:19:33 -0300 Subject: [PATCH 09/11] Create fedora.yml --- .github/workflows/fedora.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/fedora.yml diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml new file mode 100644 index 0000000..a146c0b --- /dev/null +++ b/.github/workflows/fedora.yml @@ -0,0 +1,17 @@ +name: Test Nipe on Fedora +on: [push] + +jobs: + build: + runs-on: fedora-latest + + steps: + - uses: actions/checkout@v1 + - name: Install dependencies + run: | + sudo dnf install -y perl cpanminus gcc make zlib-devel + sudo cpanm --installdeps . + sudo perl nipe.pl install + - name: Verify Nipe status + run: | + sudo perl nipe.pl status From e77ac3648fa3ba009034f1aa65634573f52f74ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:20:04 -0300 Subject: [PATCH 10/11] Create opensuse-test.yml --- .github/workflows/opensuse-test.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/opensuse-test.yml diff --git a/.github/workflows/opensuse-test.yml b/.github/workflows/opensuse-test.yml new file mode 100644 index 0000000..8e139fb --- /dev/null +++ b/.github/workflows/opensuse-test.yml @@ -0,0 +1,17 @@ +name: Test Nipe on openSUSE Leap +on: [push] + +jobs: + build: + runs-on: opensuse-leap-latest + + steps: + - uses: actions/checkout@v1 + - name: Install dependencies + run: | + sudo zypper --non-interactive install perl cpanminus gcc make zlib-devel + sudo cpanm --installdeps . + sudo perl nipe.pl install + - name: Verify Nipe status + run: | + sudo perl nipe.pl status From 19fb85aeb736af3084416248898164dea2244653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:20:21 -0300 Subject: [PATCH 11/11] Rename fedora.yml to fedora-test.yml --- .github/workflows/{fedora.yml => fedora-test.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{fedora.yml => fedora-test.yml} (100%) diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora-test.yml similarity index 100% rename from .github/workflows/fedora.yml rename to .github/workflows/fedora-test.yml