-
Notifications
You must be signed in to change notification settings - Fork 229
/
setup.sh
executable file
·77 lines (62 loc) · 1.83 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Gatekeeper - DDoS protection system.
# Copyright (C) 2016 Digirati LTDA.
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# All the dependency projects are maintained in this directory.
cd dependencies
# Setup DPDK.
cd dpdk
meson build
cd build
ninja
sudo ninja install
# Gatekeeper is being staticly linked with DPDK, so
# ldconfig(8) is not needed to make DPDK's libraries available system wide.
# sudo ldconfig
# Install kernel modules.
sudo modprobe vfio-pci
# Make modules persist across reboots. Since multiple
# users can run this script, don't re-add these modules
# if someone else already made them persistent.
if ! grep -q "vfio-pci" /etc/modules; then
echo "vfio-pci" | sudo tee -a /etc/modules
fi
# Setup LuaJIT.
cd ../../luajit-2.0
# Build and install.
make
sudo make install
# Setup BIRD.
cd ../bird
# Build and install.
autoreconf
./configure
make
sudo make install
cd ../../
# Build interface name -> PCI address map.
gcc generate_if_map.c -o generate_if_map -Wall
./generate_if_map lua/if_map.lua
# Build client.
cd gkctl
gcc main.c -o gkctl -Wall -Wextra -pedantic
cd ..
# Build BPF programs.
cd bpf
make
make copy
cd ..
sudo mkdir -p /var/run/gatekeeper/
sudo chown -R $USER:$GROUPS /var/run/gatekeeper/
sudo chmod -R 700 /var/run/gatekeeper/