Mardi 8 avril 2 08 /04 /Avr 17:32

Installation

 

wget http://nmap.org/ncrack/dist/ncrack-0.4ALPHA.tar.gz

 

sudo apt-get install build-essential checkinstall libssl-dev  libssh-dev

 

tar xvfz ncrack-0.4ALPHA.tar.gz

 

cd ncrack-0.4ALPHA/ ./configure
make
checkinstall

dpkg -i ncrack_0.4ALPHA-1_amd64.deb

 

to remove :

dpkg -r ncrack

 

Using Ncrack:

ncrack 10.89.1.1:22

 


Par nitocris
Ecrire un commentaire - Voir les 0 commentaires
Mercredi 12 mars 3 12 /03 /Mars 07:32

 

Information from this comment : http://superuser.com/questions/365643/how-to-unzip-split-files-on-os-x/517758#517758

 

1. Pour creer un archive multi part (fichier només  zip, z01, z02...), dnas un terminal :

zip -s 100m -x "*.DS_Store" -r split-foo.zip foo/

2. Pour extraire une archive multipart (fichier només zip, z01, z01...), dans un terminal:

reconstruire l'archive unique

zip -s 0 split-foo.zip --out unsplit-foo.zip

puis l'extraire

unzip unsplit-foo.zip

Par nitocris - Publié dans : Linux
Ecrire un commentaire - Voir les 0 commentaires
Mercredi 5 mars 3 05 /03 /Mars 08:15

 

As root:

 

Install flashcache and tools

<code>

sudo apt-get install flashcache-dkms flashcache-utils
</code>

 

Setup Parameters :

<code>

cat <<EOF>>/etc/sysctl.conf


###################################################################
# FlashCache
#
# disable writing dirty cache data at shutdown (do this only if you really trust FC)
# dev.flashcache.fast_remove = 1
#
# change the reclaim policy from FIFO to LRU" >>/etc/sysctl.conf
dev.flashcache.reclaim_policy = 1
#
# Writeback
# do not write "stale" data to disk until evicted due to lack of space
#dev.flashcache.fallow_delay = 0
#
EOF

</code>

 

Start module and install it asdefautl module

<code>

sudo modprobe flashcache

sudo echo "flashcache" >> /etc/modules

</code>

 

check:

<code>

~# dmesg | grep flashcache
[ 2042.003705] flashcache: flashcache-2.0 initialized

#

lsmod |grep flashcach
flashcache             82952  0

</code>

 

# Step 4 - montage volume simple DATA/Home

# Find the UUID of the volume you want to cache:

<code>
ls -la /dev/disk/by-uuid/
</code>
#### mount DATA Drive


<code>

sudo umount /home/yoyo/eMule
sudo flashcache_create -v -p back filecache_data /dev/sda3 /dev/disk/by-uuid/45e71c47-a88f-4493-8b1a-e5bfcf7562b0

vi /etc/fstab
# Comment out the line with the device you want to cache
# Add a new line for the flashcache similar this:

# /home/yoyo/eMule was on /dev/sda5 during installation
#UUID=45e71c47-a88f-4493-8b1a-e5bfcf7562b0 /home/yoyo/eMule     reiserfs defaults        0       2
/dev/mapper/filecache_data /home/yoyo/eMule     reiserfs defaults,noatime,notail        0       2

</code>

 

#Step 5 - check
<code>
~# sudo dmsetup status
filecache_data: 0 325122048 flashcache stats:
    reads(2775), writes(37)
    read hits(3), read hit percent(0)
    write hits(11) write hit percent(29)
    dirty write hits(0) dirty write hit percent(0)
    replacement(0), write replacement(0)
    write invalidates(0), read invalidates(0)
    pending enqueues(0), pending inval(0)
    metadata dirties(37), metadata cleans(0)
    metadata batch(3) metadata ssd writes(34)
    cleanings(0) fallow cleanings(0)
    no room(0) front merge(0) back merge(0)
    disk reads(2772), disk writes(0) ssd reads(3) ssd writes(2843)
    uncached reads(0), uncached writes(0), uncached IO requeue(0)
    uncached sequential reads(0), uncached sequential writes(0)
    pid_adds(0), pid_dels(0), pid_drops(0) pid_expiry(0)

~# sudo dmsetup table
filecache_data: 0 325122048 flashcache conf:
    ssd dev (/dev/sda3), disk dev (/dev/disk/by-uuid/45e71c47-a88f-4493-8b1a-e5bfcf7562b0) cache mode(WRITE_BACK)
    capacity(10854M), associativity(512), data block size(4K) metadata block size(4096b)
    skip sequential thresh(0K)
    total blocks(2778624), cached blocks(286), cache percent(0)
    dirty blocks(5), dirty percent(0)
    nr_queued(0)
Size Hist: 4096:7007
filecache_home: 0 131246080 flashcache conf:
    ssd dev (/dev/sda2), disk dev (/dev/disk/by-uuid/c85a514b-0a7d-4c4c-8af6-dcea99ed773c) cache mode(WRITE_BACK)
    capacity(8158M), associativity(512), data block size(4K) metadata block size(4096b)
    skip sequential thresh(0K)
    total blocks(2088448), cached blocks(6081), cache percent(0)
    dirty blocks(1231), dirty percent(0)
    nr_queued(0)
Size Hist: 4096:7007 </code>

Par nitocris - Publié dans : Linux
Ecrire un commentaire - Voir les 0 commentaires
Mardi 1 janvier 2 01 /01 /Jan 08:22

 

1) Apache Web server

 

<code>

apt-get install apache2

</code>

 

It serves pages from folder : /var/www

 

<code>

head /etc/apache2/sites-available/default

 

<VirtualHost *:80>
       ServerAdmin webmaster@localhost

        DocumentRoot /var/www

</code>

 

create folder :

<code>

mkdir -p /var/www/sarg

</code>

 

2) SARG

 

<code>

apt-get install sarg

</code>

 

edit sarg conf file : /etc/sarg/sarg.conf

and change the following lines, the last only if you use dansguardian :

<code>

access_log /var/log/squid3/access.log
date_format e
output_dir /var/www/sarg

#
dansguardian_conf /etc/dansguardian/dansguardian.conf

</code>

 

3) SARG Report

 

configure sarg report, here it' in french

<code>

cat <<EOF>/etc/sarg/sarg-reports.conf
SARG=/usr/bin/sarg
CONFIG=/etc/sarg/sarg.conf
HTMLOUT=/var/www/sarg
PAGETITLE="Statitics Proxy $(hostname)"
LOGOIMG=/sarg/images/sarg.png
LOGOLINK="http://$(hostname)/"
DAILY=Jour
WEEKLY=Semaine
MONTHLY=Mois
EXCLUDELOG1="SARG: Pas d enregistrement trouvé"
EXCLUDELOG2="SARG: Fin"

EOF

</code>

 

modify the lines contanint $SARG to add the log floder "/var/log/squid3/access.log*" in the script /usr/sbin/sarg-reports

to have :

<code>

grep \$SARG sarg-reports
      $SARG -f $CONFIG -d $MANUALDATE -o $DAILYOUT /var/log/squid3/access.log*
  $SARG -f $CONFIG -d $TODAY -o $DAILYOUT /var/log/squid3/access.log* >$ERRORS 2>&1
  $SARG -f $CONFIG -d day-1 -o $DAILYOUT /var/log/squid3/access.log* >$ERRORS 2>&1
  $SARG -f $CONFIG -d week-1 -o $WEEKLYOUT /var/log/squid3/access.log* >$ERRORS 2>&1
  $SARG -f $CONFIG -d month-1 -o $MONTHLYOUT /var/log/squid3/access.log* >$ERRORS 2>&1

</code>

 

4) generate report manually

 

<code>

/usr/sbin/sarg-reports daily

/usr/sbin/sarg-reports weekly

/usr/sbin/sarg-reports monthly

</code>

 

there are un /var/www/sarg/

 

5) automate report generation with cron

 

edit root crontab and add the following lines :

 

<code>

crontab -e
@daily /usr/sbin/sarg-reports daily
0 01 * * 1 /usr/sbin/sarg-reports weekly
03 01 1 * * /usr/sbin/sarg-reports monthly


service cron restart

</code>

 

6) Logrotate

change logroate to only rotate logs monthly so we keep information for SARG

 

For Squid

<code>

sed -i 's/daily/monthly/' /etc/logrotate.d/squid3

</code>

 

For Dansguardian :

<code>

cat<<EOF>/etc/logrotate.d/dansguardian
/var/log/dansguardian/access.log {
        rotate 12
        monthly
        compress
        delaycompress
        prerotate
                /etc/init.d/dansguardian stop > /dev/null 2>&1 || true
                /usr/sbin/sarg-reports weekly > /dev/null 2>&1 || true
                /usr/sbin/sarg-reports monthly > /dev/null 2>&1 || true
        endscript
        postrotate
                /etc/init.d/dansguardian start > /dev/null 2>&1
        endscript
}

EOF

<code>

Par nitocris - Publié dans : Linux
Ecrire un commentaire - Voir les 0 commentaires
Jeudi 6 septembre 4 06 /09 /Sep 08:04

Using flash cahce with a SSD (/dev/sda) and a hardrive to spedd up access.

I suggest to use SSD drive with SLC memory instead off MLC as using a ssd as a cahce drive is expenisve in read/writa and te SSD as a limit. Intel SSD 313 (http://www.intel.com/content/www/us/en/solid-state-drives/solid-state-drives-313-series.html) are specially done for this.

 

#! flashcache
#

 

usefull documents reference :

 

# https://github.com/facebook/flashcache
# http://www.gerrit-tamboer.net/using-flashcache-to-speed-up-your-io-on-ubuntu-12-04/
# https://github.com/facebook/flashcache/wiki/QuickStart-Recipe-for-Ubuntu-11.10
# https://github.com/facebook/flashcache/blob/master/doc/flashcache-sa-guide.txt
# https://github.com/facebook/flashcache/blob/master/README-DKMS
#

 


# step 1 - Clonning Git Repository

apt-get install git-core

#> mkdir -p ~/Build/ ; cd ~/Build/

#> git clone https://github.com/facebook/flashcache.git
Cloning into 'flashcache'...
remote: Counting objects: 914, done.
remote: Compressing objects: 100% (357/357), done.
remote: Total 914 (delta 631), reused 831 (delta 553)
Receiving objects: 100% (914/914), 252.91 KiB | 199 KiB/s, done.
Resolving deltas: 100% (631/631), done.

# Step 2a - Building

# install building tools

sudo apt-get install git build-essential dkms linux-headers-`uname -r` uuid-dev

cd flashcache
sudo make -f Makefile.dkms all boot_conf

# Step 2b - Installation

sudo make install

cat <<EOF>>/etc/sysctl.conf


###################################################################
# FlashCache
#
# disable writing dirty cache data at shutdown (do this only if you really trust FC)
# dev.flashcache.fast_remove = 1
#
# change the reclaim policy from FIFO to LRU" >>/etc/sysctl.conf
dev.flashcache.reclaim_policy = 1
#
# Writeback
# do not write "stale" data to disk until evicted due to lack of space
#dev.flashcache.fallow_delay = 0
#
EOF

# Step 3 - Init

sudo modprobe flashcache
sudo echo "flashcache" >> /etc/modules

# Verification :

dmesg | tail
....................
[159671.822040] flashcache: flashcache-1.0 initialized

#
lsmod |grep flashcache
flashcache             82901  0

# Step 4 - montage volume simple DATA/Home

# Find the UUID of the volume you want to cache:
ls -la /dev/disk/by-uuid/



#### Home drive
sudo umount /home/yoyo
sudo flashcache_create -v -p back filecache_home /dev/sda2 /dev/disk/by-uuid/c85a514b-0a7d-4c4c-8af6-dcea99ed773c

vi /etc/fstab
# Comment out the line with the device you want to cache
# Add a new line for the flashcache similar this:

# /home/yoyo/ was on /dev/sda5 during installation
# UUID=c85a514b-0a7d-4c4c-8af6-dcea99ed773c /home           reiserfs defaults        0       2
/dev/mapper/filecache_data /home/yoyo     reiserfs defaults        0       2


#Step 5 - check

~# sudo dmsetup status
filecache_data: 0 325122048 flashcache stats:
    reads(2775), writes(37)
    read hits(3), read hit percent(0)
    write hits(11) write hit percent(29)
    dirty write hits(0) dirty write hit percent(0)
    replacement(0), write replacement(0)
    write invalidates(0), read invalidates(0)
    pending enqueues(0), pending inval(0)
    metadata dirties(37), metadata cleans(0)
    metadata batch(3) metadata ssd writes(34)
    cleanings(0) fallow cleanings(0)
    no room(0) front merge(0) back merge(0)
    disk reads(2772), disk writes(0) ssd reads(3) ssd writes(2843)
    uncached reads(0), uncached writes(0), uncached IO requeue(0)
    uncached sequential reads(0), uncached sequential writes(0)
    pid_adds(0), pid_dels(0), pid_drops(0) pid_expiry(0)

~# sudo dmsetup table

filecache_data: 0 325122048 flashcache conf:
    ssd dev (/dev/sda3), disk dev (/dev/disk/by-uuid/45e71c47-a88f-4493-8b1a-e5bfcf7562b0) cache mode(WRITE_BACK)
    capacity(14092M), associativity(512), data block size(4K) metadata block size(4096b)
    skip sequential thresh(0K)
    total blocks(3607552), cached blocks(2132154), cache percent(59)
    dirty blocks(11), dirty percent(0)
    nr_queued(0)
Size Hist: 4096:61231


# Step 6 - startup script to write data on exit

cat <<EOF>/etc/init.d/unflashcache
#! /bin/sh
### BEGIN INIT INFO
# Provides: unflashcache
# Required-Start:
# Required-Stop: 
# Should-Stop:
# Default-Start:
# Default-Stop: 0 6    
# Short-Description: Unload flashcache module and fs.
### END INIT INFO
 
PATH=/sbin:/bin
. /lib/init/vars.sh
 
. /lib/lsb/init-functions
 
do_stop () {
    echo Unload cachedev
    umount /data
    dmsetup remove cachedev
    rmmod flashcache   
}
 
case "$1" in
  start)
    # No-op
    ;;
  restart|reload|force-reload)
    echo "Error: argument '$1' not supported" >&2
    exit 3
    ;;
  stop)
    do_stop
    ;;
  *)
    echo "Usage: $0 start|stop" >&2
    exit 3
    ;;
esac
EOF

chmod 755  /etc/init.d/unflashcache
update-rc.d unflashcache start 39 0 6 .


# ################

# Step 7 - on root drive

sudo vi /etc/fstab
# Comment out the line with the device you want to cache
# Add a new line for the flashcache similar this:
# / was on /dev/sda1 during installation
#UUID=a8da2c39-109c-4be9-b70a-74d5720f30df /               btrfs   defaults,subvol=@ 0       1
/dev/mapper/filecache_root /               btrfs   defaults,subvol=@ 0       1

#Edit your /boot/grub/grub.cfg to change the root device to the flashcache device you intend to use.

- Boot off a live CD like the Ubuntu desktop installer.
- mount the partition with flashcache compiled
mount /dev/disk/by-uuid/c85a514b-0a7d-4c4c-8af6-dcea99ed773c /mnt
cd /mnt/yoyo/Build/flashcache
# install binary
make install
modprobe flashcache
# create root flashcache

flashcache_create -v -p back filecache_root /dev/sda1 /dev/disk/by-uuid/a8da2c39-109c-4be9-b70a-74d5720f30df

#if ok

reboot


######

# Step 8 - if needed
## Removing Flashcache from a Boot Volume

# First, ensure that dev.flashcache.fast_remove = 0 and reboot to minimize potential lost data
# Edit fstab
vi /etc/fstab
# Comment out the flashcache line and un-comment the original device line


# Reboot to recovery mode (hold left shift during boot)
# Mount / using the non-flashcache drive
mount -o relatime /dev/md0 /

# Remove the FC device mapper device
dmsetup remove fc-md

# Remove FC special SSD signature (change /dev/sdb with whatever your FC device is)
flashcache_destroy /dev/sdb

# Done, continue booting normally
exit

 

# remove module

dkms remove -m flashcache -v $(git describe  --always --abbrev=12) --all

Par nitocris - Publié dans : Linux
Ecrire un commentaire - Voir les 0 commentaires
 
Créer un blog gratuit sur over-blog.com - Contact - C.G.U. - Rémunération en droits d'auteur - Signaler un abus - Articles les plus commentés