Please subscribe to unlock this content. Enter your email to get access.
BlueSky .NETCORE API Framework is the common development platform which is developed by Sammy Cheng, from BlueSky Information Technology (Int’l) Co. Ltd. The platform will be mainly used on .NETCORE API server development for Mobile APPS, Website and Applications. This is a universal set of common services, controllers and implementation of infrastructure. The framework was based on Microsoft .NET Core 5 and Entity Framework 6, and will upgrade to .NET Core 6 in soon.
BlueSky .NET Core API Framework Block Diagram
The Framework designs with reference to MVC model to implement of controllers, services, factories, repositories and data provider. This framework help developers on minimizing the development time and more focus on the core of business logic development. It provides different useful helpers and services so that developers can implement and deploy the project rapidly and more standardized.
For this guide, we will briefly describe the whole API framework with the following topics:
Please subscribe to unlock this content. Enter your email to get access.
using Microsoft.AspNetCore.Http.Extensions;
var url = httpContext.Request.GetEncodedUrl();
or
var url = httpContext.Request.GetDisplayUrl();
depending on the purposes.
//get request url in asp.net core
using Microsoft.AspNetCore.Http.Extensions;
var url = httpContext.Request.GetEncodedUrl();
//or
var url = httpContext.Request.GetDisplayUrl();
//or
var url = HttpContext.Current.Request.Url.AbsoluteUri;
A denial-of-service (DoS) or distributed denial-of-service (DDoS) attack is a malicious attempt to disrupt normal traffic of a targeted server, service, or network by overwhelming the target or its surrounding infrastructure with a flood of Internet traffic. There are several types of DDoS attacks, for example, HTTP flood, SYN flood, DNS amplification, etc.
Protection against DDoS
Configuration lines
These rules are only an improvement for firewall, do not forget to properly secure your device: Building Your First Firewall!
In the newly created chain, we will add the following rule with the “dst-limit” parameter. This parameter is written in the following format: dst-limit=count[/time],burst,mode[/expire]. We will match 32 packets with 32 packet burst based on destination and source address flow, which renews every 10 seconds. The rule will work until a given rate is exceeded.
So far all the legitimate traffic should go through the “action=return”, but in the case of DoS/DDoS “dst-limit” buffer will be fulfilled and a rule will not “catch” any new traffic. Here come the next rules, which will deal with the attack. Let`s start with creating a list for attackers and victims which we will drop:
ip firewall address-list
add list=ddos-attackers
ip firewall address-list add list=ddos-targets
ip firewall raw add chain=prerouting action=drop src-address-list=ddos-attackers dst-address-list=dddos-targets
With the firewall filter section, we will add attackers in the “DDoS-attackers” and victims in list “ddos-targets” list:
An SYN flood is a form of DoS attack in which an attacker sends a succession of SYN requests to a target’s system in an attempt to consume enough server resources to make the system unresponsive to legitimate traffic. Fortunately, in RouterOS we have specific feature for such an attack:
/ip settings set tcp-syncookies=yes
The feature works with sending back ACK packets that contain a little cryptographic hash, which the responding client will echo back with as part of its SYN-ACK packet. If the kernel doesn’t see this “cookie” in the reply packet, it will assume the connection is bogus and drop it.
SYN-ACK Flood
An SYN-ACK flood is an attack method that involves sending a target server spoofed SYN-ACK packet at a high rate. The server requires significant resources to process such packets out-of-order (not in accordance with the normal SYN, SYN-ACK, ACK TCP three-way handshake mechanism), it can become so busy handling the attack traffic, that it cannot handle legitimate traffic and hence the attackers achieve a DoS/DDoS condition. In RouterOS, we can configure similar rules from the previously mentioned example, but more specifically for SYN-ACK flood: