apache2buddy icon indicating copy to clipboard operation
apache2buddy copied to clipboard

SS support along with netstat

Open sumitgarg44 opened this issue 3 years ago • 10 comments

As OS vendors are moving towards 'ss' than netstat in latest releases. I believe it will be worth to add ss support in apache2buddy script.

Regards Sumit Garg

sumitgarg44 avatar Oct 13 '22 13:10 sumitgarg44

Hi Sumit,

This has been in my radar for several years but so far all the Jenkins Tests are passing so I'm loathe to change things at the moment as it may break backward compatibility.

I'll certainly keep this issue open for now but if you get an os where netstat is no longer available and SS is the only option then we can take a look at it.

Hope you are keeping well.

Kind Regards Richard

On Thu, 13 Oct 2022, 14:37 sumit garg, @.***> wrote:

As OS vendors are moving towards 'ss' than netstat in latest releases. I believe it will be worth to add ss support in apache2buddy script.

Regards Sumit Garg

— Reply to this email directly, view it on GitHub https://github.com/richardforth/apache2buddy/issues/400, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNFIVY2VJHVC3TKDGGWV5DWDAGA3ANCNFSM6AAAAAAREJIDEM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

richardforth avatar Oct 13 '22 16:10 richardforth

I had one device having only SS but then I end up installing netstat temporarily :)

sumitgarg44 avatar Oct 13 '22 16:10 sumitgarg44

If you can remember what OS it was on I'll run some tests.

I know netstat has been a hard dependency for some time and I think the docker images I'm using I'm the Jenkins builds have it pre installed.

I could add another test without netstat and see if I can fall back on ss.

But as I said I'm petrified of breaking backwards compatibility.

On Thu, 13 Oct 2022, 17:41 sumit garg, @.***> wrote:

I had one device having only SS but then I end up installing netstat temporarily :)

— Reply to this email directly, view it on GitHub https://github.com/richardforth/apache2buddy/issues/400#issuecomment-1277895935, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNFIV3PGX7ERNIOGVWNDUTWDA3SVANCNFSM6AAAAAAREJIDEM . You are receiving this because you commented.Message ID: @.***>

richardforth avatar Oct 13 '22 16:10 richardforth

Unfortunately I don’t remember it exactly, I believe it was Ubuntu 20 or 22 LTS

sumitgarg44 avatar Oct 13 '22 17:10 sumitgarg44

# yum whatprovides ss
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

...


iproute-4.11.0-30.el7.x86_64 : Advanced IP routing and network device configuration tools
Repo        : base
Matched from:
Filename    : /usr/sbin/ss



iproute-4.11.0-25.el7_7.2.x86_64 : Advanced IP routing and network device configuration tools
Repo        : @base
Matched from:
Filename    : /sbin/ss



iproute-4.11.0-25.el7_7.2.x86_64 : Advanced IP routing and network device configuration tools
Repo        : @base
Matched from:
Filename    : /usr/sbin/ss

richardforth avatar Oct 30 '22 20:10 richardforth

I'm also in the process of adding an Ubuntu 22.04 Docker file and Jenkins stage in the pipeline

richardforth avatar Oct 30 '22 20:10 richardforth

  1671          # Check 2.1
  1672          # this script uses netstat to determine the port that apache is listening on
  1673          # process. make sure that netstat is available.
  1674          our $netstat = `which netstat`;
  1675          chomp($netstat);
  1676
  1677          # make sure that netstat is available within our path
  1678          if ( $netstat !~ m/.*\/netstat/ ) {
  1679                  show_crit_box();
  1680                  print "Unable to locate the netstat utility. This script requires netstat to determine the port that apache is listening on.\n";
  1681                  show_info_box(); print "${YELLOW}To fix this make sure the net-tools package is installed.${ENDC}\n";
  1682                  exit;
  1683          } else {
  1684                  if ( ! $NOOK ) { show_ok_box(); print "The utility 'netstat' exists and is available for use: ${CYAN}$netstat${ENDC}\n" }
  1685          }

richardforth avatar Oct 30 '22 20:10 richardforth

Thinking of setting some flags, and checking for netstat, and falling back to ss, then later in the script calling netstat or ss depending on what flag is set

richardforth avatar Oct 30 '22 20:10 richardforth

for ss

show_info_box(); print "${YELLOW}To fix this make sure the iproute package is installed.${ENDC}\n";

richardforth avatar Oct 30 '22 20:10 richardforth

or im also thinking of looking for ss first, and falling back to netstat, as this will likely future proof the logic for a few years, since ss is the new preferred command and netstat is being deprecated and probably eventually removed.

richardforth avatar Oct 30 '22 21:10 richardforth