Category Archives: network

nginx as reverse proxy

I’m working on dockerizing several projects with docker-compose. And, I automated checkout from git repository and building projects,
One of maven projects inherits from parent pom the url of nexus repository. And unfortunately, nexus server was moved to a new url. This fails maven build, because it can’t download artifacts from old nexus url.

While I have no time to fix nexus url in parent pom and recompile all depending projects. And while I’m rushed to run and validate my docker-compose. I’m looking for rapid solution.

We can simply use hosts to redirect old url to the new one. But in my case, it’s not possible because the old url contains a port number.

new url:

So, I use nginx as reverse proxy to solve problem:

Step1: install nginx

$ sudo apt-get install nginx

Step2: nginx configuration
create /etc/nginx/conf.d/witr.conf with following content

server {
listen 8080;
location / {
proxy_redirect off;

Step3: locally redirect server name
edit /etc/hosts and add new entry

Step4: restart nginx

service nginx restart

Finally : run my automated build. On download, maven will ask oldurl:8080. hosts will redirect to nginx. Nginx will redirect to newurl. And maven will be able to download artifacts and build will not fail.

save received traffic on tcp port while the port is in use

You have to save all received traffic on a tcp port. But there was one process which already listen to that port.

=> use tcpdump :

More pretty and analysable with Wireshark,
=> use dumpcap :

wireshark under ubuntu

1. configure network of cirtual Machine
in VirtualBox –> settings of virtualMachine(ubuntu) –> Network –> set Promiscuous Mode to allow All
2. start virtual Machine ubuntu
3. install wireshark
> sudo apt-get install wireshark
4. enable root privilege to dumpcap
> sudo setcap ‘CAP_NET_RAW+eip CAP_NET_ADMIN+eip’ /usr/bin/dumpcap
5. that’s all

share folder from ubuntu to windows

We describe here how to share folder in ubuntu within Samba:
  • host : ubuntu
  • host ip :

– Edit “smb.conf”

– Add following :

– Restart samba:

– In windows, mount new drive :
a. choose drive letter,
b. select network->ubuntu->myshared or type \
c. when request user and password, use one of valid users (here witr)

be notified of all svn changes

If you want like me have been notified of all svn changes, the following script I wrote for you.

Prerequisite :

  • svn installed
  • svn well configured for user executing script


export SVN_UPDATES_HOME=/mnt/scripts/svnUpdates
export SVN_UPDATES_LAST=$SVN_UPDATES_HOME/tmp/svnUpdatesLast.txt
export SVN_UPDATES_TMP=$SVN_UPDATES_HOME/tmp/svnUpdates.txt
export SVN_UPDATES_DIFF_TMP=$SVN_UPDATES_HOME/tmp/svnUpdatesDiff.txt

if [[ -s $SVN_UPDATES_LAST ]]
  echo “copy last svn log to tmp”

for log in 1 2 3
  echo “svn log – try:$log”
  svn log -v -l5 -rHEAD:1 > $SVN_UPDATES_LAST
  if [[ -s $SVN_UPDATES_LAST ]]
    echo “svn logged successfully in try:$log”

if [[ -s $SVN_UPDATES_LAST ]]
  echo “proceed to diff last with tmp”
  diff $SVN_UPDATES_LAST $SVN_UPDATES_TMP | grep -E “^<" | sed s/^.// > $SVN_UPDATES_DIFF_TMP
  diffsCount=$(wc -l $SVN_UPDATES_DIFF_TMP | awk {‘print $1’})
  if [ $diffsCount -gt 0 ]
      “diffs found: send notification”
      datetime=$(date “+%Y%m%d-%H%M%S”)
      cp $SVN_UPDATES_DIFF_TMP $logFile
      ### put here the way you want be notified (mail, jabber, …)
      ### echo “==== svn updated cf. $logFile ====” | sendxmpp
      ### cat $logFile | sendxmpp

Here I choose to be notified by message sent from jabber server from my account to my account.
Prerequisite : sendxmpp installed : apt-get install sendxmpp

echo “==== svn updated cf. $logFile ====” | sendxmpp
cat $logFile | sendxmpp

Finally, schedule the script in your crontab (executed each minute recommanded)

* * * * * /mnt/scripts/svnUpdates/

sendxmpp : send jabber message with command line

April 8, 2013

sendxmpp : send jabber message with command line:
install sendxmpp ( : > sudo apt-get install sendxmpp
create user config file : > touch ~/.sendxmpprc
secure your configuration file :  > chmod 600 ~/.sendxmpprc
configure jabber account : > echo ‘; mypassword’ > ~/.sendxmpprc
send your first message : > exho “salut” | sendxmpp yourFriend@server

wireshark and npf under windows7

March 19, 2013

wireshark can not start capture because npf is not running under windows7.
solution : execute cmd.exe as administrator and type:
> sc qc npf
this will display th state of npf. if it’s not running then type
> sc start npf
if you want to set auto start type
> sc config npf start=auto