BL🅾G News


« novembre 2019
123
45678910
11121314151617
18192021222324
252627282930

Actu G33k & Admin stuff.
Powered by 🅴🆁🆁🅴🆄🆁32

2 commentaires

alt

Corriger l'erreur HTTP Error 429: Too Many Requests avec youtube-dl

Si vous avez cette erreur avec youtube-dl


ERROR: Unable to download webpage: HTTP Error 429: Too Many Requests (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Il suffit simplement de de rajouter l'option --force-ipv4 dans votre commande :

youtube-dl  -o "%(title)s.%(ext)s" --force-ipv4 

Pour crée un alias allez dans votre .bashrc et rajouter :


alias ytdl='youtube-dl  -o "%(title)s.%(ext)s" --extract-audio --audio-format mp3 -k --force-ipv4 $1'
alias ytdlV='youtube-dl  -o "%(title)s.%(ext)s" --force-ipv4 $1'

La première ligne download et garde la vidèo et le mp3.
La seconde ligne download et garde que la vidéo.

Plus qu'a taper dans votre terminal :

ytdlV https://www.youtube.com/watch?v=7Uexuyy_HL8

résultat:

[youtube] 7Uexuyy_HL8: Downloading webpage
[youtube] 7Uexuyy_HL8: Downloading video info webpage
[youtube] 7Uexuyy_HL8: Extracting video information
[download] Destination: Stupeflip - The Antidote.f248.webm
[download] 100% of 1.50MiB in 00:00
[download] Destination: Stupeflip - The Antidote.f251.webm
[download] 100% of 3.24MiB in 00:00
[ffmpeg] Merging formats into "Stupeflip - The Antidote.webm"
Deleting original file Stupeflip - The Antidote.f248.webm (pass -k to keep)
Deleting original file Stupeflip - The Antidote.f251.webm (pass -k to keep)

by 🅴🆁🆁🅴🆄🆁32
Hosted on

🅴🅲🅷🔵🆂🆈🆂🆃🅴🅼



Aucun commentaire

alt

Letsencrypt c'est bien, mais savoir quand refaire les certifs de ses sites à temps c'est mieux :P
(oui letsencrypt enfin cerbot ne me met pas à jour automatiquement mes certificats... bug ?)

Donc voici un premier script pour savoir la validité du cetificat du domaine.

SSL Domaine Name Validity script BASH

- Create a file : ssl-cert-info
- Move this script in /bin of your server.

-----

nano ssl-cert-info


#!/bin/bash
 
usage()
{
cat <<EOF
Usage: $(basename $0) [options]
 
This shell script is a simple wrapper around the openssl binary. It uses
s_client to get certificate information from remote hosts, or x509 for local
certificate files. It can parse out some of the openssl output or just dump all
of it as text.
 
Options:
 
  --all-info   Print all output, including boring things like Modulus and 
               Exponent.
 
  --alt        Print Subject Alternative Names. These will be typically be 
               additional hostnames that the certificate is valid for.
 
  --cn         Print commonName from Subject. This is typically the host for 
               which the certificate was issued.
 
  --debug      Print additional info that might be helpful when debugging this
               script.
 
  --end        Print certificate expiration date. For additional functionality
               related to certificate expiration, take a look at this script:
               "http://prefetch.net/code/ssl-cert-check".
 
  --dates      Print start and end dates of when the certificate is valid.
 
  --file       Use a local certificate file for input.
 
  --help       Print this help message.
 
  --host       Fetch the certificate from this remote host.
 
  --name       Specify a specific domain name (Virtual Host) along with the
               request. This value will be used as the '-servername' in the 
               s_client command. This is for TLS SNI (Server Name Indication).
 
  --issuer     Print the certificate issuer.
 
  --most-info  Print almost everything. Skip boring things like Modulus and
               Exponent.
 
  --option     Pass any openssl option through to openssl to get its raw
               output.
 
  --port       Use this port when conneting to remote host. If ommitted, port
               defaults to 443.
 
  --subject    Print the certificate Subject -- typically address and org name.
 
Examples:
 
  1. Print a list of all hostnames that the certificate used by amazon.com 
     is valid for.
 
     $(basename $0) --host amazon.com --alt
     DNS:uedata.amazon.com
     DNS:amazon.com
     DNS:amzn.com
     DNS:www.amzn.com
     DNS:www.amazon.com
 
  2. Print issuer of certificate used by smtp.gmail.com. Fetch certficate info
     over port 465.
 
     $(basename $0) --host smtp.gmail.com --port 465 --issuer
     issuer= 
         countryName               = US
         organizationName          = Google Inc
         commonName                = Google Internet Authority G2
 
  3. Print valid dates for the certificate, using a local file as the source of 
     certificate data. Dates are formatted using the date command and display
     time in your local timezone instead of GMT.
 
     $(basename $0) --file /path/to/file.crt --dates
     valid from: 2014-02-04 16:00:00 PST
     valid till: 2017-02-04 15:59:59 PST
 
 
  4. Print certificate serial number. This script doesn't have a special option
     to parse out the serial number, so will use the generic --option flag to
     pass '-serial' through to openssl.
 
     $(basename $0) --host gmail.com --option -serial
     serial=4BF004B4DDC9C2F8
 
EOF
}
 
if ! [ -x "$(type -P openssl)" ]; then
  echo "ERROR: script requires openssl"
  echo "For Debian and friends, get it with 'apt-get install openssl'"
  exit 1
fi
 
while [ "$1" ]; do
  case "$1" in
        --file)
            shift
            crt="$1"
            source="local"
            ;;
        --host)
            shift
            host="$1"
            source="remote"
            ;;
        --port)
            shift
            port="$1"
            ;;
        --name)
            shift
            servername="-servername $1"
            ;;
        --all-info)
            opt="-text"
            ;;
        --alt)
            FormatOutput() { 
              grep -A1 "Subject Alternative Name:" | tail -n1 |
              tr -d ' ' | tr ',' '\n'
              }
            ;;
        --cn)
            opt="-subject -nameopt multiline"
            FormatOutput() { 
              awk '/commonName/ {print$NF}'
              }
            ;;
        --dates)
            opt="-dates"
            FormatOutput() { 
              dates=$(cat -)
              start=$(grep Before <<<"$dates" | cut -d= -f2-)
              end=$(grep After <<<"$dates" | cut -d= -f2-)
              echo valid from: $(date -d "$start" '+%F %T %Z')
              echo valid till: $(date -d "$end" '+%F %T %Z')
              }
            ;;
        --end)
            opt="-enddate"
            FormatOutput() { 
              read end
              end=$(cut -d= -f2- <<<"$end")
              date -d "$end" '+%F %T %Z'
              }
            ;;
        --issuer)
            opt="-issuer -nameopt multiline"
            ;;
        --most-info)
            opt="-text -certopt no_header,no_version,no_serial,no_signame,no_pubkey,no_sigdump,no_aux"
            ;;
        --option)
            shift
            opt="$1"
            ;;
        --subject)
            opt="-subject -nameopt multiline"
            ;;
        --help)
            usage
            exit 0
            ;;
        --debug)
            DEBUG="yes"
            ;;
        *)
            echo "$(basename $0): invalid option $1" >&2
            echo "see --help for usage"
            exit 1
                  ;;
  esac
  shift
done
 
CheckLocalCert()
{ 
  openssl x509 -in $crt -noout $opt
}
 
CheckRemoteCert()
{
  echo |
  openssl s_client $servername -connect $host:$port 2>/dev/null |
  openssl x509 -noout $opt
}
 
if [ -z "$(type -t FormatOutput)" ]; then
  FormatOutput() { cat; }
fi
 
if [ -z "$opt" ]; then
  opt="-text -certopt no_header,no_version,no_serial,no_signame,no_pubkey,no_sigdump,no_aux"
fi
 
if [ -z "$source" ]; then
  echo "ERROR: missing certificate source."
  echo "Provide one via '--file' or '--host' arguments."
  echo "See '--help' for examples." 
  exit 1
fi
 
if [ "$source" == "local" ]; then
  [ -n "$DEBUG" ] && echo "DEBUG: certificate source is local file"
  if [ -z "$crt" ]; then
    echo "ERROR: missing certificate file"
    exit 1
  fi
  [ -n "$DEBUG" ] && echo
  CheckLocalCert | FormatOutput
fi
 
if [ "$source" == "remote" ]; then
  [ -n "$DEBUG" ] && echo "DEBUG: certificate source is remote host"
  if [ -z "$host" ]; then
    echo "ERROR: missing remote host value."
    echo "Provide one via '--host' argument"
    exit 1
  fi
  if [ -z "$port" ]; then
    [ -n "$DEBUG" ] && echo "DEBUG: defaulting to 443 for port."
    port="443"
  fi
  [ -n "$DEBUG" ] && echo
  CheckRemoteCert | FormatOutput
fi
[/quote]

[b]And try this command : [/b]

[quote]$ ssl-cert-info --host gmail.com --dates[/quote]

[size=16]How to use this script[/size]

 - Command :

[quote]  ./ssl-cert-info --host gmail.com --dates[/quote]

Or

[quote]  ./ssl-cert-info --host gmail.com --end[/quote]

[size=16]Bash Function [/size] 
 
you can put this in the[b] .bashrc[/b]

# how to used :  ./ssl-check-date32.sh YOURHOSTNAME

 
[quote]
ssl-checks(){
   d=$1
./ssl-check-date2.sh  --host  $d  --end
}

Auto renew

put in Crontab


crontab -e
@monthly  /etc/init.d/apache2 stop && ./certbot-auto renew   --force-renew &&  /etc/init.d/apache2 start

REF: http://giantdorks.org/alain/shell-script-to-check-ssl-certificate-info-like-expiration-date-and-subject/

on
🅴🅲🅷🔵🆂🆈🆂🆃🅴🅼



Aucun commentaire

alt

Installation du thème bootstrap pour Munin

Pre-requis : installer munin ( apt-get install munin )

munin-template

Installation

cd /etc/munin
git clone https://github.com/munin-monitoring/contrib.git

Backup

mv /etc/munin/static /etc/munin/static.back
mv /etc/munin/templates /etc/munin/templates.back

Mise en place de nouveau répertoire

cp -pr contrib/templates/munstrap/static /etc/munin/
cp -pr contrib/templates/munstrap/templates /etc/munin/


Attendre minutes pour la régénération de la nouvealle page html

Enjoy :)

links : https://github.com/munin-monitoring/contrib/blob/master/templates/munstrap/README.md

by 🅴🆁🆁🅴🆄🆁32
Hosted on
🅴🅲🅷🅾🆂🆈🆂🆃🅴🅼



Aucun commentaire

Fail2ban est un outil parfait , sauf pour les envois automatique de mail en cas de redemarrage de ses services.

alt

un type de spam d'exemple :

Hi,

The jail apache has been started successfully.

Regards,

Fail2Ban

pour arreter ces envois régulier sans pour autant stopper celui des informations de BAN ( le plus important ) ,
alors ce script est fait pour vous:

On crééer le fichier .sh

nano diasble-fail2ban-mail-service.sh
#!/bin/bash
#
# Disable fail2ban jails start/stop/restart emails
#
#
cat << EOF >> /etc/fail2ban/action.d/disable-service-email.local
[Definition]
actionstart =
actionstop =
EOF
cd /etc/fail2ban/action.d/
ln -s disable-service-email.local mail.local
ln -s disable-service-email.local mail-buffered.local
ln -s disable-service-email.local mail-whois.local
ln -s disable-service-email.local mail-whois-lines.local
ln -s disable-service-email.local sendmail.local
ln -s disable-service-email.local sendmail-buffered.local
ln -s disable-service-email.local sendmail-whois.local
ln -s disable-service-email.local sendmail-whois-lines.local

On le rend exécutable.

 ~ # chmod +x diasble-fail2ban-mail-service.sh

On le lance

./diasble-fail2ban-mail-service.sh

Fini le spam de fail2ban ...

Un petit /etc/init.d/fail2ban restart histoire de vérifer ^^

Enjoy

---------

by 🅴🆁🆁🅴🆄🆁32
Hosted on
🅴🅲🅷🅾🆂🆈🆂🆃🅴🅼




Aucun commentaire

alt

UPDATE:
only working on LENNY/JESSIE version Debian 8

When you want to check your LSB in /usr/bin/lsb_release
and you see : No LSB modules are available.

Like this :

/usr/bin/lsb_release --all
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.6 (jessie)
Release:        8
Codename:       jessie

Fix :


$ apt-get install lsb-core

after install lsb-core:

/usr/bin/lsb_release --all
LSB Version:    core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch:security-4.0-amd64:security-4.0-noarch:security-4.1-amd64:security-4.1-noarch
Distributor ID: Debian
Description:    Debian GNU/Linux 8.6 (jessie)
Release:        8
Codename:       jessie

Enjoy :)

alt

by 🅴🆁🆁🅴🆄🆁32
Hosted on
🅴🅲🅷🅾🆂🆈🆂🆃🅴🅼