Feb 202016
 

Preventing DDOS attack from csf firewall.

First make sure DDOS attack is not from open recursive DNS settings. To check and fix that issue please read this article – Preventing DDOS aplification open resolver attack

This article is to set CSF firewall so that any DDOS intentional attack to your server can be prevented.

 

Step 1: open and edit CSF config file. 

 

Settings: 

Enable connection tracking.
CT_LIMIT is max number of connection allowed from one IP, you can set this value as per your server requirement.

Set connection tracking interval.

If you want to get possible ddos attack email then enable it.

If you want to make IP blocks permanent then set this to 1, otherwise blocks
will be temporary and will be cleared after CT_BLOCK_TIME seconds

If you opt for temporary IP blocks for CT, then the following is the interval
in seconds that the IP will remained blocked for (e.g. 1800 = 30 mins)

If you only want to count specific ports (e.g. 80,443) then add the ports
to the following as a comma separated list. E.g. “80,443”

 

These settings will be enough for DDOS attacks but if you are getting more attacks even you have above option configured then we can set few more options.

 

Step 2: Enable distributed attacks

Set the following to the minimum number of unique IP addresses that trigger
LF_DISTATTACK

 

Step 3: Enable distributed FTP attacks

 

Set the following to the minimum number of unique IP addresses that trigger
LF_DISTFTP. LF_DISTFTP_UNIQ must be <= LF_DISTFTP for this to work

 

If this option is set to 1 the blocks will be permanent
If this option is > 1, the blocks will be temporary for the specified number
of seconds

 

Step 4: Enable distributed SMTP attacks.

 

 

Set the following to the minimum number of unique IP addresses that trigger
LF_DISTSMTP. LF_DISTSMTP_UNIQ must be <= LF_DISTSMTP for this to work

 

If this option is set to 1 the blocks will be permanent
If this option is > 1, the blocks will be temporary for the specified number
of seconds

 

This is the interval during which a distributed FTP or SMTP attack is
measured

Mar 062013
 

Sample UDP Client Server

Assalamu’ alaikum wr wb

User Datagram Protocol (UDP), adalah salah satu protokol lapisan transpor TCP/IP yang mendukung komunikasi yang tidak andal (unreliable), tanpa koneksi (connectionless) antara host-host dalam jaringan yang menggunakan TCP/IP. Protokol ini didefinisikan dalam RFC 768.

Oke mari langsung saja kita tulis script nya untuk sisi server

import java.io.*;
import java.net.*;

class UDPServer
{
 public static void main(String args[]) throws Exception
 {
 DatagramSocket serverSocket = new DatagramSocket(9876);
 byte[] receiveData = new byte[1024];
 byte[] sendData = new byte[1024];
 while(true)
 {
 //Deklarasi penerimaan paket
 DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
 serverSocket.receive(receivePacket);
 //Simpan dalam variabel dan cetak
 String sentence = new String( receivePacket.getData());
 System.out.println("RECEIVED: " + sentence);
 //Ambil Default IP yang mengirimkan pesan
 InetAddress IPAddress = receivePacket.getAddress();
 //Ambil port yang mengirimkan data
 int port = receivePacket.getPort();
 //Jadikan huruf besar data yang di terima
 String capitalizedSentence = sentence.toUpperCase();
 //Konvert data yang di terima menjadi byte data
 sendData = capitalizedSentence.getBytes();
 DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port);
 //Kirim kembali data yang terlah di terima
 serverSocket.send(sendPacket);
 }
 }
}

Sekarang untuk aplikasi client nya

import java.io.*;
import java.net.*;

class UDPClient
{
 public static void main(String args[]) throws Exception
 {
 //Baca Inputan keyboard
 BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
 //Deklarasi data paket
 DatagramSocket clientSocket = new DatagramSocket();
 //Lokasi server yang akan dikirim data
 InetAddress IPAddress = InetAddress.getByName("localhost");
 //Deklarasi port server
 int port = 9876;
 //Data yang akan di kirim
 byte[] sendData = new byte[1024];
 //data yang di terima dari server
 byte[] receiveData = new byte[1024];
 //Masukkan data darui keyboard ke variabel
 String sentence = inFromUser.readLine();
 try
 {
 //setting timeout
 clientSocket.setSoTimeout(1000);
 //Masukkan ke send data
 sendData = sentence.getBytes();
 //Inisialisasi paket yang di kirim
 DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port);
 //Kirim paket data
 clientSocket.send(sendPacket);

 //Ambil data yang di kirim oleh server
 DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
 clientSocket.receive(receivePacket);
 //Masukkan data yang di kirim oleh server
 //Konvert dari byte ke string
 String modifiedSentence = new String(receivePacket.getData());
 //Cetak ke layar
 System.out.println("FROM SERVER:" + modifiedSentence);

 }catch (SocketException | SocketTimeoutException EX){;
 System.out.println(EX.getMessage());
 }finally{
 //Tutup UDP
 clientSocket.close();
 }
 }
}

Selamat mencoba semoga membantu

Wassalamu’ alaikum wr wb

Mar 282011
 

Assalamu’ alaikum wr wb

Setelah selesai install apache di server ubuntu, saya ingin mengaktifkan mod rewrite. setelah cari – cari di google ternyata cara aktifkannya sangat mudah sekali.

  1. Dengan menambahkan file rewrite.load
  2. Dengan satu langkah saja

Cara Pertma :

Ketik perintah dalam  console :

#cd /etc/apache2/mods-enabled/
#touch rewrite.load
#nano  rewrite.load

tambahkan script berikut pada file rewrite.load

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

Kemudian simpan.
Cara Kedua
Ketik perintah berikut di console

#a2enmod rewrite

Ok Sekian dulu dari saya semoga membantu dan silakan explore.

Assalamu’ alaikum wr wb