Server.Utils.CreateLinuxPackages
Server.Utils.CreateLinuxPackages
Builds Debian (.deb) and RPM client packages with embedded client config for the current organization.
This artifact depends on the following tools:
- Clients
You can replace this with suitable Velociraptor Linux build, or else the current release binary will be used by default.
Use the following shell commands to inspect the resulting RPM and Deb:
- rpm -qi velociraptor.rpm
- rpm -qp –scripts velociraptor.rpm
- dpkg-deb -I velociraptor.deb
name: Server.Utils.CreateLinuxPackages
description: |
Builds Debian (.deb) and RPM client packages with embedded client
config for the current organization.
This artifact depends on the following tools:
* Clients <velo-tool-viewer name="VelociraptorLinux" />
You can replace this with suitable Velociraptor Linux build, or else
the current release binary will be used by default.
Use the following shell commands to inspect the resulting RPM and Deb:
- rpm -qi velociraptor.rpm
- rpm -qp --scripts velociraptor.rpm
- dpkg-deb -I velociraptor.deb
type: SERVER
parameters:
- name: CustomConfig
description: Supply a custom client config instead of using the one from the current org
type: yaml
- name: ServiceName
description: Customize the service name
- name: Release
description: Customize the release version
- name: Maintainer
description: Customize the maintainer
- name: MaintainerEmail
description: Customize the maintainer email
- name: Homepage
description: Customize the homepage URL
- name: Vendor
description: The vendor
default: The Velociraptor Team
- name: Labels
description: A list of labels to append to the config.
type: csv
default: |
Labels
- name: ProxyString
description: |
If a proxy is needed this should be for example: https://192.168.1.1:3128
imports:
- Server.Utils.Policy
sources:
- query: |
LET client_config <=
if(condition=ValidateClientConfig(Config=CustomConfig),
then=CustomConfig,
else=ToDict(item=org()._client_config))
LET client_config <= if(condition=Labels.Labels || ProxyString,
then=AddLabelsToConfig(Config=client_config, Labels=Labels.Labels, Proxy=ProxyString),
else=client_config)
// Convert to YAML for repacking.
LET client_config_yaml <= serialize(format="yaml", item=client_config)
LET TmpDir <= tempdir()
// This is an example of how to modify the spec to customize the
// creation of the RPM. The default template does not set the
// vendor property in the RPM, so we just update the metadata
// template while preserving all the other fields.
// See https://github.com/google/rpmpack/blob/2467806670a618497006ff8d8623b0430c7605a9/rpm.go#L56
LET _RPMSpec <= SELECT Spec FROM rpm_create(show_spec=TRUE)
LET RPMSpec <= _RPMSpec[0].Spec + dict(Templates=_RPMSpec[0].Spec.Templates +
dict(Metadata=format(format='''
{"Name": "{{ .SysvService }}",
"Vendor": "%v",
"Version": "{{ .Version }}",
"Release": "{{ .Release }}",
"Arch": "{{ .Arch }}",
"BuildTime": "%v"
}
''', args=[Vendor, timestamp(epoch=now())])))
LET _DebSpec <= SELECT Spec FROM deb_create(show_spec=TRUE)
LET DebSpec <= _DebSpec[0].Spec
LET UpdateExpansion(Expansion) = Expansion + dict(
Name=ServiceName || Expansion.Name,
Release=Release || Expansion.Release,
SysvService=ServiceName || Expansion.SysvService,
Maintainer=Maintainer || Expansion.Maintainer,
MaintainerEmail=MaintainerEmail || Expansion.MaintainerEmail,
Homepage=Homepage || Expansion.Homepage
)
SELECT Upload,
upload(accessor='data',
file=client_config_yaml,
name="Config") AS ClientConfig
FROM chain(a={
SELECT OSPath.Basename AS Name,
upload(file=OSPath, name=OSPath.Basename) AS Upload
FROM deb_create(
directory_name=TmpDir,
package_spec=DebSpec +
dict(Expansion=UpdateExpansion(Expansion=DebSpec.Expansion)),
config= client_config_yaml)
}, b={
SELECT OSPath.Basename AS Name,
upload(file=OSPath, name=OSPath.Basename) AS Upload
FROM rpm_create(
directory_name=TmpDir,
package_spec=RPMSpec +
dict(Expansion=UpdateExpansion(Expansion=RPMSpec.Expansion)),
release=Release || RPMSpec.Expansion.Release,
config= client_config_yaml)
})
column_types:
- name: Upload
type: upload_preview