Rechercher dans ce blog

mercredi 9 avril 2014

Activer ssl / tls DOVECOT ubuntu 8.04 IMAPS

Dovecot SSL Configuration

To configure dovecot to use SSL, you can edit the file /etc/dovecot/dovecot.conf and amend following lines:

ssl_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
ssl_disable = no
disable_plaintext_auth = no


Si on génère des certificats selon la méthode ci-dessous, alors remplacer ssl-cert-snakeoil.pem ssl-cert-snakeoil.key par les server.crt server.key

Generating a Certificate Signing Request (CSR)

Whether you are getting a certificate from a CA or generating your own self-signed certificate, the first step is to generate a key.

If the certificate will be used by service daemons, such as Apache, Postfix, Dovecot, etc, a key without a passphrase is often appropriate. Not having a passphrase allows the services to start without manual intervention, usually the preferred way to start a daemon.

This section will cover generating a key with a passphrase, and one without. The non-passphrase key will then be used to generate a certificate that can be used with various service daemons.

[Warning]

Running your secure service without a passphrase is convenient because you will not need to enter the passphrase every time you start your secure service. But it is insecure and a compromise of the key means a compromise of the server as well.

To generate the keys for the Certificate Signing Request (CSR) run the following command from a terminal prompt:

openssl genrsa -des3 -out server.key 1024

%%%

Generating RSA private key,

1024 bit long modulus .....................++++++ .................++++++

unable to write 'random state' e is 65537 (0x10001)

Enter pass phrase for server.key:

You can now enter your passphrase. For best security, it should at least contain eight characters. The minimum length when specifying -des3 is four characters. It should include numbers and/or punctuation and not be a word in a dictionary. Also remember that your passphrase is case-sensitive.

Re-type the passphrase to verify. Once you have re-typed it correctly, the server key is generated and stored in theserver.key file.

Now create the insecure key, the one without a passphrase, and shuffle the key names:

openssl rsa -in server.key -out server.key.insecure

mv server.key server.key.secure

mv server.key.insecure server.key

The insecure key is now named server.key, and you can use this file to generate the CSR without passphrase.

To create the CSR, run the following command at a terminal prompt:

openssl req -new -key server.key -out server.csr

It will prompt you enter the passphrase. If you enter the correct passphrase, it will prompt you to enter Company Name, Site Name, Email Id, etc. Once you enter all these details, your CSR will be created and it will be stored in the server.csr file.

You can now submit this CSR file to a CA for processing. The CA will use this CSR file and issue the certificate. On the other hand, you can create self-signed certificate using this CSR.

Creating a Self-Signed Certificate

To create the self-signed certificate, run the following command at a terminal prompt:

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

The above command will prompt you to enter the passphrase. Once you enter the correct passphrase, your certificate will be created and it will be stored in the server.crt file.

[Warning]

If your secure server is to be used in a production environment, you probably need a CA-signed certificate. It is not recommended to use self-signed certificate.

Installing the Certificate

You can install the key file server.key and certificate file server.crt, or the certificate file issued by your CA, by running following commands at a terminal prompt:

sudo cp server.crt /etc/ssl/certs

sudo cp server.key /etc/ssl/private

Now simply configure any applications, with the ability to use public-key cryptography, to use the certificate and key files. For example, Apache can provide HTTPS, Dovecot can provide IMAPS and POP3S, etc.



Si l'on veut un certificat qui dure plus longtemps que 365 jours simplement indiquer le nombre de jours voulus dans l'option -days

lundi 18 novembre 2013

fix del key in vim

DEL key ne fonctionne pas correctement dans VIM avec Mac os X LION

Il faut ajouter dans .vimrc

" fix del

set t_kD=CTRL-V "DEL KEY"

ce qui donne

" fix del

set t_kD=^[[3~

Il faut pour que DEL passe bien ^[[3~ modifier également inputrc avec quelque chose comme

"\e[1~": beginning-of-line

"\e[4~": end-of-line

"\e[5~": beginning-of-history

"\e[6~": end-of-history

"\e[3~": delete-char

"\e[2~": quoted-insert

"\e[5C": forward-word

"\e[5D": backward-word

"\e\e[C": forward-word

"\e\e[D": backward-word

set completion-ignore-case On

qui contient le delete-char.

Pour que la KEY DEL fonctionne bien avec VIM sur la machine distante en ssh, il faut aussi modifier le .vimrc du serveur hôte.

Il y a une instruction VIM :fixdel qui peut arranger apparemment certains problèmes mais qui ne fonctionne pas dans ce cas.

Voir :help fixdel pour plus d'infos.

jeudi 14 novembre 2013

Fix delete touch in TERMINAL app on mac os X LION

Delete touch in TERMINAL app doesn't work on LION

To fix that, edit an /etc/inputrc file or an ~/.inputrc

"\e[1~": beginning-of-line

"\e[4~": end-of-line

"\e[5~": beginning-of-history

"\e[6~": end-of-history

"\e[3~": delete-char

"\e[2~": quoted-insert

"\e[5C": forward-word

"\e[5D": backward-word

"\e\e[C": forward-word

"\e\e[D": backward-word

set completion-ignore-case On

dimanche 3 mars 2013

commentaires récents sur blogger

Pour ajouter un widget qui affiche les commentaires récents sur blogger :
-------------------------------------------------------------------------------------------------
SOURCE http://viti-vino.blogspot.be/2011/01/gadget-blogger-commentaires-recents.html

2011/01/11


Le Gadget Blogger pour afficher les Commentaires récents


Il existe plusieurs versions de ce Gadget. Ils sont pour la plupart en anglais ou présentent le défaut d'afficher les caractères spéciaux avec leur valeur affichée en entité HTML. Ainsi l'apostrophe est affichée ' (janvier 2011).

Le Gadget de Madtomatoe affiche l'apostrophe correctement, mais le texte de présentation des commentaires est en anglais. Il s'agit en réalité d'un script javascript à insérer dans un gadget HTML / JAVASCRIPT.

Le Gadget Blogger lecteur de Flux, permet d'afficher le Flux des commentaires, mais il n'affiche pas le texte du commentaire lui-même !

J ai donc réalisé un véritable Gadget Blogger qui est en français et affiche correctement les caractères spéciaux.

Ajouter le Gadget, avec Présentation / Ajouter un Gadget

Sélectionner Ajouter votre propre (Gadget). Saisir l'URL du gadget à ajouter :

http://prac-gadget.googlecode.com/files/commentaires-recents.xml

---------------------------------------------------------------------------------------------------

Dans le champ URL du blog il faut bien faire attention d'indiquer l'url en .com et non en .be et ne pas précéder le nom de domaine du http://

Le widget utilise le flux rss des commentaires, donc s'assurer qu'il est actif.



BLOG : L'adresse du Blog, par exemple viti-vino.blogspot.com.
Important : L adresse sans http://

NBC : Le nombre de commentaires à afficher (de 1 à 20, 5 par défaut)

MAX : La longueur du texte (de 50 à 500, 150 par défaut)

DATE : Faire figurer la date (Oui ou Non, par défaut Oui)

TBLOG : Afficher le titre du Blog (Oui ou Non, par défaut Oui)

TITRE : Faire figurer le titre du message (Oui ou Non, par défaut Oui)

AUTEUR : Faire figurer l'auteur (Oui ou Non, par défaut Oui)

TOP : Ouvrir les liens dans la même fenêtre (Oui ou Non, par défaut Non)

ALG : Alignement du texte (left ou justify)

TAILLE : Taille police en % (par défaut 85)

LCOL : La couleur des liens (par exemple #669922 ou green), par défaut le Gadget prend la couleur définie dans le modèle du Blog. Il faut préciser une couleur uniquement pour les anciens modèles de Blog, ou pour modifier la valeur standard.

TCOL : La couleur du texte

BCOL : La couleur du fond



lundi 19 novembre 2012

install transmission 2.7.3 on ubuntu hardy 8.04

Préparer ubuntu

sudo apt-get install build-essential automake autoconf libtool pkg-config intltool libcurl4-openssl-dev libglib2.0-dev libevent-dev (libminiupnpc-dev libminiupnpc5 libappindicator-dev)

*** Compiler libevent >= 2.0.10

http://libevent.org/

tar xvf libevent-2.0.20-stable.tar

cd libevent-2.0.20-stable

./configure

make

make verify

make install

libevent s’installe dans /usr/local/lib alors que transmission la veut dans /usr/lib

Solutions :

1 - LD_LIBRARY_PATH=”/usr/local/lib” transmission-daemon -h

2 - ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5

ldd /usr/local/bin/transmission-daemon

libevent-2.0.so.5 => /usr/lib/libevent-2.0.so.5 (0xb76e8000)

*** Compiler transmission

tar xvjf transmission-2.73.tar.bz2

./configure —disable-gtk —disable-mac —disable—cli

make -s

make install

Un fichier de configuration est crée au premier lancement du daemon dans ~/.config//transmission-daemon/settings.json

La blocklist peut être mise dans ~/.config/transmission-daemon/blocklist/

au format bluetack : http://www.bluetack.co.uk/config/level1.gz

Script de démarrage pour lancer transmission en tant que mldonkey avec mise à jour de la blocklist et rotation du logfile

#!/bin/sh

### BEGIN INIT INFO

# Provides: transmission-daemon

# Required-Start: networking

# Required-Stop: networking

# Default-Start: 2 3 5

# Default-Stop: 0 1 6

# Short-Description: Start the transmission BitTorrent daemon client.

### END INIT INFO

# The name of the user that should run Transmission.

# It's RECOMENDED to run Transmission in it's own user,

# by default, this is set to 'transmission'.

# For the sake of security you shouldn't set a password

# on this user

USERNAME=mldonkey

# The folder where Transmission stores the config & web files.

# ONLY change this you have it at a non-default location

TRANSMISSION_HOME="/home/mldonkey/.config/transmission-daemon"

TRANSMISSION_WEB_HOME="/usr/local/share/transmission/web"

#

# The arguments passed on to transmission-daemon.

LOGFILE="/home/mldonkey/.config/transmission-daemon/transmission-daemon.log"

TRANSMISSION_ARGS="--logfile $LOGFILE --log-info"

BL_DIR="/home/mldonkey/.config/transmission-daemon/blocklists"

BL_URL="http://www.bluetack.co.uk/config/level1.gz"

# ----- END OF CONFIGURATION -----

#

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

DESC="bittorrent client"

NAME=transmission-daemon

DAEMON=$(which $NAME)

PIDFILE=/var/run/$NAME.pid

SCRIPTNAME=/etc/init.d/$NAME

# Exit if the binary is not installed

[ -x "$DAEMON" ] || exit 0

#

# Function that starts the daemon/service

#

rotate_logfile() {

if [ -f "${LOGFILE}" ]; then

mv "${LOGFILE}" "${LOGFILE}.last" 1> /dev/null 2>&1

fi

touch "${LOGFILE}"

chmod 666 "${LOGFILE}"

}

# Download a fresh blocklist if there isn't one or current one is over four days old

refresh_blocklist() {

find "${BL_DIR}" -mtime +4 -type f -name "level1" -exec /bin/rm {} \; 1>> "${LOGFILE}" 2>&1

if [ ! -f "${BL_DIR}/level1" ]; then

wget -q -O "${BL_DIR}/level1.gz" "${BL_URL}" 1>> "${LOGFILE}" 2>&1

if [ -f "${BL_DIR}/level1.gz" ]; then

/bin/gunzip "${BL_DIR}/level1.gz" 1>> "${LOGFILE}" 2>&1

if [ $? -eq 0 ]; then

chmod go+r "${BL_DIR}/level1" 1>> "${LOGFILE}" 2>&1

else

rm -f "${BL_DIR}/level1*" 1>> "${LOGFILE}" 2>&1

fi

fi

fi

}

do_start()

{

# Export the configuration/web directory, if set

if [ -n "$TRANSMISSION_HOME" ]; then

export TRANSMISSION_HOME

fi

if [ -n "$TRANSMISSION_WEB_HOME" ]; then

export TRANSMISSION_WEB_HOME

fi

# Return

# 0 if daemon has been started

# 1 if daemon was already running

# 2 if daemon could not be started

start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \

--exec $DAEMON --background --test -- -f $TRANSMISSION_ARGS > /dev/null \

|| return 1

start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \

--exec $DAEMON --background -- -f $TRANSMISSION_ARGS \

|| return 2

}

#

# Function that stops the daemon/service

#

do_stop()

{

# Return

# 0 if daemon has been stopped

# 1 if daemon was already stopped

# 2 if daemon could not be stopped

# other if a failure occurred

start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE --exec $DAEMON

RETVAL="$?"

[ "$RETVAL" = 2 ] && return 2

# Wait for children to finish too if this is a daemon that forks

# and if the daemon is only ever run from this initscript.

# If the above conditions are not satisfied then add some other code

# that waits for the process to drop all resources that could be

# needed by services started subsequently. A last resort is to

# sleep for some time.

start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON

[ "$?" = 2 ] && return 2

# Many daemons don't delete their pidfiles when they exit.

rm -f $PIDFILE

return "$RETVAL"

}

case "$1" in

start)

echo "Starting $DESC" "$NAME..."

rotate_logfile

case "$?" in

0) echo " Rotating logfile succeeded" ;;

*) echo " Rotating logfile failed" ;;

esac

refresh_blocklist

case "$?" in

0) echo " Refreshing blocklist succeeded" ;;

*) echo " Refreshing blocklist failed" ;;

esac

do_start

case "$?" in

0|1) echo " Starting $DESC $NAME succeeded" ;;

*) echo " Starting $DESC $NAME failed" ;;

esac

;;

stop)

echo "Stopping $DESC $NAME..."

do_stop

case "$?" in

0|1) echo " Stopping $DESC $NAME succeeded" ;;

*) echo " Stopping $DESC $NAME failed" ;;

esac

;;

restart|force-reload)

#

# If the "reload" option is implemented then remove the

# 'force-reload' alias

#

echo "Restarting $DESC $NAME..."

do_stop

case "$?" in

0|1)

do_start

case "$?" in

0|1) echo " Restarting $DESC $NAME succeeded" ;;

*) echo " Restarting $DESC $NAME failed: couldn't start $NAME" ;;

esac

;;

*)

echo " Restarting $DESC $NAME failed: couldn't stop $NAME" ;;

esac

;;

*)

echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2

exit 3

;;

esac


jeudi 24 mai 2012

Raccourcis BASH

Control Key combinations (CTRL+KEY)

Ctrl + a : jump to the start of the line

Ctrl + b : move back a char

Ctrl + c : terminate the command

Ctrl + d : delete from under the cursor

Ctrl + e : jump to the end of the line

Ctrl + f : move forward a char

Ctrl + k : delete to EOL

Ctrl + l : clear the screen

Ctrl + r : search the history backwards

Ctrl + R : search the history backwards with multi-occurrence

Ctrl + u : delete backward from cursor

Ctrl + w : delete backward a word

Ctrl + xx : move between EOL and current cursor position

Ctrl + z : suspend/stop the command

Alt Key combinations (ALT+KEY)

Alt + < : move to the first line in the history

Alt + > : move to the last line in the history

Alt + ? : show current completion list

Alt + * : insert all possible completions

Alt + / : attempt to complete filename

Alt + . : yank last argument to previous command

Alt + b : move backward

Alt + c : capitalize the word

Alt + d : delete word

Alt + f : move forward

Alt + l : make word lowercase

Alt + n : search the history forwards non-incremental

Alt + p : search the history backwards non-incremental

Alt + r : recall command

Alt + t : move words around

Alt + u : make word uppercase

Alt + Backspace : delete backward from cursor

Escape Key combinations (ESC+KEY)

Esc + d : delete from cursor position to end of the word

Esc + f : move forward a word

Esc + b : move backward a word

Esc + t : transpose two adjacent words

lundi 7 mai 2012

How to make fetchmail happy with the YAHOO server’s SSL cert


Pour résoudre le problème indiqué dans le mail.log (solution un peu au pif en fonction de quelques informations que j'ai trouvées sur le net) :

fetchmail: Server certificate verification error: unable to get local issuer certificate
fetchmail: Server certificate verification error: certificate not trusted
fetchmail: Server certificate verification error: unable to verify the first certificate
Sous UBUNTU, première chose à essayer : mettre à jour les certificats :

apt-get upgrade ca-certificates

Redémarrer fetchmail et voir si le problème est corrigé.

Sinon essayer ceci.

Pour vérifier l'existence du répertoire fetchmail

ls -l /usr/local/etc/

Créer un répertoire de travail

mkdir /usr/local/etc/fetchmail
mkdir /usr/local/etc/fetchmail/certs

Se placer dans le répertoire de travail

cd /usr/local/etc/fetchmail/certs


openssl s_client -connect pop.mail.yahoo.fr:995 -showcerts > pop.mail.yahoo.fr.pem

vi pop.mail.yahoo.fr.pem

Cut and paste the stuff between the “—–BEGIN CERTIFICATE—–” and “—–END CERTIFICATE—–” lines (inclusive)

Vérifier dans l'output de la commande avant de couper BEGIN-END les lignes issuer

save & quit

Server certificate
subject=/C=US/ST=CA/L=Sunnyvale/O=Yahoo! Inc./OU=Yahoo/CN=pop.mail.yahoo.fr
issuer=/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3

Télécharger le certificat indiqué sur le site

wget https://www.digicert.com/CACerts/DigiCertHighAssuranceCA-3.crt

Je ne pense pas que ce soit nécessaire pour résoudre le problème yahoo, mais pendant que j'y suis je télécharge tous les certificats disponibles...

wget https://www.digicert.com/testroot/DigiCertGlobalRootCA.crt
wget https://www.digicert.com/testroot/DigiCertHighAssuranceEVRootCA.crt
wget https://www.digicert.com/testroot/DigiCertAssuredIDRootCA.crt

Je rename tous les .crt en .pem (ici avec la commande ubuntu)

rename s/crt/pem/ *

Je place (copie) tous les certificats dans le répertoire ssl
cp *.pem  /etc/ssl/certs/

Rehash obligatoire du répertoire contenant les certificats.

c_rehash /etc/ssl/certs/

On vérifie que tout s'est bien passé et que les certificats sont présents et avec les liens symboliques produits par le hashage.

cd /etc/ssl/certs/
ls -l

On redémarre fetchmail

/etc/init.d/fetchmail restart

Le message d'erreur doit avoir disparu.