martedì 23 dicembre 2014

[PHP bash Centos] create a server with a PHP script and daemonize it

I started from the need to receive JSON data from some devices, parse them and put in MySQL. Nothing better than a PHP script to perform this job, except that you need to manually launch it via bash, your ssh access will timeout, you could also check it via crontab with CPU waste, etc etc.

So I just developed my server listening on a port, made it able to receive multiple client connections and daemonized it: now I can start, stop, restart, ps au -> kill it, cat a logfile, have it ready on system reboot and everything I would expect from a regularly compiled application written in C++.

BUT... I can modify it whenever I like without recompiling it, it natively talks with its companion website, etc etc.

I tried mpdaemon and several other solutions... I already tested them all for you: at the end, nothing better than the easy way.

Tested with CentOS but you can easily apply it to Ubuntu.

PHP SERVER:

#!/usr/bin/php

<?

####### PHP ERROR HANDLING #######
if (function_exists('ini_set')) {
ini_set('display_errors', '1');
ini_set('error_reporting', '7');
ini_set('max_execution_time',0);// INFINITE
ini_set("memory_limit", "300M");
} else
error_reporting(E_ALL & ~E_NOTICE);
/*----------------------------------*/

####### INITIALIZE VARIABLES #######
date_default_timezone_set("Europe/Rome");
$client_socks = array(); //WILL CONTAIN ALL CLIENT SOCKETS
$client_data = array(); //WILL CONTAIN CLIENTS IP:PORT just for debug & compliance
$port = 4000;
$log = '/var/log/myDAEMON.log';


####### INCLUDE MYSQL AND OTHER CONFIGS #######
include("config.php");
/*----------------------------------*/

####### MYSQL CONNECTION #######
mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
/*----------------------------------*/



//init socket
$socket = stream_socket_server("tcp://0.0.0.0:".$port, $errno, $errorMessage) or die("Could not bind to socket: $errorMessage");

//fork the process to work in a daemonized environment
file_put_contents($log, date("d.m.y H:i",time())." starting up.\n", FILE_APPEND);
$pid = pcntl_fork();
if($pid == -1) {
file_put_contents($log, "Error: could not daemonize process.\n", FILE_APPEND);
return 1; //error
} else if($pid) {
return 0; //success
} else {

    ##############################
    //THIS IS WHERE YOU SHOULD PLACE ANY MYSQL CONNECTION
    //since it's after the fork (it will receive a new PID)
    //else you will get crazy debugging the 2006 error "mysql server has gone"
mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
    ##############################

    ##############################
    //the main process
    while(true) {

        //prepare readable sockets array
        $read_socks = $client_socks; //will be filled below and then looped
        $read_socks[] = $socket; //server starts here

//select all sockets one by one and apply long timeout
stream_select ( $read_socks, $write, $except, 300000 ) or die('something went wrong while selecting a socket');

//check for new connected clients
if (in_array($socket, $read_socks)) {
$new_client = stream_socket_accept($socket);

if ($new_client) {
//remote client info, ip, port number
$client_info = strtolower( stream_socket_get_name($new_client, true) );
echo "Connection accepted from " . $clientinfo . "\n";

//add it in array client_socks
$client_socks[] = $new_client;
$client_data[] = $client_info;
echo "Now there are total ". count($client_socks) . " clients.\n";
}

//clean read_socks
unset($read_socks[ array_search($socket, $read_socks) ]);
}

//messagges from the clients
foreach($read_socks as $sock) {

//whom client speaking to?
$clientkey = array_search($sock, $client_socks);

//here I read the stream
$data = fread($sock, 128);

if(!$data) {
unset($client_socks[ $clientkey ]);
unset($client_data[ $clientkey ]);
@fclose($sock);
echo "A client disconnected. Now there are total ". count($client_socks) . " clients.\n";
continue;
}

//PARSE DATA AND PUT IN MYSQL

[W H A T E V E R   Y O U   L I K E]

//FILL DB
$query = "INSERT INTO db SET everything you want";
$sql = mysql_query($query) or die(mysql_error());
}
    }
}
?>

If you put some echos, please consider that I did in 2 ways:
  1. append to logfile
  2. echo out
Where you see that I echoed out, consider that this will echo in the shell and it's perfect for live debug as you start the socket. But in a production environment you would append to the logfile instead.

BASH SCRIPT /etc/init.d (copy e.g. crond and you will inherit the right permission, then write over this):

#!/bin/bash
#
# /etc/init.d/myDAEMON
#
# Starts myDAEMON
#
# chkconfig: 345 95 5
# description: Runs the myDAEMON daemon.
# processname: myDAEMON

# Source function library.
. /etc/init.d/functions

#startup values
log=/var/log/myDAEMON.log

#verify that the executable exists
test -x /var/www/html/myDAEMON.php || exit 0RETVAL=0

#
# Set prog, proc and bin variables.
#
prog="myDAEMON"
proc=/var/lock/subsys/myDAEMON
bin=/var/www/html/myDAEMON.php

start() {
# Check if myDAEMON is already running
if [ ! -f $proc ]; then
   echo -n $"Starting $prog: "
   daemon $bin --log=$log
   RETVAL=$?
   [ $RETVAL -eq 0 ] && touch $proc
   echo
fi

return $RETVAL
}

stop() {
echo -n $"Stopping $prog: "
killproc $bin
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $proc
echo
        return $RETVAL
}

restart() {
stop
start
}

reload() {
restart
}

status_at() {
  status $bin
}

case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
condrestart)
        if [ -f $proc ]; then
            restart
        fi
        ;;
status)
status_at
;;
*)

echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac

exit $?
exit $RETVAL

Now you can type from the shell
service myDAEMON start
service myDAEMON stop
service myDAEMON restart
chkconfig --add myDAEMON

which means that you can start, stop, restart and start on launch, like you usually do for every other binary... ah, WHAT A FUN!!!!

venerdì 12 dicembre 2014

Considerations to pass Cisco conceptual exams

I write this post to remember myself some best practices based on my own experience when taking Cisco conceptual exams. These tipically are the question - single or multichoice answers and contain some common distractors which can be easily identified and avoided.

I also need to specify that I adopted the self-study approach for several reasons:

  • it's really cheap compared to a classroom (physical or virtual) course
  • I can fit my study slots to my other roles of father and employee
  • I can concentrate on some micro concepts which seem stupid but are still recurring (e.g. DSL and cable TV connections are asymmetric)
  • I can draw some schemes and memorize them as a picture, both while I draw them and when I study them later on

This approach perfectly fits to the considerations about Cisco questions I'd like to share with you, but it's mandatory that you deeply study the material: 818 minimum pass score means that you just can't skimmer the Cisco books unless it's your 20th Cisco exam in 5 years...

  • if an answer contains terms which you haven't heard before, it's wrong or you need to study a some more...
  • if an answer contains terms or concepts which you know from your real life experience, but you are sure that they aren't written in the Cisco book, it's wrong.
  • if you exercised a lot on Pearson exam simulations (questions come directly from Cisco) and you're sure that they're wrong, remember to memorize the wrong answer since Cisco wants that answer and assumes that Cisco is always right. If you don't trust me here's an example (summarized for copyright matters):
    • PC1 and PC2 are separated by several routes and communicate each other. What is the largest entity (it's specified IN SIZE) that make it from PC1 to PC2? Cisco says packet, I say frame (it's in the answers): in my knowledge a frame is packet + L2 encapsulation so it's LARGER IN SIZE than the packet just because it contains the packet itself!!!
    • Which command makes you exit from conf mode to exec mode? Well "end" and "exit", while "CTRL+Z" is considered an error although it's explicitly adviced as a return to EXEC in any online Cisco manual...
  • Sometimes the questions present complex scenarios, hiding a simple question and a simple answer: you can bypass the complexity reading the question (no matter if you don't understand everything) and then all the answers. The answers themselves will show you if you need to read again the question and really understand that scenario, or if it's simpler than it looks. Usually Cisco would display a graphic for really complex scenarios.

venerdì 5 dicembre 2014

[SNIPPET][bash] extract email addresses from CPanel

This requires that you activated the SSH access via CPanel.

Works well with hostmonster, bluehost and in general with any chrooted environment based on CPanel, where you don't have root password / sudo access. I haven't tried it on WHM based hosting providers.

#!/bin/bash
OWNER=$@
CONTACT=`ls -1A /var/cpanel/users/`

count=1
for x in `echo -n "$CONTACT"`;do
  users=`grep -i ^dns /var/cpanel/users/"$x" |cut -d= -f2`
  DOMAIN[$count]=$users
  count=$[$count+1]
  echo "Login:        `echo "$x"`"
  for i in `echo "${DOMAIN[@]}" | sed  's/ /\n/g'`;do
    for n in ` ls -A /home/"$x"/mail/"$i"/ 2&gt;/dev/null`;do
      if   [ "$n" == "cur" ];then echo "$n" &gt; /dev/null
      elif [ "$n" == "new" ];then echo "$n" &gt; /dev/null
      elif [ "$n" == "tmp" ];then echo "$n" &gt; /dev/null
      elif [ "$n" == "" ];then echo "$n" &gt; /dev/null
      else
        echo  "$n"@"$i"
      fi
      done
    done
  echo;
  echo;
done

venerdì 21 novembre 2014

DIY Expedit Separèe




Recently we moved in a terraced house and finally I got the mansard I was dreaming of, to build my own recording studio.

TOOLS USED:
- 2 normal screwdrivers
- an hammer
- an electric screewdriver / driller
- a manual saw
- the hex screwdrivers provided by ikea, plus the hex bits for my driller
- the "no more nails" glue
The space is around 50 square meters and I needed to divide it in 2 halfs, one for the project studio and one for the family (TV, WII, etc). I aimed to get a multipurpose bookshelf, a place for my DJ console and vinyls, less space to heat / cool. I avoided the plasterboard because I couldn't affort the installation costs and the removal wouldn't be easy. An Expedit solution meant that I splitted the costs buying an expedit from time to time, the structure isn't cemented but just layed on the walls. In addition this solution is more "interior designed" :-)




I glued together several ideas and my creativity to get a clean final result. Some expedit doors and drawers are still missing but I can afford to buy them in the future.

The DJ console was done following several ideas that you can easily find around the internet. But here are glued altogether.

STEP BY STEP FOR THE DJ CONSOLE
- I simply mounted the 4x2 expedit
- for the top, I added 2 capita legs (the inclined version, not on the catalog, but ask for them) and the lack shelf
- for the feet, 3 lillangen for the bathroom forniture
- for the headset, a bjarnum hook
- for the upper part, all stolmen elements (the shelf is the shoes rack)


STEP BY STEP FOR THE WALL SEPAREE:
- I designed the project with Adobe Fireworks
- I bought 6 expedit 4x4 white for the main structure
- I bought 2 expedit 4x2 white, one for the DJ console and one for the "door" effect
- I bought some doors and drawers
- 2 people are required to put one expedit on top of another, 3 people to install the door top
- I firstly mounted the 6 4x4 expedits (one person is enough, 15min the required time each)
- I passed the cables (phone, etc) over the upper expedit in order to hide all the cables
- I putted between each upper expedit and the ceiling (where you see the black cable) a kitchen zinc adjustable foots, with 2 felt pads to the ends in order to avoid scratches, and rotated them to keep the whole structure in tension towards the floor
- I mounted on 3 sides (left one shoulder) and adapted the 2x4 expedit cutting it with a manual saw, as you can see inside it's all paper except for the frame and the 2 ends, which are made of chipboard
- I extracted the endings and adapted with the NO MORE NAILS glue pressing the paper, or you can't mount the shoulders into the adapted structure
- After fixing it, I finished the little gap with the NO MORE NAILS glue using it as plaster
- At the end I used a stencil by Thisismykea
- I masked a gap between 2 expedits caused by the stairs railing with 2 kitchen neon lights




notice the cables that will be hidden after the top element will be mounted

the top element needs a "little" customization in order to fit the gap

notice that the ending has an hard chipboard terminal

use the saw to fit on your needs but take care, since inside is just chipboard frame and it's empty
just some filling paper (see below)

here's the chipboard ending, some filling paper and 2 pieces of chipboard frame

just push the chipboard ending inside, pressing the filling paper

rescrew the screws in place
recycling the ending results in having the original screw holes already in place

the stairs on the back forced a little tooth, but no problem
I applied LED lights on the back over the stairs, in order to enlight them

giovedì 20 novembre 2014

How to pass Cisco Data Center DCICN 640-911 certification exam

Today I'd like to share my first impression on the Cisco Data Center DCICN 640-911 certification exam I attemped today for the first time. 71 questions in 120 minutes (30 are auto-added for non-english speaking countries). Missed 3 questions to get 818 and scored 780.

The official Cisco Press / Pearson publication will be available not before the next 6 days, so I spent my last month self-studying on the following material:

  • "Anthony Sequeira CCNA DC" from CBT Nuggets
  • "Introducing Cisco Data Center Networking Study guide" by Todd Lammle
  • Todd Lammle Nexus 7010 simulator
  • a self-made virtual Nexus 7000 on VMware (you can hardly find the proper vmx somewhere online, but then you need to customize, see below for the screenshot of my installation)
  • the Cisco official website, Wikipedia and Google
  • exam simulations by Todd Lammle (from Wiley website and on iPhone) and free around the internet. Somebody offers the braindumps, but they cost too much for my pockets.
I started with a good knowledge of LAN and WAN networking, operative systems and some years of experience, but I don't feel they are needed (as also stated on the Cisco exam objectives). I also don't have any previous Cisco certification or particular experience.

If you don't have any previous experience on IOS and you start from scratch, this is a huge benefit, trust me! With Nexus, Cisco simplifies their whole software, so some multi-choice answers contain IOS commands to confuse IOS practitioners, while to brand new Nexus initiated they just appear wrong!

I firstly studied on the book by Todd Lammle.
PROS: it's stupid-proof! Well done Todd!
CONS: Todd, here starts the list, be prepared please...
  1. some errata corriges around, you need to check his official forum, but they are more than the ones adviced there and huge huge huge
  2. sometimes it's unconsistent in terminologies: you find a term in the chapter check questions which is different or missing in the text
  3. sometimes the chapter check questions talk about something missing in the whole book, e.g. CoPP and other security matters which I explicitly found in the real questions today
  4. it's missing really important parts... at least 10 questions were focused on exact Cisco models (1000, 5000, 5500, 6000, 7000 series) and exact model features, BLAME ON YOU CISCO because this is a matter for sales or specialists!!! In addition 3 questions were about the twinax cable specs, which are barely mentioned into the book. At least other 5 questions were about the emergency boot, golden BIOS, memory and file storage, which are just drafted or completely absent. Here come the Cisco official website, Wikipedia and Google
Then I integrated with Sequiera videos.
PROS: some concepts like OSPF are represented better than Todd, there's some concept more.
CONS: doesn't add nothing significative to Todd's book for such that price.

I tried the commands with the free Todd Nexus 7000 simulator.
PROS: it's free.
CONS: a lot of commands described in the book don't work, so it doesn't fit any purpose else than confusing the student.

You just need to put your hands on commands and miss, fail, learn from your errors. At this time the choice was to buy $20.000 Nexus stuff, but I didn't afford to pay $3.000 for the cheapest course (just for DCICN, then you have to pay twice for DCICT)! Here comes the hungry smart... So I retrieved some VMware imaged on the internet, made one from two, modded it in order to respond to both telnet and ssh.
PROS: it's a real nexus b!tch!!!
CONS: lacks supervisor, takes exactly a minimum 2096MB RAM (or it reboots and currupts), so I could not make 2 nexus'es communicating each other like I hoped, because my poor MacMini just has 4GB and beggin for more...

Exam simulations by Todd Lammle.
PROS: I found at least 10 questions exactly reported by Todd. The free material you find around the internet it's just stolen from Todd's stuff. You need the exam simulator on the Wiley website, more the iOS app, since they have some different questions. Make them all, it's like the driving license: the more you do, the better you learn.
CONS: the considerations made for his book are still valid for the exam simulations: errata corriges, inconsistencies, missing arguments, etc.

At last it was not my fault, I scored 990 on Todd's exam simulations based on 100 questions. I couldn't make educated guests on multiple choice questions asking which licenses are free and which others are paid on a nexus 7000 or on a 5000. 6000 series is barely or perhaps not even quoted inside the book. I just had to make a random guest... this juiced me $250. I pre-ordered the official cert guide by Pearson on Cisco Press website, I will fill my gaps, score 990 in a couple of weeks (UPDATE: in a month) and report here.

For DCICT we have to wait for the next year, but be sure that I will try it before and eventually lick my wounds here! Stay tuned...


ADDITIONAL RESOURCES NEEDED

FEATURE-BASED LICENSING OVERVIEW
http://www.cisco.com/c/en/us/td/docs/switches/datacenter/sw/nx-os/licensing/guide/b_Cisco_NX-OS_Licensing_Guide/b_Cisco_NX-OS_Licensing_Guide_chapter_01.html#con_24753

NEXUS SWITCHES FOR DATA CENTERS
(YOU ONLY NEED "PRODUCTS & SERVICES" AND "TECHNOLOGIES" TABS)
http://www.cisco.com/c/en/us/products/switches/data-center-switches/index.html#~products-services

NEXUS COMPACT COMPARISON AND SHORT DESCRIPTION
http://en.wikipedia.org/wiki/Cisco_Nexus_switches (WIKIPEDIA IS ALWAYS THE SMARTER HUH? ;-)

GOLDEN BIOS
(YOU CAN READ WTF IT IS ON ANY NEXUS SPECIFIC MANUAL, HERE'S ONE)
http://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus5000/sw/fundamentals/421_n1_1/b_Cisco_Nexus_5000_Series_NX-OS_Fundamentals_Configuration_Guide_Release_4_2_1_N1_1/b_Cisco_Nexus_5000_Series_NX-OS_Fundamentals_Configuration_Guide_Release_4_2_1_N1_1_chapter_011.pdf

But you would avoid reading all, you only really should know that:

The upgradeable BIOS and the golden BIOS are programmed onto the 2 MB flash part. You cannot upgrade the golden BIOS. When the switch boots, the golden BIOS validates the checksum of the upgradeable BIOS. If the checksum is valid, then control is transferred to the upgradeable BIOS image. The upgradeable BIOS launches the kickstart image, which then launches the system image. If the checksum of the upgradeable BIOS is not valid, then the golden BIOS launches the kickstart image, which then launches the system image.You can force the switch to bypass the upgradeable BIOS and use the golden BIOS instead. If you press Ctrl-Shift-6 within two seconds of when power is supplied to the switch, the golden BIOS will be used to launch the kickstart image, even if the checksum of the upgradeable BIOS is valid.

###########################################
VIRTUAL LAB - ACCESSING THE NEXUSes
###########################################



Firstly I need to say Cisco makes the Nexus 1000V virtual machine downloadable for free from their website. This means that you can have the real (entry level) Nexus for free shipped at your home without costs. I quitted after I realized that:
  • the features are limited compared to the skills required from the exam
  • I would need to firstly install a linux VMware ESXi host on a dedicated virtual machine, or 1000V won't install. I just hate virtualization over virtualization.
Somewhere on the internet you can find the Nexus 7000 Titanium image in VMX format (suitable for both VMware Fusion for Mac and VMware Workstation for PC).

Here's a couple of links:
http://tejasjain1991.blogspot.it/2013/06/cisco-nexus-titanium.html
http://networkstweaks.blogspot.it/2013/09/cisco-nexus-titanium-over-vmware.html

You can setup how many as you like but there's a caveat. The minimum RAM requirement is EXACTLY 2048MB and you won't be able to run 2 as soon as you have 4GB: VMware Fusion (perhaps also Workstation?) won't allow you to have less than 2GB for your host computer. After you upgrade your RAM to a minimum of 8GB, you could safely run 2-3 Nexus, ever if I feel that 2 is enough to try all the routing features and to see the topology tables for your brand new network-admin life.

SERIAL PORT ACCESS VIA TELNET
You can access your Nexus either via SSH and a "Telnet simulated" serial console, but for this second option you need to tweak the .vmx file. In the real world you would avoid telnet (disabled by default on Nexuses) in favor of SSH for security reasons, but this telnet resides on your PC network stack so it causes no security issues.

Compared to SSH, Telnet doesn't timeout, so you can leave it turned on and don't mind if you have go to lunch for a while. Here are the 2 Nexus.vmx file excerpts:

NEXUS 1 named "N7K1"
serial0.present = "TRUE"
serial1.present = "TRUE"
serial1.yieldOnMsrRead = "TRUE"
serial1.fileType = "network"
serial1.fileName = "telnet://127.0.0.1:9001"

NEXUS 2 "N7K2"
serial0.present = "TRUE"
serial1.present = "TRUE"
serial1.yieldOnMsrRead = "TRUE"
serial1.fileType = "network"
serial1.fileName = "telnet://127.0.0.1:9002"

Then just type on 2 different terminal instances:
telnet://127.0.0.1:9001
telnet://127.0.0.1:9002

Please note that the serial0 line was already in place and I saved it for tracking purposes. So I just added the 4 lines in order to have another COM port (serial1). One Nexus opens the 9001 port and one other opens the 9002 port on my mac.

I hope that at this point it's clear that this is not the real usual telnet, which is still disabled on your Nexus and, if activated, is an additional access way (the less secure to be fair...) reachable typing the command:
telnet://192.168.1.101
telnet://192.168.1.102

SERIAL PORT ACCESS VIA SOCAT
The socat solution you find almost everywhere (the one with "\\.\pipe\") works perhaps working good with PC. On the mac it works if you put on your COM port (from VMware Fusion in the virtual machine options) a named pipe file name e.g. "nexuspipe": this option will create the file called "nexuspipe" inside every Nexus VM folder (I mean the folder containing vmx and vmdk files).

This means that you then need to open 2 terminal instances and then, for every instance, you need to go into the nexus 1 folder on one window and into the nexus 2 folder on the other window. Then from every instance of the terminal:
socat UNIX-CONNECT:nexuspipe PTY

On a third and forth terminal instances, find the brand new TTY devices created by socat and open them (always separately). Usually they are the last ones, e.g. for one nexus:
ls -la /dev/tty*
screen /dev/ttys002
press enter and a nexus asks you for the password :-) repeat it for the second nexus.

SSH ACCESS
This is my favorite access since you don't need to tweak anything:
ssh admin@192.168.1.101
ssh admin@192.168.1.102

The IP 192.168.1.101 ships as default in the image and obviously you first need to configure it on the second Nexus or you it will result in an IP confict. Power off the first Nexus and assign the IP 192.168.1.102 to the second one. Please notice that you have a 30min default inactive timeout directly on the Nexus even if you addedd (like I did) .ssh/config file with e.g.:
ServerAliveInterval 300 
ServerAliveCountMax 1000

So son't take a long lunch or you'll need to reconnect... OK it's just arrow up + password + enter but you will lose your commands history.


###########################################
UPDATE 3 dec 2014 - CISCO OFFICIAL CERT GUIDE
###########################################

Yesterday I received the Cisco official cert guide by Odom and Hintz + premium content (PDF+epub+mobi versions), 600 pages. It includes Pearson exam simulator in the CD shipped with the book, while additional videos can be downloaded from the Ciscopress / Peason website.

Useless to say that I'm eating it, here are the first impressions.

I begin with a caveat, since the premium content is useless. The exam simulator works only with Windows 7 or later. Don't lose your time installing wine, the software requires .NET framework 4.5 which is compatible nor with XP neither with wine. At this date I only found a winebottled version of 4.0, however I decided to better invest my time downloading a Win8.1 image for VMware OSX from modern.ie (MS official website): you get a fully working 8.1 for 90 days, enough to cover a full DCCICN study, the installation works like a charm, no viruses no warexxx no pain in the /\ss.

The exam simulator by Todd is nothing compared to this:

  • you can choose between study mode (no time limitations) or final exam simulation mode (time limited to 90 mins)
  • you can test alone or mix up the questions coming from
    • all the book assessment questions divided by chapter as Todd
    • 4 final exam questions (instead of 2)

If you accept the limitation represented by installing a Nexus 7k simulator (please read above, the Lammle / Schwarz simulator IMHO sucks or lacks, judge yourself) and installing the Win8.1 you have the advantage to put your hands on the real questions and answers coming from Cisco, not on braindumps or wherever Todd retrieved his questions.

The Lammle book has quite a good number of errata corriges but mostly are reported on his forum by several users (not all in my opinion), so don't forget to take good note of them. On the other hand, I found a buggy answer just in the chapter 3 (more to come eh!!!) and promptly adviced the Pearson support, an out-of-office reply came from their manager. Nobody's perfect.

The style is quite as friendly and clear as Todd's: compared to the old CCNA official book from 2001, perhaps during this years Cisco realized that the ocean is turning red...

It skimmers some aspects on which Todd spent more time, it introduces several aspects that Todd left which obviously are part of the exam (definitely always a Cisco exam...), e.g. WAN (leased lines, DSL), MPLS, and I'm still on chapter 5 of 22. I will keep you updated on what's goin' on...

So where should you really prepare your exam? My answer is: avoid any well paid official training course, spend your money on both Lammle and Cisco books. You spend 100$ for both (if you live outside US order it on your amazon since I spent 50$ for the Cisco book and almost 50$ for taxes...), you save 2000$ of intensive course which will not inject any knowledge directly into your brain, nor will gift you advantage when sitting at the exam (I hope...), neither will clarify you the concepts later on whenever you will need them again written somewhere in the future.

      venerdì 11 aprile 2014

      SSH Tunneling + SSH port forwarding + multiple hops ALL-IN-ONE (ITALIANO, ENGLISH)

      *** ITALIANO *** (ENGLISH BELOW)

      Se abbiamo la gestione di una macchina linux remota in LAN1, a cui accediamo via SSH, potremmo aver necessità di connetterci ad una rete LAN2 collegata ad essa es. in VPN. In sostanza quella macchina ci serve da proxy per l'accesso a LAN2 e la strada più semplice è settare il port forwarding via SSH, quindi otteniamo un tunnel criptato con SSL. I più maliziosi hanno già pensato di sfruttarla come proxy di navigazione anonima o come testa di ponte, ma le considerazioni sulla sicurezza sono oltre lo scopo di questo post. A noi serve avere i controllo di entrambe le macchine raggiunte su LAN1 e LAN2, oltre ovviamente alla macchina su cui stiamo lavorando.

      Tento di rappresentare uno schema tipico:

      mia macchina locale IP 192.168.0.123

      host1 su LAN1
      IP pubblico 123.123.123.123
      IP privato 192.168.1.123

      host2 su LAN2, raggiungibile da host1 via VPN o altro poco importa
      IP privato 10.10.10.123

      la richiesta da es. browser che vogliamo ottenere è una risposta a http://10.10.10.123:34567

      I tunnel saranno 2:
      tun1 = dalla macchina locale a host1 su una porta arbitraria
      tun2 = da host2 a host1 sulla porta da raggiungere

      se volessi avere altri hop, il meccanismo è lo stesso, es. con 4 hops:
      tun1 = dalla macchina locale a host1 su una porta arbitraria
      tun2 = da host2 a host1 su una porta arbitraria
      tun3 = da host3 a host2 su una porta arbitraria
      tun4 = da host4 a host3 su una porta arbitraria
      tun5 = da host5 a host4 sulla porta da raggiungere

      L'opzione -L del comando ssh serve a specificare che segue un binding tra 2 porte.
      La porta di sinistra è quella più vicina a noi (macchina locale o hop successivo).
      Quella di destra è quella remota, per cui immaginiamo uno schema tipo:
      NOI --> portalocale:host1:porta1 --> porta1:host2:porta2  --> porta2:host3:porta3 etc fino all'ultimo host e all'ultima porta.

      Tornando ai 2 tunnel:

      dalla macchina locale verso host1
      ssh -L 9999:localhost:9999 root@host1

      da host1 verso host2
      ssh -L 34567:localhost:9999 root@host2

      Con l'esempio dei 5 tunnel:

      ssh -L 9999:localhost:9999 root@host1
      ssh -L 9999:localhost:9999 root@host2
      ssh -L 9999:localhost:9999 root@host3
      ssh -L 9999:localhost:9999 root@host4
      ssh -L 34567:localhost:9999 root@host5

      Ora basta puntare il browser così:
      http://localhost:34567

      Se vogliamo concatenare i comandi in modo da inviarli via SSH in un'unica riga:
      ssh -v -L 9999:localhost:9999 root@host1 -t ssh -v -L 9999:localhost:9999 root@host2 -t ssh -v -L 9999:localhost:8080 root@host3 -t ssh -v -L 9999:localhost:8080 root@host4 -t ssh -v -L 34567:localhost:8080 root@host5

      ************************************************************************
      *** ENGLISH ***

      If we manage a linux remote machine inside LAN1, on which we access via SSH, we could need to access to a LAN2 connected e.g. through a VPN. Essentially that machine can be a proxy for accessing to LAN2 and the easiest way is setting the port forwarding via SSH, so we obtain an encrypted SSL tunnel. The smartest of you have already though to use it as an anonymous navigation proxy or as a bounce, but any security matter is beyond the scope of this post. We only need to control both the machines on LAN1 and LAN2, in addition to the PC we are workin on.

      I try to represent a typical situation:

      IP on my local machine 192.168.0.123

      host1 on LAN1
      public IP 123.123.123.123
      private IP 192.168.1.123

      host2 on LAN2, reachable from host1 via VPN or else we don't mind
      private IP 10.10.10.123

      the request we want to achieve (e.g. browser) is a reply to http://10.10.10.123:34567

      There will be 2 tunnels in place:
      tun1 = from the local machine to host1 on any arbitrary port
      tun2 = from host2 to host1 on the port we need to reach

      if I would need additional hops, the mechanism is the same, e.g. with 4 hops:
      tun1 = from the local machine to host1 on any arbitrary port
      tun2 = from host2 to host1 on any arbitrary port
      tun3 = from host3 to host2 on any arbitrary port
      tun4 = from host4 to host3 on any arbitrary port
      tun5 = from host5 to host4 on the port we need to reach

      The ssh -L argument needs to specify that a bind between 2 ports will follow.
      The leftmost port is the nearest to us (local machine or next hop).
      The rightmost port is the remote, so we can imagine the following scheme:
      ME --> localport:host1:port1 --> port1:host2:port2  --> port2:host3:port3 etc until the last host and the last port.

      Let's go back to the 2 tunnels:

      from the local machine to host1
      ssh -L 9999:localhost:9999 root@host1

      from host1 to host2
      ssh -L 34567:localhost:9999 root@host2

      Let's go back also to the 5 tunnels example:

      ssh -L 9999:localhost:9999 root@host1
      ssh -L 9999:localhost:9999 root@host2
      ssh -L 9999:localhost:9999 root@host3
      ssh -L 9999:localhost:9999 root@host4
      ssh -L 34567:localhost:9999 root@host5

      Now we only need to address the browser to:
      http://localhost:34567

      If we want to concatenate the commands in order to send them via SSH in a whole row:
      ssh -v -L 9999:localhost:9999 root@host1 -t ssh -v -L 9999:localhost:9999 root@host2 -t ssh -v -L 9999:localhost:8080 root@host3 -t ssh -v -L 9999:localhost:8080 root@host4 -t ssh -v -L 34567:localhost:8080 root@host5

      venerdì 4 aprile 2014

      Split Tunneling + VPN + VMware (Windows, Mac OS X, Linux)

      Mi è capitata l'esigenza di monitorare intere classi di apparati tramite VPN (in questo caso erano Cisco, ma è indifferente).
      Purtroppo il router aziendale non supportava il Cisco Client, in quanto si trattava di una customizzazione di linux in cui il client vpnc si rifiutava di funzionare, ma forse il problema era il concentratore, antichissimo e in gestione a terzi. Per farla breve, l'unico apparato in grado di connettersi era una macchina Windows con a bordo XP o 2003 Server, tramite l'ordinario Cisco VPN Client o addirittura il VPN client integrato. Questo però mi impediva di svolgere operazioni che potevo compiere solo tramite server linux, ma ho trovato la soluzione forzando il 2003 Server (o XP... non avrebbe fatto differenza) a fare da gateway a una pletora di macchine virtuali linux.
      192.168.101.0 è la LAN dell'ufficio
      192.168.101.1 è il router di connettività
      192.168.101.19 è il server WIndows 2003 Server che useremo come gateway VPN per via di RAM e CPU abbondanti (serve a ospitare le virtual machines)
      VMware VIRTUAL MACHINE (NO PLAYER, es. VMware Workstation, Fusion, etc)
      VMware Player non permette di editare il Virtual Networking, quindi non è adatto.
      Concettualmente il VPN client di Microsoft permette di fare da gateway di connessione, sia per le VM ospitate al suo interno (VMware Workstation, Fusion ed altri futuri paritetici), ma anche per tutte le macchine della LAN.

      WINDOWS CON CLIENT VPN E VMWARE WORKSTATION GIA' INSTALLATO
      START / ESEGUI / regedit HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage\Bind sposta in alto \Device\NdisWanIp riavvia
      Connessione VPN / Proprietà / Rete / TCPIP / Proprietà:
      • DNS server remoto (es. 10.0.0.101)
      • Avanzate lascia flag gateway predefinito
      Connessione VPN / Proprietà / Avanzate:
      • consenti ad altri utenti
      • scegli VMnet8 (è l'interfaccia di NAT di VMware)
      • il sistema automaticamente imposta VMnet8 a 192.168.0.1, se è un secondo gateway (es. ridondante) metti un indirizzo diverso es. 192.168.0.2
      Connetti la VPN e controlla quale indirizzo abbia il gateway, es.172.16.1.1.
      VMware Workstation / Edit / Virtual Network Editor, sostituisci VMnet8 "Use local DHCP" il default 192.168.137.0 con 192.168.0.0.
      START / ESEGUI / cmd
      • route print (in basso non ci sono rotte statiche)
      • route -p add 172.16.0.0 mask 255.255.0.0 172.16.1.1 metric 1
      • (route -p sta per "persistent", cioè statica, si conserva al riavvio)
      • ping 10.0.0.101 e anche ping google.it
      • se non pinga google:
        • route delete 0.0.0.0
        • route add 0.0.0.0 mask 0.0.0.0 192.168.1001.1 metric 0
      LINUX NELLA VM (usa la classe della VMnet8)
      Le Virtual Machines devono avere 2 interfacce di rete (/etc/network/interfaces): eth0 è su VMnet8, eth1 invece in è bridge su VMnet1

      sudo -i
      nano /etc/networking/interfaces

      # The loopback network interface
      auto lo
      iface lo inet loopback

      #QUESTA E' LA LAN TRA MACCHINE VMWARE
      auto eth0
      iface eth0 inet static
         address 192.168.0.20
         netmask 255.255.255.0
         gateway 192.168.0.1
         dns-nameservers 10.0.0.101 10.0.0.102

      #ATTENZIONE! QUESTA E' LA LAN ORDINARIA DELLE MACCHINE DELL'UFFICIO
      auto eth1
      iface eth1 inet static
         address 192.168.101.20
         netmask 255.255.255.0
         gateway 192.168.101.1
         dns-nameservers 192.168.101.1 208.67.222.222


      /etc/init.d/networking restart

      Considerati alcuni problemi di rotte di default (0.0.0.0 / 0) che ritornano, preferisco fare un cronjob di questo tipo:

      # m h  dom mon dow   command
      */1 * * * * /home/conf/network_fab.sh

      #!/bin/bash
      sudo /sbin/route del -net 10.0.0.0/8 gw 192.168.0.1 dev eth0
      sudo /sbin/route del -net 172.16.0.0/12 gw 192.168.0.1 dev eth0
      sudo /sbin/route add -net 10.0.0.0/8 gw 192.168.0.1 dev eth0
      sudo /sbin/route add -net 172.16.0.0/12 gw 192.168.0.1 dev eth0
      sudo /sbin/route delete default dev eth0

      e ci puoi infilare tutte le reti raggiungibili dal gateway remoto che ora raggiungi via VPN

      OSX (ricorda di usare l'IP di Windows nella LAN come gateway)
      sudo route -n add 10.0.0.0/8 192.168.101.19
      sudo route -n add 172.16.0.0/12 192.168.101.19
      Windows XP e 2003 (ricorda di usare l'IP di Windows nella LAN come gateway)

      route -p add 10.0.0.0 mask 255.0.0.0 192.168.101.19 metric 1
      route -p add 172.16.0.0 mask 255.255.0.0 192.168.101.19 metric 1

      mercoledì 2 aprile 2014

      Gesù: il carattere, i poteri messianici, la nostra fede

      La figura di Gesù viene delineata in modo a tratti netto all'interno dei Vangeli.

      La testimonianza che gli evangelisti ci hanno tramandato è chiara: pur volendo accreditare l'enfasi inevitabile per coloro che furono testimoni diretti di miracoli ultraterreni, piuttosto che altrettanto inevitabili errori di traduzione, alcune descrizioni sono così particolareggiate e coerenti col contesto da lasciare davvero pochi spazi ai dubbi.

      Le profetizzazioni dell'Antico Testamento erano metafore che, a leggerle oggi, fanno sorridere; oppure sono cariche di ammonizioni catastrofistiche un po' caricate, sicuramente adatte a colpire l'immaginazione delle persone dell'epoca che ben conoscevano guerre e catastrofi.

      Al contrario Gesù rimane un comunicatore ancora attuale e le sue parabole usano lo stesso approccio che qualsiasi comunicatore oggi usa nello spiegare all'uditorio un concetto nuovo con esempi presi dal calcio, dalle automobili, etc. Allo stesso modo Gesù faceva esempi del ladro, del servo, del padrone e riusciva a spiegare in modo semplice sia ai dotti del tempio durante il sabato, sia quotidianamente al popolino fatto di pescatori e contadini.

      Gesù ci viene anche tramandato come una persona che non ride mai, anzi spesso severa, ma che nonostante questo è mossa dallo stesso amore verso il prossimo che predica. Un esempio noto ma anche controverso è il seguente, che si ritrova in tutti gli evangelisti, ma è pregnante in Giovanni, ed è la cacciata dei venditori dal Tempio:
      Si avvicinava intanto la Pasqua dei Giudei e Gesù salì a Gerusalemme. Trovò nel tempio gente che vendeva buoi, pecore e colombe e, là seduti, i cambiamonete. Allora fece una frusta di cordicelle e scacciò tutti fuori dal tempio, con le pecore e i buoi; gettò a terra il denaro dei cambiamonete e ne rovesciò i banchi, e ai venditori di colombe disse: «Portate via di qui queste cose e non fate della casa del Padre mio un mercato!». I suoi discepoli si ricordarono che sta scritto: «Lo zelo per la tua casa mi divorerà».
      (Giovanni 2:13-17)
      Questo passo descrive una scena che è valsa a Gesù l'errata attribuzione al movimento degli "zeloti", un movimento che giustificava la violenza fin'anche all'omicidio poichè si rifaceva ad un passo dei Maccabei, in cui Mattatia compì un omicidio per zelo verso Dio. Negli anni '60 anche questo atto di Gesù fu interpretato come zelota e giustificò la violenza al fine di instaurare il Regno. Ma ahimè le conseguenze della violenza religiosa oggi sono sotto gli occhi di tutti. Invece sono i sinottici (e in particolare Marco) che ci spiegano cosa avvenne subito dopo: che Gesù si mise ad insegnare.

      Mi piace citare la lettera di Publio Lentulo a Tiberio: è considerata apocrifa, ma comunque ebbe credito nel passato perchè fornisce una descrizione di Gesù storicamente plausibile e abbastanza allineata con i Vangeli.
      Ho inteso, o Cesare, che desideri sapere quanto ora ti narro: esiste qui un uomo, chiamato Gesù Cristo, il quale vive di grandi virtù.
      Dalla gente è detto profeta, ed i suoi discepoli lo tengono per divino, e dicono che egli è figlio di Dio, Creatore del cielo e della terra, e di tutte le cose che in essa si trovano e sono fatte.
      In verità, o Cesare, ogni giorno si sentono cose meravigliose di questo Cristo: risuscita i morti, e sana gli infermi con una sola parola.
      Uomo di giusta statura, è molto bello di aspetto; ed ha grande maestà nel Volto, e quelli che lo mirano sono forzati ad amarlo e temerlo.
      Ha i capelli color della nocciola ben matura; sono distesi sino alle orecchie, e dalle orecchie sino alle spalle sono color della terra, ma più risplendenti.
      Ha nel mezzo della fronte in testa il crine spartito ad usanza dei Nazareni, il volto senza ruga, o macchia, accompagnato da un colore modesto.
      Le narici e le labbra non possono da alcuno essere descritte. La barba è spessa ed ha somiglianza dei capelli, non molto lunga, ma spartita nel mezzo.
      Il suo mirare è molto severo e grave: ha gli occhi come i raggi del sole, e nessuno può guardarlo fisso per lo splendore; e quando ammonisce si fa amare, ed è allegro con gravità.
      Dicono che nessuno l'ha mai veduto ridere, ma bensì piangere.
      Ha le mani e le braccia molto belle; nella conversazione contenta molti, ma si vede di rado; e quando Lo si trova, è molto modesto all'aspetto, e nella presenza è il più bell'uomo che si possa immaginare, tutto simile alla madre, la quale è la più giovane che siasi mai vista in queste parti.
      Però se la Maestà tua, o Cesare, desidera di vederlo come negli avvisi passati mi scrivesti, fammelo sapere, che non mancherò subito di mandartelo.
      Di lettere fa stupire la città di Gerusalemme.
      Egli non ha studiato giammai con alcuno, eppure sa tutte le scienze.
      Cammina scalzo, senza cosa alcuna in testa; molti ne ridono in vederlo, ma in presenza sua nel parlare con lui tremano e stupiscono.
      Dicono che un tal uomo non è mai stato veduto, né inteso in queste parti.
      In verità secondo quanto mi dicono gli ebrei non si è sentito mai nessuno di tali consigli, di così grande dottrina, come insegna questo Cristo, e molti Giudei lo tengono per divino e lo credono; e molti altri me lo querelano con dire che è contro la Maestà tua, o Cesare.
      Si dice che non ha mai fatto dispiacere ad alcuna persona, anzi, tutti quelli che lo conoscono e che L'hanno incontrato dicono di aver ricevuto benefizi e sanità.
      O Cesare, alla Maestà tua, alla tua obbedienza sono prontissimo: quanto mi comandi sarà eseguito. Vale.
      Da Gerusalemme ripartizione settima, luna undicesima.
      Della Maestà tua fedelissimo e obbedientissimo.
      Publio Lentulo (Governatore della Giudea)
      Alcuni esempi estremi della sua severità sono racchiusi in alcuni passi:
      Subito dopo ordinò ai discepoli di salire sulla barca e di precederlo sull'altra sponda, mentre egli avrebbe congedato la folla. Congedata la folla, salì sul monte, solo, a pregare. Venuta la sera, egli se ne stava ancora solo lassù. La barca intanto distava gia qualche miglio da terra ed era agitata dalle onde, a causa del vento contrario. Verso la fine della notte egli venne verso di loro camminando sul mare. I discepoli, a vederlo camminare sul mare, furono turbati e dissero: «E' un fantasma» e si misero a gridare dalla paura. Ma subito Gesù parlò loro: «Coraggio, sono io, non abbiate paura». Pietro gli disse: «Signore, se sei tu, comanda che io venga da te sulle acque». Ed egli disse: «Vieni!». Pietro, scendendo dalla barca, si mise a camminare sulle acque e andò verso Gesù. Ma per la violenza del vento, s'impaurì e, cominciando ad affondare, gridò: «Signore, salvami!». E subito Gesù stese la mano, lo afferrò e gli disse: «Uomo di poca fede, perché hai dubitato?». (Matteo 14:22-36) 
      Partito di là, Gesù si ritirò nel territorio di Tiro e di Sidone. Ed ecco una donna cananea di quei luoghi venne fuori e si mise a gridare: «Abbi pietà di me, Signore, Figlio di Davide. Mia figlia è gravemente tormentata da un demonio». Ma egli non le rispose parola. E i suoi discepoli si avvicinarono e lo pregavano dicendo: «Mandala via, perché ci grida dietro». Ma egli rispose: «Io non sono stato mandato che alle pecore perdute della casa d'Israele». Ella però venne e gli si prostrò davanti, dicendo: «Signore, aiutami!» Gesù rispose: «Non è bene prendere il pane dei figli per buttarlo ai cagnolini». Ma ella disse: «Dici bene, Signore, eppure anche i cagnolini mangiano delle briciole che cadono dalla tavola dei loro padroni». Allora Gesù le disse: «Donna, grande è la tua fede; ti sia fatto come vuoi». E da quel momento sua figlia fu guarita. (Matteo 15:21-28)
      Gesù punta sempre l'accento sulla fede, perchè non è Lui che guarisce, ma la fede. Nel secondo passo, quello della donna cananea, Gesù le indica un percorso di fede: se avesse semplicemente guarito la figlia alla prima richiesta, lei se ne sarebbe andata contenta e tutto si sarebbe concluso lì, ma invece Gesù la costrinse all'introspezione e alla manifestazione di fede. Un altro esempio notevole in cui Gesù indica un percorso di fede è quello del nato cieco:
      Passando vide un uomo cieco dalla nascita e i suoi discepoli lo interrogarono: «Rabbì, chi ha peccato, lui o i suoi genitori, perché egli nascesse cieco?». Rispose Gesù: «Né lui ha peccato né i suoi genitori, ma è così perché si manifestassero in lui le opere di Dio. Dobbiamo compiere le opere di colui che mi ha mandato finché è giorno; poi viene la notte, quando nessuno può più operare. Finché sono nel mondo, sono la luce del mondo». Detto questo sputò per terra, fece del fango con la saliva, spalmò il fango sugli occhi del cieco e gli disse: «Và a lavarti nella piscina di Sìloe (che significa Inviato)». Quegli andò, si lavò e tornò che ci vedeva. (Giovanni 9:1-12)
      Gesù avrebbe potuto guarirlo come aveva fatto in altri casi, cioè rimandandolo, rimettendogli i peccati, imponendogli le mani, etc. Invece decide di sporcargli gli occhi con del fango per indicargli un percorso: il cieco avrebbe potuto lavarsi alla prima fontana che trovava, o semplicemente pulirsi gli occhi, ma decide di seguire il percorso indicato e la sua richiesta viene esaudita.

      Gesù chiede la fede, per la mancanza di fede rimprovera le persone, in presenza di fede esaudisce la donna fenicia, alcuni romani, e persino quando, pur non volendo operare ancora nessun miracolo pubblico, decide di esaudire la fede di Maria alle nozze di Cana:
      Tre giorni dopo, ci fu uno sposalizio a Cana di Galilea e c'era la madre di Gesù. Fu invitato alle nozze anche Gesù con i suoi discepoli. Nel frattempo, venuto a mancare il vino, la madre di Gesù gli disse: «Non hanno più vino». E Gesù rispose: «Che ho da fare con te, o donna? Non è ancora giunta la mia ora». La madre dice ai servi: «Fate quello che vi dirà». Vi erano là sei giare di pietra per la purificazione dei Giudei, contenenti ciascuna due o tre barili. E Gesù disse loro: «Riempite d'acqua le giare»; e le riempirono fino all'orlo. Disse loro di nuovo: «Ora attingete e portatene al maestro di tavola». Ed essi gliene portarono. E come ebbe assaggiato l'acqua diventata vino, il maestro di tavola, che non sapeva di dove venisse (ma lo sapevano i servi che avevano attinto l'acqua), chiamò lo sposo 1e gli disse: «Tutti servono da principio il vino buono e, quando sono un pò brilli, quello meno buono; tu invece hai conservato fino ad ora il vino buono». (Giovanni 2:1-10)
      Maria, che ben conosce il figlio e il potere che Dio gli ha conferito, anche nel momento del diniego, sa che, di fronte alla fede che ha dentro di sè, Gesù non potrà resistere.

      Gesù ci vuol dire che Dio ascolta sempre chi chiede con fede:
      Or una donna, che da dodici anni era affetta da emorragia e aveva molto sofferto per opera di molti medici, spendendo tutti i suoi averi senza nessun vantaggio, anzi peggiorando, udito parlare di Gesù, venne tra la folla, alle sue spalle, e gli toccò il mantello. Diceva infatti: «Se riuscirò anche solo a toccare il suo mantello, sarò guarita». E subito le si fermò il flusso di sangue, e sentì nel suo corpo che era stata guarita da quel male. Ma subito Gesù, avvertita la potenza che era uscita da lui, si voltò alla folla dicendo: «Chi mi ha toccato il mantello?». I discepoli gli dissero: «Tu vedi la folla che ti si stringe attorno e dici: Chi mi ha toccato?». Egli intanto guardava intorno, per vedere colei che aveva fatto questo. E la donna impaurita e tremante, sapendo ciò che le era accaduto, venne, gli si gettò davanti e gli disse tutta la verità. Gesù rispose: «Figlia, la tua fede ti ha salvata. Và in pace e sii guarita dal tuo male». (Marco 5:25-34)
      Questo episodio è emblematico perchè Gesù non aveva alcuna volontà di guarire la donna, e nemmeno si era accorto che qualcuno chiedeva la guarigione finchè una donna non lo ha toccato: una forza esce da lui involontariamente e questo episodio ci mostra anche i limiti dei poteri di Gesù. Infatti Gesù spesso è in grado di leggere nelle intenzioni es. dei farisei che vogliono coglierlo in fallo o ucciderlo, ma allora non si capisce se è in grado di leggere nella mente, come vogliono i traduttori, o se invece legge nelle intenzioni perchè è una persona intuitiva. Il racconto di Marco, evangelista noto per essere asciutto nelle descrizioni, ci racconta esattamente e senza spazi ad interpretazioni che Gesù non ha idea di chi lo abbia toccato: non riesce a leggere nella mente degli astanti, nè tantomeno della donna che evidentemente era ancora dietro di lui. Infatti non poteva essersi mossa a causa della folla ed è la donna stessa che, sentendo le parole di Gesù che cercava chi lo avesse toccato, si fa avanti impaurita. Ma c'è un messaggio più grande: tramite Gesù, è Dio che conferisce quella potenza che esaudisce chi chiede con fede sincera, come Gesù non manca mai di ricordare. E' il Padre l'artefice che esaudisce i figli, ma noi non sappiamo chiedere.

      Gesù stesso, come si rileva da molti passi proprio del Vangelo di Marco, si ritira spessissimo a pregare il Padre in solitudine... non avrebbe forse il Padre esaudito il Figlio semplicemente vedendo che il Figlio aveva un bisogno? E invece Dio tiene molto al fatto che noi lo preghiamo e Luca ricorda le parole di Gesù a tal proprosito:
      E aggiunse loro: Se uno di voi ha un amico e va da lui a mezzanotte e gli dice: «Amico, prestami tre pani, perché un amico mio è arrivato da un viaggio e non ho nulla da offrirgli;» se quello dall'interno risponde: «Non mi dar seccature, ora la porta è chiusa e i miei figli stanno a letto con me, non posso alzarmi e darteli;» io vi dico che, anche se non si alza a darglieli in quanto amico, pure per l'importunità sua si alzerà e gli darà quanto gli occorre. Perciò vi dico: Chiedete e vi sarà dato, cercate e troverete, bussate e vi sarà aperto. Infatti chiunque domanda riceve, chi cerca trova, e a chi bussa sarà aperto. E chi è tra voi quel padre che al figlio, il quale chieda un pane, dia un sasso? Oppure dia un serpente se chiede un pesce? Oppure uno scorpione se chiede un uovo? Se dunque voi che siete cattivi sapete dare cose buone ai vostri figli, quanto più il Padre che è nei cieli darà lo Spirito Santo a coloro che glielo domandano. (Luca 11:5-13)
      Chiedere non è un atto che serve ad informare Dio, ma un gesto che Dio ci chiede per dimostrare la fede nella nostra richiesta. Poi è anche vero che Dio conosce i nostri bisogni e, come il buon padre, ci darà più di quello che gli chiediamo:
      il Padre vostro sa di quali cose avete bisogno ancor prima che gliele chiediate (Matteo 6:8) 
      Cinque passeri non si vendono forse per due soldi? Eppure nemmeno uno di essi è dimenticato davanti a Dio. Anche i capelli del vostro capo sono tutti contati. (Luca 12:6)
      Per concludere, ritornando al tema della verosimiglianza storica, ripubblico una foto storica di Gesù. Tale foto è una delle rielaborazioni artistiche che Ray Downing, artista digitale ed esperto di 3D, ha fatto della ricostruzione 3D operata da egli stesso sulla Sacra Sindone di Torino. Tale ricostruzione 3D è stata anche oggetto di una trasmissione su alcuni noti canali satellitari scientifici, i cui video sono facilmente reperibili anche su internet. Mentre le rielaborazioni fotografiche rispecchiano la sensibilità artistica di Downing unita ad una solida base storica ed etnografica: ecco perchè potete dimenticare capelli biondi ed occhi azzurri, immaginando invece quei tratti i medio-orientali che Publio Lentulo o lo pseudo-tale descrive in modo storicamente conforme.