Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 09/02/2011, à 23:17

delium55

Gnucash - protéger ses données par chiffrement

Bonjour,

Gnucash est un logiciel de comptabilité personnel et de petite entreprise.

Je suis présentement en période d'apprentissage sur ce logiciel auquel in mangue un outil de protection de données vue qu'il n'est pas protégé par mot de passe.

Les informations que j'ai trouvé disent de chiffrer ses données avec Truecrypt, Axcrypt, Gnupg ou Openssl.

Je compte utiliser Truecript pour le chiffrement.
TrueCrypt demande une authentification avant de monter le disque virtuel chiffré. Une fois monté, celui-ci est vu comme un disque ordinaire et l'accès au système de fichiers inclus est totalement transparent.
TrueCrypt permet de mettre en place un système de répudiation crédible basé sur l'utilisation d'un volume TrueCrypt caché et sur le fait qu'un volume TruyeCrypt ne contient aucune forme de signature permettant de l'identifier.

Les "keyfiles" sont des fichiers dont le contenu est combiné avec le mot de passe. Outre le mot de passe, il faut fournir les bons "keyfiles" pour monter un disque chiffré. L'utilisation de "keyfiles" est optionnelle. Un "keyfile" peut résider sur un support amovible comme une clé USB, ce qui permet un authentification à deux éléments (ce que l'on sait, ce que l'on possède). Il est possible d'utiliser comme "keyfile" un support cryptographique respectant le standard PKCS#11 (clé USB ou carte à puce) ; dans ce cas le mot de passe n'est plus nécessaire.

Voiçi 3 méthodes trouvées sur le net qui permettent selon ce que j'en ai compris de faire le travail.
Je n'ai aucune connaissance en script et je me demande si les spécialistes sur ce forum pouvaient me dire quel est la meilleure solution et m'expliquer pourquoi?

1) Premier script
http://waronpants.net/?p=176
GnuCash Encryption  December 13th, 2010 | Scripts


I created an encrypted disk image using TrueCrypt. Normally, I mount the 
image, use GnuCash along with any bank statements that I also put on the 
image, close GnuCash, then dismount the drive. I don't leave the image 
mounted if I'm not actively using it.

Because I'm me, I scripted this.

#!/bin/sh

truecrypt $HOME/bank.tc /media/truecrypt52 && \
gnucash /media/truecrypt52/bank/GnuCash/bankstuff.gnucash && \
truecrypt -d $HOME/bank.tc

This hardly counts as a script. It's only one line. However, this one line 
automates everything I usually do. I only have to double-click the script 
file, and everything is ready.

How It Works

The "&&" on each line means that the command after it will only run if the 
command before it runs successfully.

The first command mounts my encrypted bank image. I find that I have to 
use "/media/truecrypt??" where "??" is a one or two digit number. This 
command launches a dialog box to enter the image password. If the password 
is incorrectly entered, truecrypt returns 1 instead of 0 (success), 
exiting the script.

Then, GnuCash is opened. The script waits until I close GnuCash to 
continue. So far, I haven't had GnuCash return anything but success.

The final line dismounts the image.

Caveats

All files relating to the encrypted image should be closed before closing 
GnuCash. Once GnuCash is closed, the script will try to dismount the 
drive. I don't know if truecrypt will wait to dismount the drive if a file 
is currently open.

The paths to all of the files involved are hard-coded in the script. If 
you change any file names or paths, remember to update the script.
*********************************************************************************************
2) 2e script,
Celui-ci utilise Openssl en place de Truecrypt pour chiffrer les données, 
est-ce une meilleure solution?
Si non, ce script est-il meilleure que le précédent si Openssl est 
remplacé par Truecrypt?

http://pluton8.wordpress.com/2011/01/31 … on-script/

By GnuCash files encryption ... on the 31st of Jan 2011

#!/bin/bash
# This is a script to work with an encrypted gnucash file. It asks for the
# password, decrypts the file, runs gnucash, and encrypts it back. Logs and
# backups are shredded at the end.
# Author: pluton <plutonpluton at mail.ru>
# Version: 1.0 (Sat Jan 29 2011)
# License: GNU GPL 3

CP=/bin/cp
KDIALOG=/usr/bin/kdialog
OPENSSL=/usr/bin/openssl
GNUCASH=/usr/bin/gnucash
SHRED=/bin/shred
BASENAME=/usr/bin/basename
CHMOD=/bin/chmod

FILE=~/main
FILETMP="${FILE}.tmp"
TIMEOUT=2   # seconds
TITLE=$( $BASENAME $0 )

notify() {
     [ -n "$1" ] && text="$1" || text="?"
     $KDIALOG --passivepopup "$text" --title "$TITLE" $TIMEOUT
}

[ -e "$FILE" ] || { notify "File '$FILE' was not found"; exit 1; }

pass=$( $KDIALOG --password "Enter the password /GC/" )
[ "$pass" == "" ] && { notify "The password is empty"; exit 2; }

if ! $OPENSSL enc -d -aes-256-cbc -in "$FILE" -out "$FILETMP" -pass stdin 
<<EOF
${pass}
EOF
then
     notify "The password seems to be wrong"
     exit 3
fi
$CHMOD go= "$FILETMP"
$CP -f "$FILE" "${FILE}.bkp"
$GNUCASH "$FILETMP"
if ! $OPENSSL enc -e -aes-256-cbc -in "$FILETMP" -out "$FILE" -pass stdin 
<<EOF
${pass}
EOF
then
     notify "An error occured while encoding (code #$?)"
     exit 4
fi
unset pass
$SHRED -zun 2 "${FILETMP}"*
notify "Done"
******************************************************************************************
3) 3e solution proposée.
http://ubuntu-utah.ubuntuforums.org/sho … ?p=3265493
Kilarin, August 27th, 2007, 10:28 PM

I _tried_ to register at the TrueCrypt forum. They are not exactly eager 
to help over there.
That seems odd, they have a pretty active forum over there.

I guess I'm looking for how to decrypt the volume after I encrypt it. I do 
not find anywhere the day-to-day usage instructions for this program. What 
would I do after I power up my computer? How do I put in the password? I'm 
just not finding useful documentation on TrueCrypt.

I decrypt and mount a truecrypt volume on Ubuntu FF 7 like this:
From the terminal go into the media directory and create a new folder to 
mount the true crypt volume on. I named mine tc1 (for truecrypt1), but you 
can name it whatever you want. The commands to do this are:
cd /media <-this takes you to the media folder
sudo mkdir tc1 <-this creates the tc1 folder, you will have to enter your 
password

Now, you can mount your truecrypt volume on to tc1 using this command in 
the terminal:

truecrypt -u /media/sda1/mytruecryptvol /media/tc1

of course, change /media/sda1/mytruecryptvol to whatever the location and 
name of your encrypted truecrypt volume is.

You will now be prompted twice, once to enter your user password for root 
access, then again for the password of the encrypted volume.

Once you've typed both in, your truecrypt volume is mounted and available, 
a shortcut to it should appear on your desktop.

If the volume is formatted as ntfs so that you can also access it from 
windows, and assuming you have already installed ntfs-3g drivers for read 
write access to ntfs volumes, change your mount command to:

truecrypt -u /media/sda1/mytruecryptvol /media/tc1 --filesystem ntfs-3g

When you are ready to dismount the volume, enter the terminal command:
truecrypt -d /media/tc1

truecrypt -d
will dismount all volumes that are not currently busy.

Now then, there is another pesky and annoying detail. having to enter your 
user password every time you mount a volume, as well as the volume 
password, is quite... frustrating. you can eliminate this problem (at the 
cost of slightly lower security) by doing the following:

export EDITOR=gedit
sudo visudo

now you are editing the /etc/sudoers file. at end add:
yourusername ALL= NOPASSWD: /usr/bin/truecrypt

Save and exit and now truecrypt will not require your user password.

BUT, if you are mounting the same volume all the time, you don't really 
want to have to type in the terminal command every time you log on. So, 
you can set up a launcher like this:

right click top bar/add to panel/custom application launcher
type=application in terminal name=truecrypt-mount
command=truecrypt -u /media/sda1/mytruecryptvol /media/tc1

of course change the name to whatever you want, and the command to use the 
correct location of your encrypted volume and its mount point.

You can also create a "dismount all" launcher in a similar manner:

right click top bar/add to panel/custom application launcher
type=application in terminal name=truecrypt-dismount-all 
command=truecrypt-d


BUT, while clicking on a launcher is certainly more convenient than 
retyping the entire command into the terminal, well, you MIGHT just want 
to have the truecrypt volume mount automatically every time you log on, 
without you having to click ANYTHING, and this you can do! You just have 
to add the mount command to your session startup program list. And thats 
actually pretty easy to do:

System/Preferences/Sessions
From the "Startup Programs" tab, click "New"
Name=truecrypt-mount
Command=/usr/bin/gnome-terminal -x /usr/bin/truecrypt -u 
media/disk/DCH/evol/dch /media/tc1

usr/bin/gnome-terminal -x /usr/bin/truecrypt -u /media/sda1/mytruecryptvol 
/media/tc1

Again using your own encrypted volume path and mount point. You need the 
gnome-terminal because you can't actually enter the password unless you 
have a terminal window to enter the password in!

One warning when using this method. If your encrypted volume is on a USB 
drive, this will probably not work because the USB drive will not be 
mounted when the startup programs run.
***********************************************************************************************************************
Si l'un d'entre-vous a une solution simple et efficace je suis preneur.

Merçi de votre aide.:)

Hors ligne

#2 Le 10/02/2011, à 14:17

Kooothor

Re : Gnucash - protéger ses données par chiffrement

Salut,

Truecrypt est une application graphique très facile à utiliser. (et terriblement efficace)
Je t'invite à l'installer et à la prendre en main.
Ensuite seulement, tu pourras t'intéresser à une façon de scripter les mount/umount smile

@+
~ktr

Hors ligne

#3 Le 10/02/2011, à 20:03

delium55

Re : Gnucash - protéger ses données par chiffrement

Bonjour Koothor,

Truecrypt a été téléchargé et sera installer ce soir, pour l'utilisation, comme tu dis cela semble très simple selon les tutoriels que j'ai lu içi http://free.korben.info/index.php/TrueC … e_passe.29,
http://uselinux.over-blog.fr/article-me … 12352.html
et là http://www.siteduzero.com/tutoriel-3-19 … crypt.html

Ce soir ce sera l'apprentissage de GRsync pour mes sauvegardes sur mon nouveau disque dur externes et certains répertoires en FAT (certains logiciels "Win" obligent) seront chiffrés avec Truecrypt. (Içi cela devrait aller)

Pour l'automatisme de mes sauvegardes je compte utiliser Gnome Schedule, pas de problème en vue içi également.

Mais j'aimerais bien automatiser la protection (confidentialité) de mes fichiers de comptabilité, voilà ma demande d'aide; j'ai compris le fonctionnement général des scripts mais pas toutes les subtilitées et j'aimerais connaitre le pour et le contre de chacun.

Salutations,

hmm

Dernière modification par delium55 (Le 10/02/2011, à 20:04)

Hors ligne

#4 Le 10/02/2011, à 23:58

Kooothor

Re : Gnucash - protéger ses données par chiffrement

delium55 a écrit :

Pour l'automatisme de mes sauvegardes je compte utiliser Gnome Schedule, pas de problème en vue içi également.

cronjob -e
man cron

C'est toujours utile de savoir prendre en main les outils de base au lieu d'utiliser des utilitaires graphiques plus complexes. (pareil, essaie d'apprendre rsync plutôt que d'utiliser grsync, ça te sera utile dans le futur lorsque tu écriras toi-même ton script de sauvegarde.
Un coup de pouce : rsync -avz --delete --exclude excluded-folder/ /home/user/datas /media/truecrypt1/
Cette commande va transférer le dossier datas dans /media/truecrypt1, en supprimant les fichiers supprimés, en sans prendre en compte le dossier /home/user/datas/excluded-folder.

delium55 a écrit :

Mais j'aimerais bien automatiser la protection (confidentialité) de mes fichiers de comptabilité, voilà ma demande d'aide; j'ai compris le fonctionnement général des scripts mais pas toutes les subtilitées et j'aimerais connaitre le pour et le contre de chacun.

Si tu sauvegardes tes données sensibles sur une partition truecrypt, alors elles seront protégées dès que tu umount le disque (ou que tu éteins l'ordi !)

Hors ligne

#5 Le 11/02/2011, à 16:49

wido

Re : Gnucash - protéger ses données par chiffrement

Bonjour,
il est pas mal de script avec truecrypt smile

Hors ligne

#6 Le 11/02/2011, à 21:40

delium55

Re : Gnucash - protéger ses données par chiffrement

Bonjour,

Merçi Koothor pour les conseils j'y regarde de près.

Bonjour Wido,
Peux-tu m'expliquer la différence entre le 1er script et la solution 3 qui utilise des commandes avec le terminal et si l'un est meilleur que l'autre.

Salutations,:)

Hors ligne