Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSI Support #606

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions so-elastic-agent-builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
# or more contributor license agreements. Licensed under the Elastic License 2.0; you may not use
# this file except in compliance with the Elastic License 2.0.

FROM ghcr.io/security-onion-solutions/golang:1.22.6-alpine

ARG MSITOOLS_VERSION=v0.103

FROM ghcr.io/security-onion-solutions/alpine:3.20.2 AS msibuilder

# Re-declare ARG to make it available in this stage
ARG MSITOOLS_VERSION

# Install build dependencies
RUN apk add --no-cache \
git build-base autoconf automake libtool pkgconfig \
glib-dev libgsf-dev util-linux-dev libxml2-dev \
gobject-introspection-dev meson ninja vala bison \
libgcab-dev g++ \
&& rm -rf /var/cache/apk/*

# Clone and build msitools
RUN git clone https://github.com/GNOME/msitools.git /build/msitools \
&& cd /build/msitools \
&& git checkout ${MSITOOLS_VERSION} \
&& git submodule update --init \
&& meson setup builddir \
&& ninja -C builddir install

# Final stage with Go
FROM ghcr.io/security-onion-solutions/golang:1.23.3-alpine

# Install runtime dependencies for wixl
RUN apk add --no-cache \
glib libgsf libxml2 util-linux \
gobject-introspection libgcab make

# Copy msitools files from builder
COPY --from=msibuilder /usr/local/bin/wixl* /usr/local/bin/
COPY --from=msibuilder /usr/local/lib/libmsi* /usr/local/lib/
COPY --from=msibuilder /usr/local/share/wixl-0.103 /usr/local/share/wixl-0.103

# Set up workspace:
# source is go code
# msi is config & lib for wixl
RUN mkdir /workspace
ADD source /workspace
ADD msi /workspace
WORKDIR /workspace
RUN go get .
33 changes: 33 additions & 0 deletions so-elastic-agent-builder/msi/so-elastic-agent.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SO-Agent" Language="1033" Version="1.0.0" Manufacturer="Security Onion Solutions" UpgradeCode="bc258551-c208-4c6b-97b0-a164eb550599">
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" />
<MediaTemplate EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="CompanyFolder" Name="Elastic">
<Directory Id="INSTALLLOCATION" Name="Agent">
<Component Id="installer" Guid="2cbb30bc-0a99-aa6b-f2b3-5495290ae580" Win64="yes">
<File Id="installer" Source="/output/so-elastic-agent_windows_amd64" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="SOElasticAgent" Title="SOElasticAgent" Description="Installs all the files needed for SOElasticAgent" Level="1" AllowAdvertise="no" ConfigurableDirectory="INSTALLLOCATION">
<ComponentRef Id="installer"/>
</Feature>
<Binary Id="WixCA" SourceFile="wixca.dll" />
<CustomAction Id="SetInstall" Property="Install" Value="&quot;[#installer]&quot;"></CustomAction>
<CustomAction Id="SetUninstall" Property="Uninstall" Value="&quot;[INSTALLLOCATION]elastic-agent.exe&quot; uninstall"></CustomAction>
<CustomAction Id="Uninstall" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
<CustomAction Id="Install" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="SetUninstall" After="InstallInitialize">REMOVE=&quot;ALL&quot;</Custom>
<Custom Action="Uninstall" After="SetUninstall">REMOVE=&quot;ALL&quot;</Custom>
<Custom Action="SetInstall" Before="Install">Not Installed</Custom>
<Custom Action="Install" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
Binary file added so-elastic-agent-builder/msi/wixca.dll
Binary file not shown.
Loading