Detecting Brute Force Attacks on Linux using Graylog/Elasticsearch

I noticed one of my servers is sending more logs than the other. `sshd` was the application sending the most amount of logs in the last 24 hours.

The logs look like these:

pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.52 user=root

Failed password for root from 116.31.116.52 port 14281 ssh2

message repeated 2 times: [ Failed password for root from 116.31.116.52 port 14281 ssh2]

Received disconnect from 116.31.116.52 port 14281:11: [preauth]

Disconnected from 116.31.116.52 port 14281 [preauth]

PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.52 user=root

Since the IPs are being logged, I can know from where these are coming. Let’s generate a map.

Well well well, 5437 occurrences from China. Gotta do something. Here’s frequency of the attacks this week.

It seems to have amplified today. Looking at the logs, we can see that the were trying different passwords for the user `root`. Lemme just disable password authentication for SSH.

$ vim /etc/ssh/sshd_config

Change the line

#PasswordAuthentication yes

to

PasswordAuthentication no

$ service ssh restart

And we can see the logs are no more appearing 😉

Do you wish to analyse your server logs too? Feel free to message me on Facebook or Twitter or LinkedIn

 

Goodbye AirAsia

Mauritian social medias are full of disapointment by the fact the AirAsia will stop it’s service in Mauritius soon.

“The suspension of the Mauritius route is a part of the company’s big plan in network restructuring aimed at improving operational efficiencies in term of aircraft utilizations”

There are rumours that this is due to pressure by some Mauritians groups

“the sudden decision could be due to peer pressure by local ethnic groups, lobbying to the authorities in Mauritius to stop the highly successful flights.” –theindependent.sg

As I am a common people, I don’t have the ability to know the real reason behind.

It’s a really sad thing that Middle class Mauritians won’t be able to afford holidays abroad as AirAsia was allowing. Is there anyone to standup for “ti-dimounes”?

Slavery still on in the Employment Rights Act of Mauritius

Stay in your job position for 8 hours. On top of that, add 1 hour more for lunch time. Makes 9 hours in the workplace already.

As the time of writing, February 2017, teleportation has not yet been invented — or at least not that common people know of. It takes around 1 hour to 3 hours to commute to our workplace. Stupid traffic jams. Cherry on the cake, Mauritian Ministers with their escorts have the guts (‘toupe monstre’) to halt other road users so they can drive in our tax-paid BMWs and on our tax-paid roads in front of us while we, uhm, watch them in their dark tinted windows. Why are they in such a hurry to travel to finally do nothing?

The 8 hour work day supposed to be like this (best case scenario):

But in reality, it’s very different:

Lot’s of people do over-times on top of the 8 hour work which further decreases their personal times and sleep. This leads to insomnia, depression.

I believe we have the rights to spend time with our children, energy to setup shop. To summarise, we need time to live!

How many for “30 hour work-week” in Mauritius?

Why it took me 13 Days to get a Mauritian Passport

You know what sucks? When you’re completing some formalities and some officials tell you that you lack a particular document and they send you home.

It happened to me when I was applying for a Mauritian Passport. The official government website says:

Day 1 (Wednesday)

Printed and filled the Passport form. Got my passport photos shot at a studio. Reached Police Station at 17:00 with all documents mentioned on the website. The officers told me the Immigration Office closes at 16:30. Go Home #1

Day 2 (Thursday)

Went at the Immigration Office again at 10:45. Officer says I do not have a proof of address document. I need to go home and fetch it. I told the officer that proof of address was not mentioned on the website. He replied the proof of address is required by the “Police” to sign the address section of the document.

But I had other plans later that day. Couldn’t afford to go home and come back again. Go Home #2

Day 3 (Friday)

Slept till late. Had to go to Friday prayers. Reached Police Station at 15:00. Brought my proof of address (CEB and Telecom bill). Made Police officer sign the proof of address section of the form. However, couldn’t submit the form to the Immigration Office because they only take applications from 09:00 – 14:30 (lunch time 12:00 – 13:00). Go Home #3

Day 4/5/6 (Saturday/Sunday/Monday)

Weekends and Public Holiday. The Immigration Offices are closed in Police Stations.

Day 7 (Tuesday)

Managed to submit the form to the Immigration office. Paid Rs 700. Got receipt with appointment on the following Monday between 14:30 – 16:00 to fetch it. They told me to come in person. Go Home #4

Day 8/9/10/11/12 (Wednesday – Sunday)

4 days waiting periods and weekends

Day 13 (Monday)

Finally the big day. Returned to work from holidays of 2 weeks. Had to take half day leave at work in the afternoon to go fetch the passport. Got the passport within 5 mins reaching the office. Go Home #5

 

Conclusion

If only the 50 million rupees website had hinted that the Police officers will be requiring a proof of address, it would have saved like a week of waiting and a half-day leave for a common citizen of Mauritius.

Emailing those guys seem not to be an options since the old “gov.mu” mail is still up on the website. Gotta call them when I the motivation to 🙁

IoT Series: Smart Light/Sensors in the Kitchen

The Idea

The idea is simple. When someone is the kitchen, the lights should be turned on. When their’s no one,obviously it should be turned off. Wouldn’t a simple $10 IR switch from eBay do the job?

WiFi Switch with Motion Sensor attached

“Would the lights turn on even during the day” my mom asked when I presented the system to her. “Of course not” I replied. It would have be counterproductive and non-environmental friendly then.

Everyone can start using cheap sensors and all but using them in such a way that actually makes sense is what’s the challenge.

How it works

When the motion sensor detects motion, it sends a signal to via MQTT to my main app server.

The server side application calculates whether the sun is above or below horizon — the sun doesn’t rise and set at the same time throughout the year. e.g. in summer, the sun can set around 1900 but in winter, around 1800. The application will calculate the exact time  on a daily basis so I won’ have to worry about this.

If the sun is below horizon, the kitchen light will turn on. Else the motion detected will just be ignored (but still be graphed for future use).

Is that the only benefit?

Having a IoT sensors and switches would allow be to get into the next phase of my work: Machine Learning or AI (Artifical Intelligence) as you wish to call it.

For instance, you might start by looking at the graphs for each light to find a pattern visually.

Right now, I do not have the ressources to send all the data in an Elasticsearch cluster then visualise it using Kibana. Another idea would be to mine the data with Google’s Tensorflow. Alone, it will take me some time to do it all.

Previous works on IoT

If you haven’t been following me previously, I made a system that whenever I reach in front of my house, my outside lights turn on automatically for 2 minutes — the time I reverse my car and enter my house. You may find the article here: Internet of Things (IoT) in Mauritius, lemme just do it!

 

Wanna get into the world of Home Automation too? Wanna turn on your coffee machine from your bed and more? Feel free to contact me on LinkedIn, Facebook or Twitter.

[Part 1] Requirements of a Good Transportation System for Mauritius

Transportation in Mauritius is better than lots of “third world” countries. I think Mauritius deserves to be the top!

Requirements of a good Transportation System

1. Eco-friendly

Our planet first, right?

2. Time Saving

Time is money they say. Fuck money! Time is life. Why waste time to get more imaginary money? Be with your family. Work your hobbies. Make yourself happier.

3. Comfortable

We’re animals. Comfort is what we all like.

4. Cheap

We don’t need to be spending 50% of our salary to be able to go to the ever diminishing public beaches (special thanks to Mr Shawkutally Soodhun for selling our beaches like his predecessors).

5. Safe

Who wants to die or lose some body parts? Safe

Conclusion

I think all the points above can be summarised by 1 word: Stress-Free

We don’t want to to harm the planet. We don’t like being bored. We want to live our lives to the fullest. If we continue to believe in our stupid Ministers and Parliamentarians, nothing ain’t gonna change — at-least in the not favour of Mauritians.

Please do comment about your personal requirements for what you, as a Mauritian, expect our transportation system to be. Stay safe. Let’s hope 2017 is the year Mauritians talk, propose ideas and get things done 😉

 

 

Why does God “test” children?

I was scrolling Facebook when I saw this post:

(The Godless and Irreligious:)

由 Friendly Atheist 揑澃äșŽ 2016ćčŽ12月13æ—„

 

Does it make sense? I think yes. Why does God has to test small kids who don’t even know they are being tested — or at-least don’t understand the reason of it? I previously wrote an article on how to determine whether God is being nice to you or you are being tested: The 3 Arrays of Life.

Yet, people tell me there are books after which you read, you’ll stop asking question whether is God fair or why is there so much injustice in the world. Basically everything is about “absolute justice”. Maybe I should read one of the books to understand how can people think that way.

Anyways, one should not be afraid to question stuffs. Always question everything whether at work or at home. You’ll die less stupid (or more stupid according to some if your opinions differ to theirs).

Porlwi by Trash. Or not!

Mauritius lacks entertainment for the population. Porlwi by light is an awesome event. It’s like living in a magic world for few hours.

However,  like any large human gathering,  trash is left all over the place.

Some people have posted on social media that the Porlwi by light organisers are somewhat incompetent people who did not cater to clean the streets after the people. Seriously?

Before criticising the organizers,  can they organise such an event by themselves? I guess  some of them can’t even change a light bulb in their bathroom; forget about even making 1 art piece.

I can’t organise such an event on my own. But not throwing trash on the streets is definitely in my list of competence.

Please please. I want this festival to continue. Let’s be civilised people. Everyone play their part, we shall all be winners 😉

If you want the festival to continue too, do share this article with your friends

5 Items to take when Hiking to Les 7 Cascades, Mauritius

Hiking is a very physical activity which can be hard but very much rewarding.

Watch as many videos as you want. Nothing can come close to as ‘living the moment’ yourself.

An unplanned hiking can easily spoil your whole experience. Here’s why I decided to write about the items needed for a nice hiking experience.

Items To Take

The order in which the items are listed do not reflect their respective importance. All of the items listed below are of equal importance.

1. Water

The very strict minimum is 1 litre per person. Juices do NOT count as water.

2. Back bag

Where are we going keep our precious bottle of water? In our hands? Nope! Hiking is NOT jogging on a track. You’ll need your hands to be free all the time

3. Light lunch

Hikings are not a feast. Biryani-like types of lunch are not recommended. You’ll want something light, easy to carry, easy to consume while listening to the water falling and admiring the view. Don’t overcomplicate your own lives 😉

4. First Aid Kit

Mishaps can and will happen. No denial in that. It’s part of the thrill actually. However,  we need to take maximum precautions so that no one gets hurt. A first aid kit is necessary.

5. Shoes

Forget about Sandals and high-heels. We need high-gripping shoes to be able to cope with sandy soil, hard soil, dry rocks, wet rocks, algae covered rocks etc.

6. Optionals

6.1 juices/fruits: for quick energy

6.2 Cameras

Do take pics for your own personal records and social networks. But but…

Don’t spend all your time watching through your 2 inch screen. Look up! The view is much more amazing. 4K is nothing compared to what our eyes can see.

Items NOT to take

Everything not listed above is unnecessary and will add weight to carry and can make your hiking experience unnecessarily painful. Before adding anything in my bag, I think whether the items will eventually get consumed or not? At the beginning of the hike, you’ll have the most amount of energy. You can carry a heavy bag. As you progress, your energy level will decrease. The more difficult it will be to carry a heavier bag. Basically you want a situation like this:

screen-shot-2016-12-01-at-12-10-13-pm

Ok. Here’s the non-exhaustive list:

  • Makeups: Eye liners, Foundation. Really no need for these. A smiling face is prettier than uhm…everything.
  • Sunscreen: Apply beforehand. No need to add a bottle of 400grams in your bag which will not get used up completely.

Want to go Hiking at Les 7 Cascades but don’t know how to proceed?

Feel free to contact me for if you need an experienced guide.

Changes to Road Traffic Act Mauritius

According to L’express, today the Ministers were supposed to discuss about changes to Road Traffic Act: Amendements Ă  la Road Traffic Act: ce que risquent les chauffards

vlcsnap-2016-11-22-21h43m52s26

The article states:

“Conduite dangereuse entraĂźnant la mort

Un individu qui a causĂ© la mort d’une personne en se rendant coupable de conduite dangereuse sera passible, aprĂšs condamnation, d’une amende variant entre Rs 25 000 et Rs 50 000 et d’une peine d’emprisonnement ne dĂ©passant pas cinq ans.Actuellement, l’emprisonnement maximal est de trois ans pour ce dĂ©lit…

Conduite imprudente en Ă©tat d’ivresse

Un conducteur reconnu coupable d’avoir causĂ© la mort d’une autre personne alors qu’il Ă©tait en Ă©tat d’ivresse sera passible d’une peine d’emprisonnement de cinq ans au maximum, au lieu de trois ans.”

Dunno actual the benefits caused by keeping someone in jail for 2 more years on the expense of Mauritian tax payers.

“En cas d’accident

Jusqu’à prĂ©sent, le conducteur impliquĂ© dans un accident a quatre heures pour le rapporter Ă  la police. Ce dĂ©lai sera ramenĂ© Ă  une heure.”

Hmm. Purpose?

Le rîle d’un magistrat

Un magistrat aura dĂ©sormais la possibilitĂ© de suspendre le permis d’un conducteur arrĂȘtĂ© avec un taux d’alcool au-dessus de la limite autorisĂ©e, Ă  la demande de la police et avant mĂȘme qu’il ait Ă©tĂ© reconnu coupable en cour.

What? Can’t understand anything. What’s the difference between “reconnu coupable” and having higher alcohol level in blood? Either you broke the law or you did not. WTF?

Anyways, forget the Ministers and their shows. What do YOU think will really reduce accident on Mauritian roads?

My thoughts:

  • Replace roundabouts by flyovers. Might cost a lot but much less than what the ministers spend abroad in 1 year alone.
  • Add more reflective road markings.
  • Remove humps on the roads to reduce stress fir drivers.
  • Add more speed cameras but increase the speed limit so as to still make it drivable. Some places the speed limit is at 60km/h for no reason despite the car naturally wants to go at 80km/h.