htrgouvea / nipe

An engine to make Tor network your default gateway
https://heitorgouvea.me/
Other
1.95k stars 314 forks source link

Workaround for RPi install/error involving cpan (yaml) #76

Closed TheCyberTecky closed 4 years ago

TheCyberTecky commented 4 years ago

Raspberry Pi 3B+ (RPi) Arm64, running Kali Arm 2019.4 doesn't seem to work well with the cspan switch portion of the nipe install. Currently re-installing my RPi with Kali Arm 2019.3a which I believe worked well with nipe install before. I'll provide a progress update as soon as I complete that process. Nipe is such a great package, I'd hate to loose that particular functionality so it's worth the effort to troubleshoot for sure!

~ Chad

htrgouvea commented 4 years ago

@TheCyberTecky Any update about this?

TheCyberTecky commented 4 years ago

Follow-up on RPI 3B+ regarding my attempt to resolve install issue and script start issue was unsuccessful. I've tried several configuration method attempts such as:

a. Install/configure nipe on RPI 3B+ using a less resource demanding perl switch - Nipe FAILED. b. Attempted fresh install of Linux OS followed by install/configure - Status: FAILED. c. Installed swap file using 'dphys-swapfile' to provide 2048 swap size to the RPI 3B+ - Status: FAILED. d. Completed recommended steps listed on Nipe (Github) forum - Status: FAILED.

Overall, my assessment seems to point the issue to resource exhaustion on the RPI 3B+ during Nipe install of Perl switch portion of the installation instructions. Problem possibly attributed to recent Perl switch install size and resource demand increase from developers.

Solution: I'm availabile to help troubleshoot and test development changes to your Nipe script and/or willing to provide you with a secure remote access via SSH to the RPI 3B+ if that would help? I'm an avid user/supporter of the NIPE script for about 2 years now and it seems to work fine in x86/amd64 virtualbox linux environments, WIndows 10 Pro 64bit (WSL2), but I prefer doing my development and pentesting work from the RPI itself which Nipe normally would play an active role in. The current device is the RPI 3B+ but I'm considering the option to purchase the new RPI 4 variant which has more memory/resources, however, I would like to see the RPI 3B+ be compatible with Nipe as well.

Looking forward to helping where I can!

Chad

bmeneg commented 4 years ago

Hi @TheCyberTecky, that seems to be an interesting case, but we need some more information before we can tackle the possible issue, could you provide these:

I know RPi is resource limited compared to any PC, but it shouldn't get to be point of "exhaustion" running Nipe, that's why I'm asking these additional question to make sure we don't forget any other condition or possible cause in the middle.

Thank you very much!

TheCyberTecky commented 4 years ago

Hi Bruno,

I appreciate the quick response and your help on the RPI issue and look forward to helping where I can on getting Nipe to install/configure successfully on the RPI. I will do my best to answer your (3) questions:

  1. did you mean the issue happened during ./nipe.pl install command while processing its switch statements or during Perl::Switch module installation on the system?

ANSWER: The errors occurred during the “Perl::Switch” installation and the ‘#Install libs and dependencies’ step using the terminal command: “sudo cpan install Switch JSON LWP::UserAgent Config::Simple”. See details on question 2 below…

  1. what happens to the system when the issue happens? Did you receive any error/warning message in the console? Or your system just hangs? Or you lose connection?

ANSWER: There are (2) errors that I noticed. Error #1 I can’t seem to duplicate anymore but could still be an issue.

Error #1 - The first error occurred at the “Perl::Switch” of your Nipe installation instructions. This was were I originally received a resource timeout error which prompted me to create a larger swap file size. Error #2 - The second error occurred after executing the “sudo perl nipe.pl start” command from terminal and initially the terminal froze, then I executed the “ctrl+c” command from terminal to quit the process. I forgot to mention that there was an iptables issue that I previously reported in a separate post on your GitHub page, link here:

https://github.com/GouveaHeitor/nipe/issues/24#issuecomment-568610486 Note – Last year I was successful at installing/operating Nipe on my RPI 3B+, the only difference is that the previous system configuration prior to Nipe install has PIA VPN installed and fully operational. Now that I think about it I wonder if the ‘PIA VPN’ install (configuration) updated the iptables somehow? Might be worth my time to at least attempt the same configuration again? I’m sure I haven’t answered all of your inquiries as of yet but I can at least confirm that I am using SSH to access the RPI terminal and will attempt to complete the ‘dmesg’ and ‘journalctl -xe’ logs via serial – most likely via network (minicom) access. In the meantime, I’m thinking the main problem might be related with iptables and might be worth looking into? Thanks, Chad

From: Bruno Meneguelemailto:notifications@github.com Sent: Saturday, January 25, 2020 4:00 AM To: GouveaHeitor/nipemailto:nipe@noreply.github.com Cc: TheCyberTeckymailto:chad.jordan@outlook.com; Mentionmailto:mention@noreply.github.com Subject: Re: [GouveaHeitor/nipe] Workaround for RPi install/error involving cpan (yaml) (#76)

Hi @ , that seems to be an interesting case, but we need some more information before we can tackle the possible issue, could you provide these:

I know RPi is resource limited compared to any PC, but it shouldn't get to be point of "exhaustion" running Nipe, that's why I'm asking these additional question to make sure we don't forget any other condition or possible cause in the middle.

Thank you very much!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGouveaHeitor%2Fnipe%2Fissues%2F76%3Femail_source%3Dnotifications%26email_token%3DAM3HX4LGTAW2OQLY4CQWDLLQ7QLUHA5CNFSM4J4LNAXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ42FJI%23issuecomment-578396837&data=02%7C01%7C%7Cbe4f8054d8f74dd9343a08d7a185c5b0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637155468222981795&sdata=qnkFQ%2F5w70aTRbvNUniPEx0WGB07phYV%2BcIjd3QWAD4%3D&reserved=0, or unsubscribehttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAM3HX4OICV3BAUGAELSZ6CTQ7QLUHANCNFSM4J4LNAXA&data=02%7C01%7C%7Cbe4f8054d8f74dd9343a08d7a185c5b0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637155468222991803&sdata=WYbCaa0I3%2FIH476z22hzY5WMJ8hVETCyrZTnwh8QofA%3D&reserved=0.

bmeneg commented 4 years ago

Hmmm ok. Well.. lets keep discussing error number 2 at issue #24 and lets focus about error number 1 in this issue here.

@GouveaHeitor is planning to use other module to actually handle command line parameters, instead of using a switch-case statement, so I think we can do that earlier than planned to get rid of this issue, for sure. But at the same time, I think the information you can gather to us will help to limit ourselves in future changes of the code during decision making about which module should be used, or not, for certain tasks.

I'm going to give you some steps that I would like to see the output/results, if you don't mind of course:

Grab all this data and paste at gist.github.com and then copy+paste the link of the generated gist here to us.

One workaround you could try is to install Perl::Switch module from system's repository instead of metacpan:

# apt install libswitch-perl

TheCyberTecky commented 4 years ago

I’m still a bit new at using Github (from a developer perspective) but I’ll do my best to provide feedback on your questions. Please forgive me if I end up providing too much detail but in this case I’m sure you could use all data I see on my end. NOTE – Noticed new error generated after re-installing Nipe that I believe is associated with one of the developer fixes that are being worked on by PR?

ERROR: “[!] ERROR: sorry, it was not possible to establish a connection to the server.”

Listed below are my responses to your feedback -

a) cpan install perl::switch (DMESG) https://gist.github.com/TheCyberTecky/8c093c923a622cee6a891cd347e96677#file-cpan-install-perl-switch-dmesg-rtf b) cpan install perl::switch (LIVE INSTALL RECORD) https://gist.github.com/TheCyberTecky/25876fc7c0fd7c4747fdfe091825986a#file-nipe-cpan-install-switch-json-live-output-rtf

c) ./nipe.pl install (FREE+DMESG) https://gist.github.com/TheCyberTecky/9090637a71a5562dab97b47a1b9d2ef5#file-nipe-pl-install-dmesg-rtf

d) ./nipe.pl start (DMESG) https://gist.github.com/TheCyberTecky/87465d9ee93b474f90402d234ce14665#file-nipe-pl-status-start-dmesg-rtf

From: Bruno Meneguele notifications@github.com Sent: Saturday, January 25, 2020 2:53 PM To: GouveaHeitor/nipe nipe@noreply.github.com Cc: TheCyberTecky chad.jordan@outlook.com; Mention mention@noreply.github.com Subject: Re: [GouveaHeitor/nipe] Workaround for RPi install/error involving cpan (yaml) (#76)

Hmmm ok. Well.. lets keep discussing error number 2 at issue #24https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGouveaHeitor%2Fnipe%2Fissues%2F24&data=02%7C01%7C%7C02443d69c2dc4d00443308d7a1e0f101%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637155859792444293&sdata=XJe%2FwneFyzWP77SbONZZdE6Pd6lxWFjIJUqgvTGCdYw%3D&reserved=0 and lets focus about error number 1 in this issue here.

@GouveaHeitorhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGouveaHeitor&data=02%7C01%7C%7C02443d69c2dc4d00443308d7a1e0f101%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637155859792454292&sdata=JxJMMUszS2rw5v0QaO%2FphtC5hG4dnzPHrAJDocewyAY%3D&reserved=0 is planning to use other module to actually handle command line parameters, instead of using a switch-case statement, so I think we can do that earlier than planned to get rid of this issue, for sure. But at the same time, I think the information you can gather to us will help to limit ourselves in future changes of the code during decision making about which module should be used, or not, for certain tasks.

I'm going to give you some steps that I would like to see the output/results, if you don't mind of course:

Grab all this data and paste at gist.github.com and then copy+paste the link of the generated gist here to us.

One workaround you could try is to install Perl::Switch module from system's repository instead of metacpan:

apt install libswitch-perl

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGouveaHeitor%2Fnipe%2Fissues%2F76%3Femail_source%3Dnotifications%26email_token%3DAM3HX4IS5HBEWDEOZ5L4N33Q7SYDTA5CNFSM4J4LNAXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ5GHKY%23issuecomment-578446251&data=02%7C01%7C%7C02443d69c2dc4d00443308d7a1e0f101%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637155859792464309&sdata=e0sB%2BXqh6Gm2132QfOforvNGStJtwtjgOzLv3QTqFJ8%3D&reserved=0, or unsubscribehttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAM3HX4KOR3Q6H6HJADS6R3LQ7SYDTANCNFSM4J4LNAXA&data=02%7C01%7C%7C02443d69c2dc4d00443308d7a1e0f101%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637155859792474320&sdata=r56FV7UYfi5SFfNXFEwj%2BqNSaWU%2FTzYnVgdQxco5VWg%3D&reserved=0.

bmeneg commented 4 years ago

@TheCyberTecky unfortunately I couldn't notice anything wrong during Perl::Switch install :/ but we're going to remove its dependency from the code anyway, just not sure when, but hopefully soon.

I'm going to keep this issue open while the total drop of Perl::Switch doesn't happen.

dvinciguerra commented 4 years ago

We dont need Switch module to dispatch sub commands...

See my example:

#!/usr/bin/env perl

use v5.10;
use feature qw/say/;

package Nipe::Commands;

my $COMMANDS = {
  install => "Nipe::Commands::Install",
  restart => "Nipe::Commands::Restart",
  start   => "Nipe::Commands::Start",
  status  => "Nipe::Commands::Status",
  stop    => "Nipe::Commands::Stop",
};

sub run {
  my ($self, $argv) = @_;

  my $subcommand = $argv->[0];
  my $command_class = $COMMANDS->{$subcommand};

  unless ($command_class) {
    say "Nipe::Commands::Help";
    exit
  }

  say $command_class; # $command_class->new(...)
  exit
}

package main;

Nipe::Commands->run(\@ARGV);
bmeneg commented 4 years ago

@dvinciguerra that's actually a good suggestion, but at the same time it would need a way to handle command options (-c, -f, ...). Take a look on the current state of "develop" branch, that's where the most recent changes goes until the maintainer merge it to "master" branch, there you'll see that some commands already have different options supported.

@GouveaHeitor was already planning to change Perl::Switch module to Getopt::* (Std and Long probably) that are core modules to handle short and long options. Feel free to check "develop" branch and possibly submit a pull request, thus we can review the code through there.

dvinciguerra commented 4 years ago

Yep, About sub commands options... it's possible delegating to each sub command to configure/parse their own options using Getopt::Long as you commented.

Something like this example:

package Nipe::Commands::Start;
use strict;
use warnings;

use Getopt::Long qw(GetOptionsFromArray);

sub run {
  my ($self, $arguments) = @_;

  my $options = _parse_arguments($arguments);

  use Data::Dumper; print Dumper($options);

  print $self;
}

sub _parse_arguments {
  my ($arguments) = @_;

  my $options = {
    config => '',
    force => 0,
  };

  GetOptionsFromArray(
    $arguments,
    "config=s" => \$options->{config},
    "force" => \$options->{force},
  );

  return $options;
}

1;

I'm writing a PR, changing the project to work this way! =)

bmeneg commented 4 years ago

@dvinciguerra , nicely done :ok_hand: ! will be waiting your PR to try it out :)

dvinciguerra commented 4 years ago

CC @bmeneguele, @GouveaHeitor

I have worked in some code on this branch... https://github.com/dvinciguerra/nipe/tree/code-and-command-args-improvements

It's a very early stage code (without tests btw), but can you see the progress and give some impressions or feedback!?

htrgouvea commented 4 years ago

Hi @dvinciguerra,

I took a look at your code and really liked its implementations ...

Feel free to open a PR when you believe it's time!

Just try to stay in sync with our updates on the "develop" branch, there's a lot of new stuff there!

Thx!!

dvinciguerra commented 4 years ago

I'm merged develop branch and now I'm fixing some things. 🤘

Can I count with you to test this version? (I don't have a compatible OS ready to test =/)

In the future, I was thinking to write automated tests to make easier change code productively and securely. =)

Thanks dudes! =)

bmeneg commented 4 years ago

Can I count with you to test this version?

Yep, sure. Will take a look on that soon!

In the future, I was thinking to write automated tests to make easier change code productively and securely. =)

Yees! That's something I'm working on for already existing code/features. We certainly need some unit/integration/regression testing done here :))

Thanks!

TheCyberTecky commented 4 years ago

Hi folks,

CyberTecky will gladly participate in some testing as well. As always, everyone’s efforts and time invested in this project is much appreciated!

Chad

Sincerely,

Chad Jordan Email chad.jordan@outlook.commailto:chad.jordan@outlook.com

From: Bruno Meneguele notifications@github.com Sent: Monday, February 24, 2020 8:23 AM To: GouveaHeitor/nipe nipe@noreply.github.com Cc: TheCyberTecky chad.jordan@outlook.com; Mention mention@noreply.github.com Subject: Re: [GouveaHeitor/nipe] Workaround for RPi install/error involving cpan (yaml) (#76)

Can I count with you to test this version?

Yep, sure. Will take a look on that soon!

In the future, I was thinking to write automated tests to make easier change code productively and securely. =)

Yees! That's something I'm working on for already existing code/features. We certainly need some unit/integration/regression testing done here :))

Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGouveaHeitor%2Fnipe%2Fissues%2F76%3Femail_source%3Dnotifications%26email_token%3DAM3HX4ONUXPPADKFSCJFSWDREPQ4NA5CNFSM4J4LNAXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMYG42Q%23issuecomment-590376554&data=02%7C01%7C%7C1ec9ae432c134647569208d7b93d66cf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637181545669166965&sdata=RCV%2FbVbHIFC1ylES%2BFAb8am82FMlRegzs3Pcqx%2BF7Ig%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAM3HX4IJHRVIK5QAIRPBFZTREPQ4NANCNFSM4J4LNAXA&data=02%7C01%7C%7C1ec9ae432c134647569208d7b93d66cf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637181545669166965&sdata=yGojcwVrZwgBoUXwepoCOK8tq9%2BRiOU3oofJ0M8dfWc%3D&reserved=0.

dvinciguerra commented 4 years ago

The PR https://github.com/GouveaHeitor/nipe/pull/99

htrgouvea commented 4 years ago

Resolved.