Skip to content

Commit 790188d

Browse files
committed
update to falco 0.40.0, adjust as needed to build libs on alpine
Signed-off-by: Daniele Carollo <[email protected]>
1 parent 3c3b432 commit 790188d

File tree

8 files changed

+105
-20
lines changed

8 files changed

+105
-20
lines changed

Dockerfile.driver.alpine.amd64

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# syntax = docker/dockerfile:1.0-experimental
2+
#
3+
# Copyright (C) 2022 IBM Corporation.
4+
#
5+
# Authors:
6+
# Frederico Araujo <[email protected]>
7+
# Teryl Taylor <[email protected]>
8+
#
9+
# Licensed under the Apache License, Version 2.0 (the "License");
10+
# you may not use this file except in compliance with the License.
11+
# You may obtain a copy of the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS,
17+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
# See the License for the specific language governing permissions and
19+
# limitations under the License.
20+
21+
ARG FALCO_VER
22+
ARG FALCO_LIBS_VER
23+
ARG ALPINE_VER
24+
25+
#-----------------------
26+
# Stage: mods
27+
#-----------------------
28+
FROM sysflowtelemetry/alpine:mods-${FALCO_LIBS_VER}-${FALCO_VER}-${ALPINE_VER} AS mods
29+
30+
#-----------------------
31+
# Stage: driver
32+
#-----------------------
33+
FROM alpine:${ALPINE_VER} AS driver
34+
35+
RUN apk add \
36+
g++ \
37+
gcc \
38+
cmake \
39+
make \
40+
bash \
41+
perl \
42+
linux-headers \
43+
autoconf \
44+
automake \
45+
m4 \
46+
libtool \
47+
patch \
48+
binutils \
49+
flex \
50+
bison \
51+
wget \
52+
patch \
53+
curl \
54+
clang \
55+
llvm \
56+
xz \
57+
bc
58+
59+
# environment and args
60+
ARG INSTALL_PATH=/usr/local/sysflow
61+
ARG DRIVER_PACKAGE_NAME=falco
62+
ENV DRIVER_NAME=falco
63+
ENV DRIVERS_REPO="https://download.falco.org/driver"
64+
ENV HOST_ROOT=/host
65+
ENV HOME=/root
66+
ARG FALCOCTL_VERSION
67+
68+
#install falcoctl
69+
RUN curl --fail -LS "https://github.com/falcosecurity/falcoctl/releases/download/v${FALCOCTL_VERSION}/falcoctl_${FALCOCTL_VERSION}_linux_amd64.tar.gz" | tar -xz && \
70+
install -o root -g root -m 0755 falcoctl /usr/bin/falcoctl && mkdir -p /etc/falco/ && touch /etc/falco/falco.yaml
71+
72+
# copy resources
73+
COPY --from=mods ${INSTALL_PATH}/modules/bin/docker-entry-ubi.sh /docker-entrypoint.sh
74+
COPY --from=mods ${INSTALL_PATH}/modules/bin/docker-entrypoint.sh ${INSTALL_PATH}/modules/bin/docker-entrypoint.sh
75+
COPY --from=mods /usr/src/falco-* /usr/src/
76+
COPY --from=mods /usr/sbin/dkms /usr/sbin/dkms
77+
78+
ENTRYPOINT ["/docker-entrypoint.sh"]

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ init:
104104
build: init docker-base-build docker-mods-build docker-driver-build docker-libs-build docker-collector-build docker-runtime-build
105105

106106
.PHONY: build/musl
107-
build/musl: init docker-base-build/musl docker-mods-build/musl docker-driver-build docker-libs-build/musl docker-collector-build/musl docker-runtime-build/musl
107+
build/musl: init docker-base-build/musl docker-mods-build/musl docker-driver-build/musl docker-libs-build/musl docker-collector-build/musl docker-runtime-build/musl
108108

109109
.PHONY: docker-base-build
110110
docker-base-build:
@@ -126,6 +126,10 @@ docker-mods-build/musl:
126126
docker-driver-build:
127127
( DOCKER_BUILDKIT=1 docker build --secret id=rhuser,src=$(shell pwd)/scripts/build/rhuser --secret id=rhpassword,src=$(shell pwd)/scripts/build/rhpassword --build-arg MAKE_JOBS=${MAKE_JOBS} --build-arg FALCOCTL_VERSION=${FALCOCTL_VERSION} --build-arg UBI_VER=${UBI_VERSION} --build-arg FALCO_VER=${FALCO_VERSION} --build-arg FALCO_LIBS_VER=${FALCO_LIBS_VERSION} --target driver -t sysflowtelemetry/ubi:driver-${FALCO_LIBS_VERSION}-${FALCO_VERSION}-${UBI_VERSION} -f Dockerfile.driver.amd64 . )
128128

129+
.PHONY: docker-driver-build/musl
130+
docker-driver-build/musl:
131+
( DOCKER_BUILDKIT=1 docker build --no-cache --build-arg ALPINE_VER=${ALPINE_VERSION} --build-arg UBI_VER=${UBI_VERSION} --build-arg FALCO_VER=${FALCO_VERSION} --build-arg FALCOCTL_VERSION=${FALCOCTL_VERSION} --build-arg FALCO_LIBS_VER=${FALCO_LIBS_VERSION} --build-arg FALCO_LIBS_DRIVER_VER=${FALCO_LIBS_DRIVER_VERSION} --target driver -t sysflowtelemetry/alpine:driver-${FALCO_LIBS_VERSION}-${FALCO_VERSION}-${UBI_VERSION} -f Dockerfile.driver.alpine.amd64 . )
132+
129133
.PHONY: docker-libs-build
130134
docker-libs-build:
131135
( DOCKER_BUILDKIT=1 docker build --build-arg UBI_VER=${UBI_VERSION} --build-arg ARCH=${ARCH} --build-arg FALCO_VER=${FALCO_VERSION} --build-arg FALCO_LIBS_VER=${FALCO_LIBS_VERSION} --build-arg FALCO_LIBS_DRIVER_VER=${FALCO_LIBS_DRIVER_VERSION} --target libs -t sysflowtelemetry/sf-collector-libs:${SYSFLOW_VERSION} -f Dockerfile . )
@@ -148,7 +152,7 @@ docker-runtime-build:
148152

149153
.PHONY: docker-runtime-build/musl
150154
docker-runtime-build/musl:
151-
( DOCKER_BUILDKIT=1 docker build --build-arg ARCH=${ARCH} --build-arg RUNTIME_IMAGE=${RUNTIME_IMAGE} --build-arg ALPINE_VER=${ALPINE_VERSION} --build-arg UBI_VER=${UBI_VERSION} --build-arg FALCO_VER=${FALCO_VERSION} --build-arg FALCO_LIBS_VER=${FALCO_LIBS_VERSION} --build-arg FALCO_LIBS_DRIVER_VER=${FALCO_LIBS_DRIVER_VERSION} --target runtime -t sysflowtelemetry/sf-collector-musl:${SYSFLOW_VERSION} -f Dockerfile.musl . )
155+
( DOCKER_BUILDKIT=1 docker build --build-arg ARCH=${ARCH} --build-arg RUNTIME_IMAGE=alpine --build-arg ALPINE_VER=${ALPINE_VERSION} --build-arg UBI_VER=${UBI_VERSION} --build-arg FALCO_VER=${FALCO_VERSION} --build-arg FALCO_LIBS_VER=${FALCO_LIBS_VERSION} --build-arg FALCO_LIBS_DRIVER_VER=${FALCO_LIBS_DRIVER_VERSION} --target runtime -t sysflowtelemetry/sf-collector-musl:${SYSFLOW_VERSION} -f Dockerfile.musl . )
152156

153157
.PHONY: docker-driver-build/musl/s390x
154158
docker-driver-build/musl/s390x:

makefile.manifest.inc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19-
SYSFLOW_VERSION?=0.7.0
19+
SYSFLOW_VERSION?=0.8.0-dev
2020
SYSFLOW_BUILD_NUMBER?=1
21-
FALCO_VERSION=0.39.1
22-
FALCO_LIBS_VERSION=0.18.1
23-
FALCO_LIBS_DRIVER_VERSION=7.3.0+driver
24-
FALCOCTL_VERSION=0.10.0
21+
FALCO_VERSION=0.40.0
22+
FALCO_LIBS_VERSION=0.20.0
23+
FALCO_LIBS_DRIVER_VERSION=8.0.0+driver
24+
FALCOCTL_VERSION=0.11.0
2525
AVRO_VERSION=release-1.11.0
2626
ELF_VERSION=v0.189
2727
GLOG_VERSION=v0.6.0

modules/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ falcolibs/package:
104104
mkdir -p include/curl && cp curl-prefix/src/curl/include/curl/*.h include/curl && \
105105
mkdir -p include/driver && cp driver/src/*h include/driver && cp ../driver/*h include/driver && \
106106
mkdir -p include/userspace/libsinsp && cp ../userspace/libsinsp/*.h include/userspace/libsinsp && \
107+
mkdir -p include/userspace/libsinsp/sinsp_filter_transformers && cp ../userspace/libsinsp/sinsp_filter_transformers/*.h include/userspace/libsinsp/sinsp_filter_transformers/ && \
107108
mkdir -p include/userspace/libsinsp/container_engine && cp ../userspace/libsinsp/container_engine/*.h include/userspace/libsinsp/container_engine/ && \
108109
mkdir -p include/userspace/libsinsp/filter && cp ../userspace/libsinsp/filter/*.h include/userspace/libsinsp/filter/ && \
109110
mkdir -p include/userspace/libsinsp/events && cp ../userspace/libsinsp/events/*.h include/userspace/libsinsp/events/ && \
@@ -122,15 +123,15 @@ falcolibs/package:
122123
cp tbb-prefix/src/tbb/lib_release/libtbb.a lib/ && \
123124
cp jsoncpp-prefix/src/lib/libjsoncpp.a lib/ && \
124125
cp -r jsoncpp-prefix/src/include/json include/ && \
125-
cp -r c-ares-prefix/src/c-ares/target/include/*.h include/ && \
126+
cp -r c-ares-prefix/src/c-ares/include/*.h include/ && \
126127
cp libpman/*.a lib/ && \
127128
cp libsinsp/*.a lib/ && \
128129
find libscap -name '*.a' -exec cp '{}' lib \; && \
129-
cp ../../falco/docker/falco/docker-entrypoint.sh bin/ && \
130+
cp ../../falco/docker/driver-loader-buster/docker-entrypoint.sh bin/ && \
130131
cp re2-prefix/build/libre2.a lib/ && \
131132
cp grpc-prefix/src/grpc/*.a lib/ && \
132133
find grpc-prefix/src/grpc/third_party/abseil-cpp -name '*.a' -exec cp '{}' lib \; && \
133-
cp c-ares-prefix/src/c-ares/target/lib/libcares.a lib/ && \
134+
cp c-ares-prefix/src/c-ares/lib/libcares.a lib/ && \
134135
cp curl-prefix/src/curl/lib/.libs/libcurl.a lib/ && \
135136
cp openssl-prefix/src/openssl/target/lib/*.a lib/ && \
136137
cp zlib-prefix/src/zlib/libz.a lib/libz.a

modules/falco-libs.x86_64.mri

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ addlib libscap_event_schema.a
9292
addlib libscap_platform.a
9393
addlib libscap_platform_util.a
9494
addlib libsinsp.a
95+
addlib libcontainerd_interface.a
9596
addlib libcri_v1alpha2.a
9697
addlib libcri_v1.a
9798
addlib libtbb.a

src/libs/processcontext.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ ProcessObj *ProcessContext::createProcess(sinsp_threadinfo *ti, sinsp_evt *ev,
124124
}
125125
i++;
126126
}
127-
p->proc.uid = static_cast<int32_t>(mainthread->m_user.uid());
128-
p->proc.gid = static_cast<int32_t>(mainthread->m_group.gid());
129-
p->proc.userName = mainthread->m_user.name();
130-
p->proc.groupName = mainthread->m_group.name();
127+
p->proc.uid = static_cast<int32_t>(mainthread->get_user()->uid);
128+
p->proc.gid = static_cast<int32_t>(mainthread->get_group()->gid);
129+
p->proc.userName = mainthread->get_user()->name;
130+
p->proc.groupName = mainthread->get_group()->name;
131131
ContainerObj *cont = m_containerCxt->getContainer(ti);
132132
if (cont != nullptr) {
133133
p->proc.containerId.set_string(cont->cont.id);
@@ -408,10 +408,10 @@ void ProcessContext::updateProcess(Process *proc, sinsp_evt *ev,
408408
i++;
409409
}
410410

411-
proc->uid = static_cast<int32_t>(mainthread->m_user.uid());
412-
proc->gid = static_cast<int32_t>(mainthread->m_group.gid());
413-
proc->userName = mainthread->m_user.name();
414-
proc->groupName = mainthread->m_group.name();
411+
proc->uid = static_cast<int32_t>(mainthread->get_user()->uid);
412+
proc->gid = static_cast<int32_t>(mainthread->get_group()->gid);
413+
proc->userName = mainthread->get_user()->name;
414+
proc->groupName = mainthread->get_group()->name;
415415
}
416416

417417
void ProcessContext::clearProcesses() {

src/libs/sysflowcontext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <cstring>
3333
#include <ppm_events_public.h>
3434
#include <sinsp.h>
35+
#include <user.h>
3536
#include <unistd.h>
3637

3738
#define DRIVER_LOG "DRIVER_LOG"

src/libs/utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ OID *utils::getOIDDelKey() {
8484
std::string utils::getUserName(context::SysFlowContext *cxt,
8585
std::string &containerid, uint32_t uid) {
8686
scap_userinfo *user =
87-
cxt->getInspector()->m_usergroup_manager.get_user(containerid, uid);
87+
cxt->getInspector()->m_usergroup_manager->get_user(containerid, uid);
8888
if (user != nullptr) {
8989
return user->name;
9090
} else {
@@ -96,7 +96,7 @@ std::string utils::getUserName(context::SysFlowContext *cxt,
9696
std::string utils::getGroupName(context::SysFlowContext *cxt,
9797
std::string &containerid, uint32_t gid) {
9898
scap_groupinfo *group =
99-
cxt->getInspector()->m_usergroup_manager.get_group(containerid, gid);
99+
cxt->getInspector()->m_usergroup_manager->get_group(containerid, gid);
100100
if (group != nullptr) {
101101
return group->name;
102102
} else {

0 commit comments

Comments
 (0)