-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_lacework.sh
executable file
·69 lines (58 loc) · 2.2 KB
/
setup_lacework.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
#!/bin/zsh
# first setup Lacework-specific profile (needed for $GOPATH)
source .lacework_profile
# setup work directories
echo "Setting up work directories"
LACEWORK_DIR=$GOPATH/src/github.com/lacework
LACEWORK_DEV_DIR=$GOPATH/src/github.com/lacework-dev
mkdir -p $LACEWORK_DIR
mkdir -p $LACEWORK_DEV_DIR
# Lacework-specific git settings
CODER_SSH_PUBKEY=$HOME/.ssh/coder.pub
if [[ -e "$CODER_SSH_PUBKEY" ]]; then git config --global user.signingkey $CODER_SSH_PUBKEY; fi
if [[ -v CODER_USER_EMAIL ]]; then git config --global user.email $CODER_USER_EMAIL; fi
# Use pinned version of Terraform for some Lacework-specific infra
TFENV=tfenv
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
if PATH="$(brew --prefix)/bin:$PATH"; command -v $TFENV > /dev/null 2>&1; then
PATH="$(brew --prefix)/bin:$PATH"; $TFENV use v1.0.11
echo "Using Terraform CLI v1.0.11"
else
echo "$TFENV not found, not running $TFENV use v1.0.11"
fi
# Check that $GOPATH/bin is in PATH
echo $PATH | grep "lwcode"
# Add dependencies to build the agent (hopefully temporary)
sudo apt-get update && \
sudo apt-get install -y \
bison \
clang \
flex \
libcap-dev \
libdbus-1-dev \
libelf-dev \
libmagic-dev \
libmnl-dev \
protobuf-compiler
if [ ! -d "/tmp/libpcap" ]; then git clone https://github.com/the-tcpdump-group/libpcap.git /tmp/libpcap; fi
mkdir -p /tmp/libpcap/build
cd /tmp/libpcap/build && cmake -DDISABLE_DBUS=1 -DDISABLE_RDMA=1 -DBUILD_SHARED_LIBS=1 .. && make && sudo make install
cd / && \
tar -czf /tmp/pcap.tgz \
usr/local/lib/libpcap.so* \
usr/local/lib/libpcap.a \
usr/local/include/pcap/ \
usr/local/bin/pcap-config \
usr/local/lib/pkgconfig/libpcap.pc \
$(find usr/local/share/man -name "pcap*") \
;
cd / && \
sudo tar -xzf /tmp/pcap.tgz -C / \
&& rm /tmp/pcap.tgz \
;
# Install `eksctl`
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo install /tmp/eksctl /usr/local/bin
# Install `minikube`
curl -fsSL https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -o /tmp/minikube-linux-amd64
sudo install /tmp/minikube-linux-amd64 /usr/local/bin/minikube