Skip to content

Commit

Permalink
Fixed bunch of paths to old versions of FNM
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-odintsov committed Dec 3, 2017
1 parent ab84924 commit 1fdde91
Show file tree
Hide file tree
Showing 20 changed files with 156 additions and 156 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Expand Up @@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

FastNetMon - High Performance Network Load Analyzer with PCAP/ULOG2 support
Copyright (C) 2013 FastVPSEestiOu
FastNetMon - High Performance DDoS sensor software
Copyright 2017 FastNetMon LTD

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
4 changes: 2 additions & 2 deletions docs/DEV_VERSION.md
@@ -1,6 +1,6 @@
### How I can switch to current Git version?

First of all, please install FastNetMon with automatic installer [here](https://github.com/FastVPSEestiOu/fastnetmon/blob/master/docs/INSTALL.md)
First of all, please install FastNetMon with automatic installer [here](https://github.com/pavel-odintsov/fastnetmon/blob/master/docs/INSTALL.md)

Than switch to master branch and rebuild toolkit:
```bash
Expand All @@ -12,4 +12,4 @@ make
./fastnetmon
```

You could use ```git log``` command for checking about last commits and compare with [GitHub](https://github.com/FastVPSEestiOu/fastnetmon/commits/master)
You could use ```git log``` command for checking about last commits and compare with [GitHub](https://github.com/pavel-odintsov/fastnetmon/commits/master)
8 changes: 4 additions & 4 deletions docs/DOCKER_INSTALL.md
Expand Up @@ -7,7 +7,7 @@ docker pull robertoberto/fastnetmon
First, get fastnetmon.conf from github, edit it after download.

```
wget https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/fastnetmon.conf -O /etc/fastnetmon.conf
wget https://raw.githubusercontent.com/pavel-odintsov/fastnetmon/master/src/fastnetmon.conf -O /etc/fastnetmon.conf
```


Expand Down Expand Up @@ -89,7 +89,7 @@ docker run \
-t panubo/postfix
```

When you link another container with docker other container name will be added to /etc/hosts pointing to its internal IP. So you can use python script notify (https://github.com/FastVPSEestiOu/fastnetmon/blob/master/src/scripts/fastnetmon_notify.py), instead of bash one.
When you link another container with docker other container name will be added to /etc/hosts pointing to its internal IP. So you can use python script notify (https://github.com/pavel-odintsov/fastnetmon/blob/master/src/scripts/fastnetmon_notify.py), instead of bash one.

Just change MAIL_HOSTNAME="localhost" to MAIL_HOSTNAME="postfix" if you start fastnetmon docker container with --link postfix:postfix and create another docker instance with panubo/postfix as --name postfix, for example.

Expand Down Expand Up @@ -121,8 +121,8 @@ touch /var/log/fastnetmon_attacks /var/log/fastnetmon.log /etc/networks_list /et
cp /etc/fastnetmon.conf /etc/fastnetmon.conf.bkp
cp /usr/local/fastnetmon/fastnetmon_notify.py /usr/local/fastnetmon/fastnetmon_notify.py.bkp
wget https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/scripts/fastnetmon_notify.py -O /usr/local/fastnetmon/fastnetmon_notify.py
wget https://raw.githubusercontent.com/pavel-odintsov/fastnetmon/master/src/scripts/fastnetmon_notify.py -O /usr/local/fastnetmon/fastnetmon_notify.py
chmod +x /usr/local/fastnetmon/fastnetmon_notify.py
wget https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/fastnetmon.conf -O /etc/fastnetmon.conf
wget https://raw.githubusercontent.com/pavel-odintsov/fastnetmon/master/src/fastnetmon.conf -O /etc/fastnetmon.conf
```

2 changes: 1 addition & 1 deletion docs/MANUAL_INSTALL.md
Expand Up @@ -44,7 +44,7 @@ Install FastNetMon:
# For compiling on CentOS please remove line "STATIC = -static" from file Makefile and replace line "LIBS += -lboost_thread" by line "LIBS += -lboost_thread-mt"

cd /usr/src
git clone https://github.com/FastVPSEestiOu/fastnetmon.git
git clone https://github.com/pavel-odintsov/fastnetmon.git
cd fastnetmon/src
```

Expand Down
2 changes: 1 addition & 1 deletion docs/THANKS.md
Expand Up @@ -13,7 +13,7 @@ Thanks file! For all peoples which helped this project :)
- Roland Dobbins rdobbins at arbor.net for mitivating to add flow support
- waszi for testing DNA/ZC mode
- Martin Stoyanov for guides for Slackware
- Andreas Begemann for debugging issue https://github.com/FastVPSEestiOu/fastnetmon/issues/90
- Andreas Begemann for debugging issue https://github.com/pavel-odintsov/fastnetmon/issues/90
- Anatoliy Poloz for VMs with FreebSD 9, 10, 11
- Cojacfar / https://github.com/Cojacfar help with documentation transaltion!
- Thomas Mangin for help with ExaBGP integration
Expand Down
2 changes: 1 addition & 1 deletion packages/docker/Dockerfile
Expand Up @@ -28,7 +28,7 @@ RUN apt-get update && apt-get install -y \

RUN pip install exabgp

RUN cd /usr/src; git clone https://github.com/FastVPSEestiOu/fastnetmon.git
RUN cd /usr/src; git clone https://github.com/pavel-odintsov/fastnetmon.git

#COPY exabgp_blackhole.conf /etc/exabgp_blackhole.conf

Expand Down
2 changes: 1 addition & 1 deletion src/FreeBSD_port/Makefile
Expand Up @@ -15,7 +15,7 @@ LIB_DEPENDS= liblog4cpp.so:${PORTSDIR}/devel/log4cpp \
libboost_regex.so:${PORTSDIR}/devel/boost-libs

USE_GITHUB= yes
GH_ACCOUNT= FastVPSEestiOu
GH_ACCOUNT= pavel-odintsov

# TODO: enable this after updating /usr/ports/{UIDs,GIDs}
#USERS= fastnetmon
Expand Down
2 changes: 1 addition & 1 deletion src/FreeBSD_port/pkg-descr
Expand Up @@ -2,4 +2,4 @@ FastNetMon - A high performance DoS/DDoS load analyzer built on top
of multiple packet capture engines (NetFlow, IPFIX, sFLOW, netmap,
PF_RING, PCAP).

WWW: https://github.com/FastVPSEestiOu/fastnetmon
WWW: https://fastnetmon.com
242 changes: 121 additions & 121 deletions src/ci/parallel_builder.go
Expand Up @@ -51,150 +51,150 @@ Create zram disk for build speedup:
modprobe zram num_devices=1
echo $((20*1024*1024*1024)) > /sys/block/zram0/disksize
mkdir /vz_zram
mkfs.ext4 /dev/zram0
mkfs.ext4 /dev/zram0
mount /dev/zram0 /vz_zram
mkdir /vz_zram/private
*/

/*
For renaming of result packages you could use:
find -type f| perl -e 'do{ chomp; my @m=split "/", $_; my @n = split /\./, $_; rename($_, "fastnetmon-git-447aa5b86bb5a248e310c15a4d5945e72594d6cf-$m[1]_x86_64.$n[-1]"); } for <>'
find -type f| perl -e 'do{ chomp; my @m=split "/", $_; my @n = split /\./, $_; rename($_, "fastnetmon-git-447aa5b86bb5a248e310c15a4d5945e72594d6cf-$m[1]_x86_64.$n[-1]"); } for <>'
*/

var distros_x86_64 = []string{ "centos-6-x86_64", "centos-7-x86_64", "debian-6.0-x86_64", "debian-7.0-x86_64", "debian-8.0-x86_64", "ubuntu-12.04-x86_64", "ubuntu-14.04-x86_64" }
var distros_x86_64 = []string{"centos-6-x86_64", "centos-7-x86_64", "debian-6.0-x86_64", "debian-7.0-x86_64", "debian-8.0-x86_64", "ubuntu-12.04-x86_64", "ubuntu-14.04-x86_64"}

var distros_x86 = []string{ "centos-6-x86", "debian-6.0-x86", "debian-7.0-x86", "ubuntu-12.04-x86", "ubuntu-14.04-x86" }
var distros_x86 = []string{"centos-6-x86", "debian-6.0-x86", "debian-7.0-x86", "ubuntu-12.04-x86", "ubuntu-14.04-x86"}

var start_ctid_number = 1000

func main() {
target_directory, err := ioutil.TempDir("/root", "builded_packages")

if err != nil {
log.Fatal("Can't create temp folder", err)
}
target_directory, err := ioutil.TempDir("/root", "builded_packages")

fmt.Println("We will store result data to folder", target_directory)

_ = distros_x86
var wg sync.WaitGroup
if err != nil {
log.Fatal("Can't create temp folder", err)
}

if _, err := os.Stat(public_key_path); os.IsNotExist(err) {
log.Fatal("Please generate ssh keys for root here")
}
fmt.Println("We will store result data to folder", target_directory)

for element_number, distro := range distros_x86_64 {
// Increment the WaitGroup counter.
wg.Add(1)
_ = distros_x86
var wg sync.WaitGroup

go func(position int, distribution_name string) {
// Decrement the counter when the goroutine completes.
defer wg.Done()
if _, err := os.Stat(public_key_path); os.IsNotExist(err) {
log.Fatal("Please generate ssh keys for root here")
}

ip_address := fmt.Sprintf("10.10.10.%d", position)
ctid := start_ctid_number + position
ctid_as_string := strconv.Itoa(ctid)
for element_number, distro := range distros_x86_64 {
// Increment the WaitGroup counter.
wg.Add(1)

vzctl_create_as_string := fmt.Sprintf("create %d --ostemplate %s --config vswap-4g --layout simfs --ipadd %s --diskspace 20G --hostname ct%d.test.com --private %s/%d", ctid, distribution_name, ip_address, ctid, container_private_path, ctid)

r := regexp.MustCompile("[^\\s]+")
vzctl_create_as_list := r.FindAllString(vzctl_create_as_string, -1)

fmt.Println("Create container ", ctid_as_string)
create_cmd := exec.Command("/usr/sbin/vzctl", vzctl_create_as_list...)
//cmd.Stdout = os.Stdout
//cmd.Stderr = os.Stderr
err := create_cmd.Run()

if err != nil {
log.Println("create failed")
log.Fatal(err)
}

// Run it
fmt.Println("Start container ", ctid_as_string)
// We whould wait here for full CT startup
start_cmd := exec.Command("/usr/sbin/vzctl", "start", ctid_as_string, "--wait");
// start_cmd.Stdout = os.Stdout
// start_cmd.Stderr = os.Stderr
err = start_cmd.Run()

if err != nil {
log.Println("start failed")
log.Fatal(err)
}

vzroot_path := fmt.Sprintf("/vz/root/%d", ctid)
auth_keys_path := vzroot_path + "/root/.ssh/authorized_keys"

os.Mkdir(vzroot_path + "/root/.ssh", 0600)
copy_key_command := exec.Command("cp", public_key_path, auth_keys_path)
copy_key_command.Run()

if err != nil {
log.Println("Can't copy ssh keys to container")
log.Fatal(err)
}

os.Chmod(auth_keys_path, 0400)

wget_installer_cmd := exec.Command("wget", "--no-check-certificate", "https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/fastnetmon_install.pl", "-O" + vzroot_path + "/root/fastnetmon_install.pl")
wget_installer_cmd.Run()

if err != nil {
log.Println("Can't download FastNetMon installer to container")
log.Fatal(err)
}

// Remove ssh known hosst file because in other case ssh will fail
os.Remove("/root/.ssh/known_hosts")

// perl /root/fastnetmon_install.pl --use-git-master --create-binary-bundle --build-binary-environment"
// install_cmd := exec.Command("ssh", "-lroot", ip_address, "perl", "/root/fastnetmon_install.pl")
install_cmd := exec.Command("ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no", "-lroot", ip_address, "perl", "/root/fastnetmon_install.pl", "--use-git-master", "--create-binary-bundle", "--build-binary-environment")

var stdout_output bytes.Buffer
var stderr_output bytes.Buffer

install_cmd.Stdout = &stdout_output
install_cmd.Stderr = &stderr_output

install_cmd.Run()

fmt.Println("Command call on " + distribution_name + " finished")

fmt.Println("stdout")
fmt.Println(stdout_output.String())

fmt.Println("stderr")
fmt.Println(stderr_output.String())

fmt.Println("Get produced data from container to host system")
go func(position int, distribution_name string) {
// Decrement the counter when the goroutine completes.
defer wg.Done()

copy_cmd := exec.Command("cp", "-rf", "/vz/root/" + ctid_as_string + "/tmp/result_data", target_directory + "/" + distribution_name)
copy_cmd.Run()
ip_address := fmt.Sprintf("10.10.10.%d", position)
ctid := start_ctid_number + position
ctid_as_string := strconv.Itoa(ctid)

// Stop it
fmt.Println("Stop container ", ctid_as_string)
stop_cmd := exec.Command("/usr/sbin/vzctl", "stop", ctid_as_string);
err = stop_cmd.Run()

if err != nil {
log.Println("stop failed")
log.Fatal(err)
}
vzctl_create_as_string := fmt.Sprintf("create %d --ostemplate %s --config vswap-4g --layout simfs --ipadd %s --diskspace 20G --hostname ct%d.test.com --private %s/%d", ctid, distribution_name, ip_address, ctid, container_private_path, ctid)

fmt.Println("Destroy container ", ctid_as_string)
destroy_cmd := exec.Command("/usr/sbin/vzctl", "destroy", ctid_as_string);
err = destroy_cmd.Run()
r := regexp.MustCompile("[^\\s]+")
vzctl_create_as_list := r.FindAllString(vzctl_create_as_string, -1)

if err != nil {
log.Println("destroy failed")
log.Fatal(err)
}
} (element_number, distro)
}
fmt.Println("Create container ", ctid_as_string)
create_cmd := exec.Command("/usr/sbin/vzctl", vzctl_create_as_list...)
//cmd.Stdout = os.Stdout
//cmd.Stderr = os.Stderr
err := create_cmd.Run()

wg.Wait()
if err != nil {
log.Println("create failed")
log.Fatal(err)
}

// Run it
fmt.Println("Start container ", ctid_as_string)
// We whould wait here for full CT startup
start_cmd := exec.Command("/usr/sbin/vzctl", "start", ctid_as_string, "--wait")
// start_cmd.Stdout = os.Stdout
// start_cmd.Stderr = os.Stderr
err = start_cmd.Run()

if err != nil {
log.Println("start failed")
log.Fatal(err)
}

vzroot_path := fmt.Sprintf("/vz/root/%d", ctid)
auth_keys_path := vzroot_path + "/root/.ssh/authorized_keys"

os.Mkdir(vzroot_path+"/root/.ssh", 0600)
copy_key_command := exec.Command("cp", public_key_path, auth_keys_path)
copy_key_command.Run()

if err != nil {
log.Println("Can't copy ssh keys to container")
log.Fatal(err)
}

os.Chmod(auth_keys_path, 0400)

wget_installer_cmd := exec.Command("wget", "--no-check-certificate", "https://raw.githubusercontent.com/pavel-odintsov/fastnetmon/master/src/fastnetmon_install.pl", "-O"+vzroot_path+"/root/fastnetmon_install.pl")
wget_installer_cmd.Run()

if err != nil {
log.Println("Can't download FastNetMon installer to container")
log.Fatal(err)
}

// Remove ssh known hosst file because in other case ssh will fail
os.Remove("/root/.ssh/known_hosts")

// perl /root/fastnetmon_install.pl --use-git-master --create-binary-bundle --build-binary-environment"
// install_cmd := exec.Command("ssh", "-lroot", ip_address, "perl", "/root/fastnetmon_install.pl")
install_cmd := exec.Command("ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no", "-lroot", ip_address, "perl", "/root/fastnetmon_install.pl", "--use-git-master", "--create-binary-bundle", "--build-binary-environment")

var stdout_output bytes.Buffer
var stderr_output bytes.Buffer

install_cmd.Stdout = &stdout_output
install_cmd.Stderr = &stderr_output

install_cmd.Run()

fmt.Println("Command call on " + distribution_name + " finished")

fmt.Println("stdout")
fmt.Println(stdout_output.String())

fmt.Println("stderr")
fmt.Println(stderr_output.String())

fmt.Println("Get produced data from container to host system")

copy_cmd := exec.Command("cp", "-rf", "/vz/root/"+ctid_as_string+"/tmp/result_data", target_directory+"/"+distribution_name)
copy_cmd.Run()

// Stop it
fmt.Println("Stop container ", ctid_as_string)
stop_cmd := exec.Command("/usr/sbin/vzctl", "stop", ctid_as_string)
err = stop_cmd.Run()

if err != nil {
log.Println("stop failed")
log.Fatal(err)
}

fmt.Println("Destroy container ", ctid_as_string)
destroy_cmd := exec.Command("/usr/sbin/vzctl", "destroy", ctid_as_string)
err = destroy_cmd.Run()

if err != nil {
log.Println("destroy failed")
log.Fatal(err)
}
}(element_number, distro)
}

wg.Wait()
}
4 changes: 2 additions & 2 deletions src/fastnetmon.conf
Expand Up @@ -229,7 +229,7 @@ exabgp_announce_whole_subnet = off
# Please we aware! Flow Spec announce triggered when we collect some details about attack,
# i.e. when we call attack_details script
# Please disable exabgp_announce_host and exabgp_announce_whole_subnet if you want to use this feature
# Please use ExaBGP v4 only (Git version), for more details: https://github.com/FastVPSEestiOu/fastnetmon/blob/master/docs/BGP_FLOW_SPEC.md
# Please use ExaBGP v4 only (Git version), for more details: https://github.com/pavel-odintsov/fastnetmon/blob/master/docs/BGP_FLOW_SPEC.md
exabgp_flow_spec_announces = off

# GoBGP intergation
Expand All @@ -240,7 +240,7 @@ gobgp_announce_whole_subnet = off

# Graphite monitoring
# InfluxDB is also supported, please check our reference:
# https://github.com/FastVPSEestiOu/fastnetmon/blob/master/docs/INFLUXDB_INTEGRATION.md
# https://github.com/pavel-odintsov/fastnetmon/blob/master/docs/INFLUXDB_INTEGRATION.md
graphite = off
# Please use only IP because domain names are not allowed here
graphite_host = 127.0.0.1
Expand Down

0 comments on commit 1fdde91

Please sign in to comment.