Skip to content

Summary for Fuseday 2 2015

Oren Farhi edited this page Feb 25, 2015 · 4 revisions

Fuseday Experience 2/2015 - the dOs Attacks

Introduction

The challenge for this fusesay was developing a simple server, which should be able to do several tasks:

  1. Handle attacks of http requests in the for of geo-location check-ins, this Defending the machine's health ans stability.
  2. On the other hand, attack other servers in the network with similar requests.
  3. Serve a fellow server and output the machine's stats so that a ui is able to display it properly.

Another challenge was to display the attacks in a ui - preferably using a map to show geo-location for the attacks sources.

We were a fullstack team of 6 members that hanlded the UI, Backend and Database.

Design The protocol

We first set out a protcol between the UI and the Backend for the first goal: attacks. we agreed on a simple json format, on which the ui will poll every 2 seconds, while the server should supply each time 10 attacks sources. An example of mocked json for the attacks:

[
  {
    "name": "london",
    "lat": 40,
    "lon": 36,
    "zoom": 8,
    "projection": "EPSG:4326"
  },
  {
    "name": "israel",
    "lat": 33,
    "lon": 36,
    "zoom": 8,
    "projection": "EPSG:4326"
  }
]

For the machine statistics, we used a rather simple json format which was served from another endpoint in the server.
An example of mocked json for the statistics:

{
    "cpuUsage": 86.45,
    "memoryUsage": 55.32,
    "queueSize": 25
}

Tech Stack Of Choice

UI

In the ui, we chose to go with an open source boilerplate which was assembled before the fuseday and was available to all teams.
ki-dashboard is a js fullstack boilerplate, derived form angular-fullstack yeoman generator. It includes the following:

In order to use it, one just needs to clone the repo, follow the readme for additional instructions and best practices (such as scaffolding, installing environment etc..).

We used openlayers api and its angular's directive for displaying the geo-location attacks on the earth maps.

The nodejs layer solved us few challenges in this day:

  1. It provided us with an environment for working with mocks until the real endpoint is ready.
  2. It allowed us to scaffold a simple endpoint quick and easy.
  3. Since the Backend is a micro-service in another machine iwth a different ip, the nodejs layer functioned as a proxy layer and solved cross-origin/cross-domain calls that is forbidden from within the browser.
  4. Fast input/output for data.

Workflow

We created 2 endpoints in the nodejs layer.
The stats endpoint provided the list of attacks that we were supposed to show in the ui.
The admin endpoint provided the data for the statistics of the machine.

For the UI, we used angularjs for fast and rappid development. We created 6 modules:

  1. admin - main purpose is to expose the gauges and statistics of the machine from the stats api.
  2. list - display a plain textual list of the attacks.
  3. map - display the openlayers directive and the attacks on it.
  4. navbar - controls the top navigation bar, and supplied pause & resume controls for polling the server for new data.
  5. sidebar - allows to toggle between 2 screens of the app - Dashboard & Statistics.
  6. stats - displays the Statistics.

Backend

  • spring boot - blocking queue which receives http calls, multiple workers which handle the incoming checkin (write to log, persist to db).
  • Attacker - Apache http client to support (and concurrent) fast http requests.
  • logger - logback async file appender - registers all incoming checkings.

Summary

This day was challenging in a few ways:

  1. designing on-the-fly protocol
  2. integration between 2 servers (ui server and backend server)
  3. finding fast solutions to make things work
  4. creating 2 ui's apps: desktop app, mobile app

Challenge #4 was actually an attempt to reuse the desktop application that was developed with angularjs, and understand how easy it is to do it. Finally, the ionic app didn't made it to the final, however, we got to be familiar with its tools and cli.

Overall, the use of angularjs reduced a lot of boilerplate code and allowed fast solutions with reuse in mind, as well as using implementation for 3rd party modules such as openlayers, while using new data services that we've designed in the beginning of the day.