How to avoid ssh session closing on inactivity

CentOs 7 have a built-in configuration to close the inactive ssh session. In term of security it is a good thing but when killing a session after 1 minute of inactivity start to be a mess when you have multiple session opened in parallel.

This can be avoid on the client side by configuring a keep-alive period on the client side. To activate a such keepalive, you just have to connect with the following command line:

ssh -o ServerAliveInterval=5 login@server.com

This will configure client to send a NULL packet every 5 seconds to keep the session opened.

Allow nginx to access a remote DB on a Centos

If you try to access a remote database with nginx or httpd server, you will have a connection problem with error code (13) even if mysql/mariadb client works well in command line. The reason for that is a security limitation set by default not allowing httpd servers sur connect a remote DB.

To disable this limitation and make all work, just type in the command line :

# setsebool -P httpd_can_network_connect 1

You can list all the existing flags for httpd by using getsebool

# getsebool -a | grep httpd

In case you expect SELinux to be the cause of your problem, you can enable / disable it with the following functions

# setenforce 1
# setenforce 0

If you need to check what is the permission missing for SELinux you can run the audit

# tail -100 /var/log/audit/audit.log | audit2allow

Configure internal Lan & OpenVPN on Azure

If you want to create a company like infrastruture on Azure you could expect to create a VPN to have a secured access to it and have an internal lan to protect you servers against external access. Basically the system provides all that you need but, as usual in the closed world of MicroSoft. The VPN server based on SSTP protocol sound hard and not documented to be used with MacOsX or Linux.

I’ll describe in this post how I fixed this issue par using an OpenVpn gateway server.

Continue reading

Hack the SigFox KeyApp demonstrator / tool

Sigfox keyapp

Sigfox keyapp

The Sigfox keyapp is a useful tool you can buy or you can get when reaching the Sigfox kick-start session. Basically, this tool send a message each time you click on the button. This allow to check the network availability where you want just clicking on the button. Easy, useful !

The KeyApp have an internal battery, one led, one button. It is refill with the usb connector and it is based on TD1208. The internal firmware is a partial modem ; it can be used as a modem on serial port from a PC but not all the AT command are implemented on it.

My purpose was to modify this tool to send automatically message every 12 minutes. The firmware can be modified and upload on the standard way (take a look to my other posts). For sure by doing a such thing you take the risk of loosing warranty and you do it at your own risk.

To make it works you just have to know some of the cabling.

  • The Led is active HIGH and located on USR4 signal.
  • To enable the battery power, you must activate USR1 LOW
  • To read the button you must take a look on USR0

The battery is by default not powering the system until you switch USR1 to LOW. If you do not do this, the system will only work on the usb power. It means you can switch off the system simply by switching USR1 to high.

Will come soon a basic sample code.

 

One day at SigFox

sigfox

sigfox

I had the opportunity, today, to be at the sigfox kickoff day, in Toulouse,  with the company I work for. This is an opportunity to post a summary of the technology as it is today.

Sigfox is a network operator for Internet Of Things running on free frequency band (868Mhz in France). Sigfox is deploying itself network in some countries like France. In some other they have partner to deploy it like arquiva in UK (on going actually 10 biggest cities); abertis in Spain, Aerea in Netherland. Actually some European cities are also deployed as pilot : Munich, Menlo, Milan, Warsaw, Dublin, Autria. San Fransisco & Silicon Valley will come soon this year. The target is to have 60 countries in the next 5 Years. Thanks to the long range radio characteristic of the network, Spain has been deployed in 7 months. As to now, the network does not includes roaming constraints & fee. A French licensed device works in any country where the network exists.

The network is high sensitivity with 2 way communication 140 *12 bytes messages a day uplink / 4 * 8 bytes messages downlink. Each of the messages are sent 3 times on different frequency to ensure it will be delivered. The devices are running ultra low energy with 10-25mW radio power. The technology is plug & play : you do not have any peering process to accomplish to make it works (but you have to activate the device in the backend at least…). Data are sent to a global backend whatever the network provider you are passing through and you have contract with. This backend will let you have access to your data in real time and will execute callback (data post) to you own specific backend to proceed your data.

Limits : due to low bandwidth / small messages architecture, the technology does not allow voice, video … transfer for sure. But it is really fitting security, smart cities (traffic, parking waste, street lights…) monitoring, automatic meter reading, leak detection, billing automation…, tracking & security, healthcare (fall detection, distress buttons…), Agriculture.

Continue reading

SWD programming using a RaspberryPi

I previously write this post on how to use a BeagleBoneBlack as a JTAG (SWD) programmer. It was fun but really slow. I port my code on RaspberryPI and now what was taken 5-8 hours is a couple of minutes.

To connect the SWD connector to the PI use the following schema

Connect SWD to RaspberryPi

Connect SWD to RaspberryPi

I use this peace of code to reflash my TD1204 and TD1208 based both on EFM32 when bricked after unsuccessful update…

Here is the python file to interact with SWD : https://github.com/disk91/PySWD/blob/master/RpiGPIO.py

I hop it will be soon integrated in the main PySWD project as the previous one.

You should check or modify flashEFM32.py file

import array

from PirateSWD import *
from RpiGPIO import *
from SWDCommon import *

[...]

def main():
    busPirate = RpiSWD("", vreg = True)
    debugPort = DebugPort(busPirate)
    efm32     = EFM32(debugPort)

To run the Flash program, just launch

# ./flashEFM32.py ../myProgram.bin

 

baby and child alarm clock

Arduino alarm clock for baby

Arduino alarm clock for baby

The purpose of this post was to create an alarm clock form my 2 year old son. I’m lucky he is sleeping well but is waking up before I do and generally call me and mum to go out of the bed, then play in his room … So the problem is that he never know if can wake up and play or if it is too early and have to stay in the bed. For this reason I created this alarm clock to easily indicate him if it is sleep or play time.

The system is quite simple : you program the number of hour you want him to sleep. During sleep time a led display a pink color. After this configured duration, the color change for green. When green, my son is allowed to wake up and play in his room

The post describe how to do it based on an arduino nano.

Continue reading