:::: MENU ::::

Home

  • Jan 26 / 2017
  • 0
Linux

Apache Directory Listing – Download

Some Apache servers do activate the DirectoryIndex so you can easily go through the directories listing over HTTP and download some files. It’ s often used for giving possibility to people to download multiple releases for a package/software.
But in some cases, it can be useful to download the content of a full tree view.

This can be done by using a simple tool available by default on Linux (can be downloaded on Windows/Mac): wget

Let’s take an example!

Without proxy

We want to download all the files on https://pkg.mywebsite.eu/releases/ which contains all the latest releases of our preferred soft.

Here, we are using many options to say to wget what we want to do:

  • -rTurn on recursive retrieving (max 5)
  • -np : Do not ever ascend to the parent directory when retrieving recursively
  • -nH –cut-dirs=1 : Disable generation of host-prefixed directories, and remove 1 level (here, remove “pkg.mywebsite.eu” and create a “releases” dir)
  • -l 15 Change default depth for downloading to 15 levels (default is 5)
  • -R index.html : Specify comma-separated lists of file name suffixes or patterns to reject

With proxy

Let’s now add a complexity, this server is only available through a proxy to protect the content. The proxy is available on your localhost (127.0.0.1) on port 3128 (default port for Squid Proxy):

Here, we just added 2 options to be able to send exactly the same request but using proxy:

  • -e use_proxy=yesExecute command to enable proxy
  • -e http_proxy=127.0.0.1:3128Execute command to give URL to use for HTTP proxy

 

  • Jan 02 / 2017
  • 0
Uncategorized

iTerm – Automatic mutliple panes with AppleScript

It’s often very useful to automate opening of multi panes with iTerm to execute many commands or getting access to many servers at the same time. This can be done through AppleScript.

You can copy this script and save it as multi-panes.scpt

Then, you just have to call the script directly:

And here is what you’re getting:

Feel free to add/remove/update the actions as needed!

  • Dec 07 / 2016
  • 0
Linux

Nagios plugin – Error “No such file or directory”

When trying to execute a nagios plugin, you’re getting this error:

But when checking further, the file does exist:

This can be due to some 32 bit libc libraries missing. To fix that, you will have to install the 32-bit shared libraries for AMD64 by installing this package:

And now, you can try again, error should have gone away!

  • Nov 24 / 2016
  • 0
Linux

NRPE – Enable command args (Jessie, …)

With recent versions of NRPE server, the possibility to enable command args has been disabled.

For example, on a Debian Jessie, you can get this kind of error on console:

and in logs:

!WARNING! This change can lead to security issue, this is why it has been disabled by default. You have to double check your servers can’t be reached from anywhere with NRPE commands (to avoid execution of unwanted or malicious code).

Once you’re sure there’s no security breach in your infra, you can go on with the installation of source:

Then, you’ll have to change the rules defined in the rules file:

You must add this line –enable-command-args after –libdir=/usr/lib/nagios.
You should so get something like

Finally, you can compile your new configuration and install it:

Ensure you set the value for dont_blame_nrpe in /etc/nagios/nrpe.cfg (this is the default path, it can be different depending on your installation).

And here you go, you can now restart your NRPE server and send any nrpe commands.

  • Nov 21 / 2016
  • 0
Linux

Apache – mod_auth compatibility for 2.2 and 2.4

Since Apache 2.4, mod_auth changed and some directive like

that have been replaced with

If you want to automatically handle same configuration for multiple servers where different versions of Apache are installed, you can use this trick:

Thanks to that change, your configuration will be working whatever version of Apache you’re using.

  • Nov 07 / 2016
  • 0
Database

PostgreSQL – Check value is in array

With PostgreSQL, if you have a field containing an Array and you want to get all the results containing this value in the array, you can use the following command.

Here, we are looking for all the results in the table my_table containing my_value in the field my_array.

Pages:12345678...17
Question ? Contact