mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 00:45:19 +00:00
Bump go to 1.19.1 (#7690)
* Bump go to 1.19.1 * Bump remaining go-version to the 1.19.1 * Add extra paths for test-go * Oops, putting the right path in the right place * gofmt file * gofmt ALL THE THINGS * Moar changes * Actually, go.mod doesn't like minor versions
This commit is contained in:
parent
9eafecd95e
commit
8457e55b53
@ -31,7 +31,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
||||
with:
|
||||
go-version: 1.17.8
|
||||
go-version: 1.19.1
|
||||
|
||||
- name: Install Go Dependencies
|
||||
run: make deps-go
|
||||
|
4
.github/workflows/build-binaries.yaml
vendored
4
.github/workflows/build-binaries.yaml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19.1
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
|
||||
@ -71,4 +71,4 @@ jobs:
|
||||
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v2
|
||||
with:
|
||||
name: build
|
||||
path: build/
|
||||
path: build/
|
||||
|
6
.github/workflows/fleet-and-orbit.yml
vendored
6
.github/workflows/fleet-and-orbit.yml
vendored
@ -42,7 +42,7 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['^1.17.0']
|
||||
go-version: ['^1.19.1']
|
||||
mysql: ['mysql:5.7']
|
||||
runs-on: ubuntu-latest
|
||||
needs: gen
|
||||
@ -132,7 +132,7 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['^1.17.0']
|
||||
go-version: ['^1.19.1']
|
||||
runs-on: ubuntu-latest
|
||||
needs: gen
|
||||
steps:
|
||||
@ -180,7 +180,7 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['^1.17.0']
|
||||
go-version: ['^1.19.1']
|
||||
# We can only generate all (PKG, MSI, DEB, RPM) packages from a macOS host.
|
||||
runs-on: macos-latest
|
||||
needs: gen
|
||||
|
@ -37,7 +37,7 @@ jobs:
|
||||
matrix:
|
||||
# Doesn't work on Windows because Linux Docker containers are not supported.
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
go-version: ['1.17.9']
|
||||
go-version: ['1.19.1']
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
|
||||
|
@ -27,7 +27,7 @@ jobs:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
||||
with:
|
||||
go-version: '^1.17.0'
|
||||
go-version: '^1.19.1'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
|
||||
@ -73,7 +73,7 @@ jobs:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
||||
with:
|
||||
go-version: '^1.17.0'
|
||||
go-version: '^1.19.1'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
|
||||
@ -96,7 +96,7 @@ jobs:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
||||
with:
|
||||
go-version: '^1.17.0'
|
||||
go-version: '^1.19.1'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
|
||||
|
3
.github/workflows/golangci-lint.yml
vendored
3
.github/workflows/golangci-lint.yml
vendored
@ -9,6 +9,7 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '**.go'
|
||||
- '.github/workflows/golangci-lint.yml'
|
||||
workflow_dispatch: # Manual
|
||||
|
||||
permissions:
|
||||
@ -26,7 +27,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a
|
||||
with:
|
||||
go-version: '1.17'
|
||||
go-version: '1.19.1'
|
||||
|
||||
- name: Run go lint
|
||||
run: |
|
||||
|
2
.github/workflows/goreleaser-fleet.yaml
vendored
2
.github/workflows/goreleaser-fleet.yaml
vendored
@ -29,7 +29,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
||||
with:
|
||||
go-version: 1.17.8
|
||||
go-version: 1.19.1
|
||||
|
||||
- name: Install JS Dependencies
|
||||
run: make deps-js
|
||||
|
2
.github/workflows/goreleaser-orbit.yaml
vendored
2
.github/workflows/goreleaser-orbit.yaml
vendored
@ -42,7 +42,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
||||
with:
|
||||
go-version: 1.19.0
|
||||
go-version: 1.19.1
|
||||
|
||||
- name: Run GoReleaser
|
||||
run: go run github.com/goreleaser/goreleaser@v1.9.2 release --rm-dist -f orbit/.goreleaser.yml
|
||||
|
@ -27,7 +27,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
||||
with:
|
||||
go-version: 1.17.8
|
||||
go-version: 1.19.1
|
||||
|
||||
- name: Install Dependencies
|
||||
run: make deps
|
||||
|
3
.github/workflows/test-go.yaml
vendored
3
.github/workflows/test-go.yaml
vendored
@ -14,6 +14,7 @@ on:
|
||||
- '**.go'
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
- '.github/workflows/test-go.yaml'
|
||||
workflow_dispatch: # Manual
|
||||
schedule:
|
||||
- cron: '0 4 * * *'
|
||||
@ -26,7 +27,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
go-version: ['^1.17.8']
|
||||
go-version: ['^1.19.1']
|
||||
mysql: ["mysql:5.7.21", "mysql:8.0.28"]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
|
2
.github/workflows/test-packaging.yml
vendored
2
.github/workflows/test-packaging.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
go-version: ['^1.17.8']
|
||||
go-version: ['^1.19.1']
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
|
2
.github/workflows/test-schema-changes.yml
vendored
2
.github/workflows/test-schema-changes.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
|
||||
with:
|
||||
go-version: '^1.17.8'
|
||||
go-version: '^1.19.1'
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2
|
||||
|
||||
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -31,7 +31,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
go-version: ['^1.17.8']
|
||||
go-version: ['^1.19.1']
|
||||
fleet-tier: [free, premium]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM --platform=linux/amd64 golang:1.19.0-bullseye
|
||||
FROM --platform=linux/amd64 golang:1.19.1-bullseye
|
||||
LABEL maintainer="Fleet Developers <hello@fleetdm.com>"
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.19.0-alpine
|
||||
FROM golang:1.19.1-alpine
|
||||
|
||||
ARG ENROLL_SECRET
|
||||
ARG HOST_COUNT
|
||||
@ -13,4 +13,4 @@ WORKDIR /osquery-perf/
|
||||
RUN go mod download
|
||||
RUN go build -o osquery-perf
|
||||
|
||||
CMD ./osquery-perf -enroll_secret $ENROLL_SECRET -host_count $HOST_COUNT -server_url $SERVER_URL
|
||||
CMD ./osquery-perf -enroll_secret $ENROLL_SECRET -host_count $HOST_COUNT -server_url $SERVER_URL
|
||||
|
@ -1,7 +1,7 @@
|
||||
FROM golang:1.19.0
|
||||
FROM golang:1.19.1
|
||||
ARG TAG
|
||||
RUN apt update && apt upgrade -y && apt install npm yarnpkg -y && ln -s /usr/bin/yarnpkg /usr/bin/yarn
|
||||
RUN git clone -b $TAG https://github.com/fleetdm/fleet.git && cd /go/fleet/cmd/osquery-perf/ && go build .
|
||||
|
||||
FROM golang:1.19.0
|
||||
FROM golang:1.19.1
|
||||
COPY --from=0 /go/fleet/cmd/osquery-perf/osquery-perf /go/osquery-perf
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.19-alpine AS builder
|
||||
FROM golang:1.19.1-alpine AS builder
|
||||
RUN apk update && apk add --no-cache git curl openssl unzip
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
type OptionsStruct struct {
|
||||
LambdaExecutionEnv string `long:"lambda-execution-environment" env:"AWS_EXECUTION_ENV"`
|
||||
InstanceID string `long:"instance-id" env:"INSTANCE_ID" required:"true"`
|
||||
InstanceID string `long:"instance-id" env:"INSTANCE_ID" required:"true"`
|
||||
}
|
||||
|
||||
var options = OptionsStruct{}
|
||||
@ -56,16 +56,16 @@ func runTerraform(workspace string) error {
|
||||
"-no-color",
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
err = runCmd([]string{
|
||||
"workspace",
|
||||
"select",
|
||||
"default",
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
err = runCmd([]string{
|
||||
"workspace",
|
||||
"delete",
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.19-alpine AS builder
|
||||
FROM golang:1.19.1-alpine AS builder
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN go get -d -v
|
||||
|
@ -15,8 +15,8 @@ import (
|
||||
"github.com/aws/aws-sdk-go/service/dynamodb"
|
||||
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
|
||||
"github.com/aws/aws-sdk-go/service/sfn"
|
||||
"github.com/fleetdm/fleet/v4/server/service"
|
||||
"github.com/fleetdm/fleet/v4/pkg/spec"
|
||||
"github.com/fleetdm/fleet/v4/server/service"
|
||||
"github.com/loopfz/gadgeto/tonic"
|
||||
"github.com/wI2L/fizz"
|
||||
"github.com/wI2L/fizz/openapi"
|
||||
@ -24,9 +24,9 @@ import (
|
||||
_ "go.elastic.co/apm/v2"
|
||||
"log"
|
||||
"math/rand"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
"os"
|
||||
)
|
||||
|
||||
type OptionsStruct struct {
|
||||
@ -39,7 +39,7 @@ type OptionsStruct struct {
|
||||
|
||||
var options = OptionsStruct{}
|
||||
|
||||
func applyConfig(c* gin.Context, url, token string) (err error) {
|
||||
func applyConfig(c *gin.Context, url, token string) (err error) {
|
||||
var client *service.Client
|
||||
if client, err = service.NewClient(url, false, "", ""); err != nil {
|
||||
log.Print(err)
|
||||
@ -49,9 +49,9 @@ func applyConfig(c* gin.Context, url, token string) (err error) {
|
||||
|
||||
buf, err := os.ReadFile("standard-query-library.yml")
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
return
|
||||
}
|
||||
log.Print(err)
|
||||
return
|
||||
}
|
||||
specs, err := spec.GroupFromBytes(buf)
|
||||
if err != nil {
|
||||
return
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.19-alpine AS builder
|
||||
FROM golang:1.19.1-alpine AS builder
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN go get -d -v
|
||||
|
@ -6,7 +6,7 @@ RUN cargo install --version 0.16.0 apple-codesign \
|
||||
&& curl -sSf $transporter_url -o transporter_install.sh \
|
||||
&& sh transporter_install.sh --target transporter --accept --noexec
|
||||
|
||||
FROM golang:1.19.0-bullseye
|
||||
FROM golang:1.19.1-bullseye
|
||||
|
||||
RUN apt-get update \
|
||||
&& dpkg --add-architecture i386 \
|
||||
|
@ -95,11 +95,11 @@ func getLoginUID() (*user, error) {
|
||||
|
||||
// parseUsersOutput parses the output of the `users' command.
|
||||
//
|
||||
// `users' command prints on a single line a blank-separated list of user names of
|
||||
// users currently logged in to the current host. Each user name
|
||||
// corresponds to a login session, so if a user has more than one login
|
||||
// session, that user's name will appear the same number of times in the
|
||||
// output.
|
||||
// `users' command prints on a single line a blank-separated list of user names of
|
||||
// users currently logged in to the current host. Each user name
|
||||
// corresponds to a login session, so if a user has more than one login
|
||||
// session, that user's name will appear the same number of times in the
|
||||
// output.
|
||||
//
|
||||
// Returns the list of usernames.
|
||||
func parseUsersOutput(s string) []string {
|
||||
|
@ -99,11 +99,11 @@ const (
|
||||
// It sets the environment of the current process so that it gets inherited by
|
||||
// the child process (see call to CreateEnvironmentBlock).
|
||||
// From https://docs.microsoft.com/en-us/windows/win32/procthread/changing-environment-variables:
|
||||
// "If you want the child process to inherit most of the parent's environment with
|
||||
//
|
||||
// "If you want the child process to inherit most of the parent's environment with
|
||||
// only a few changes, retrieve the current values using GetEnvironmentVariable, save these values,
|
||||
// create an updated block for the child process to inherit, create the child process, and then
|
||||
// restore the saved values using SetEnvironmentVariable, as shown in the following example."
|
||||
//
|
||||
func run(path string, opts eopts) error {
|
||||
for _, nv := range opts.env {
|
||||
os.Setenv(nv[0], nv[1])
|
||||
|
@ -70,7 +70,7 @@ launchctl kickstart "system/${DAEMON_LABEL}"
|
||||
|
||||
// TODO set Nice?
|
||||
//
|
||||
//Note it's important not to start the orbit binary in
|
||||
// Note it's important not to start the orbit binary in
|
||||
// `/usr/local/bin/orbit` because this is a path that users usually have write
|
||||
// access to, and running that binary with launchd can become a privilege
|
||||
// escalation vector.
|
||||
|
@ -227,6 +227,7 @@ func writeOsqueryFlagfile(opt Options, orbitRoot string) error {
|
||||
|
||||
// Embed the certs file that osquery uses so that we can drop it into our installation packages.
|
||||
// This file copied from https://raw.githubusercontent.com/osquery/osquery/master/tools/deployment/certs.pem
|
||||
//
|
||||
//go:embed certs.pem
|
||||
var osqueryCerts []byte
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
//+build windows
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package platform
|
||||
|
||||
|
@ -26,6 +26,7 @@ type Authorizer struct {
|
||||
}
|
||||
|
||||
// Load the policy from policy.rego in this directory.
|
||||
//
|
||||
//go:embed policy.rego
|
||||
var policy string
|
||||
|
||||
|
@ -918,9 +918,9 @@ func (ds *Datastore) MarkHostsSeen(ctx context.Context, hostIDs []uint, t time.T
|
||||
}
|
||||
|
||||
// SearchHosts performs a search on the hosts table using the following criteria:
|
||||
// - Use the provided team filter.
|
||||
// - Search hostname, uuid, hardware_serial, and primary_ip using LIKE (mimics ListHosts behavior)
|
||||
// - An optional list of IDs to omit from the search.
|
||||
// - Use the provided team filter.
|
||||
// - Search hostname, uuid, hardware_serial, and primary_ip using LIKE (mimics ListHosts behavior)
|
||||
// - An optional list of IDs to omit from the search.
|
||||
func (ds *Datastore) SearchHosts(ctx context.Context, filter fleet.TeamFilter, matchQuery string, omit ...uint) ([]*fleet.Host, error) {
|
||||
query := `SELECT
|
||||
h.*,
|
||||
@ -2552,8 +2552,8 @@ func (ds *Datastore) ListHostBatteries(ctx context.Context, hid uint) ([]*fleet.
|
||||
// Notes:
|
||||
// - We use `2 * interval`, because of the artificial jitter added to the intervals in Fleet.
|
||||
// - Default values for:
|
||||
// - host.DistributedInterval is usually 10s.
|
||||
// - svc.config.Osquery.DetailUpdateInterval is usually 1h.
|
||||
// - host.DistributedInterval is usually 10s.
|
||||
// - svc.config.Osquery.DetailUpdateInterval is usually 1h.
|
||||
// - Count only includes hosts seen during the last 7 days.
|
||||
func countHostsNotRespondingDB(ctx context.Context, db sqlx.QueryerContext, logger log.Logger, config config.FleetConfig) (int, error,
|
||||
) {
|
||||
|
@ -992,9 +992,9 @@ type parameterizedStmt struct {
|
||||
// for a unique key that is more likely to already exist (i.e. the insert
|
||||
// should be infrequent, the read should succeed most of the time).
|
||||
// It proceeds as follows:
|
||||
// 1. Try to read the ID from the read replica.
|
||||
// 2. If it does not exist, try to insert the row in the primary.
|
||||
// 3. If it fails due to a duplicate key, try to read the ID again, this
|
||||
// 1. Try to read the ID from the read replica.
|
||||
// 2. If it does not exist, try to insert the row in the primary.
|
||||
// 3. If it fails due to a duplicate key, try to read the ID again, this
|
||||
// time from the primary.
|
||||
//
|
||||
// The read statement must only SELECT the id column.
|
||||
|
@ -101,19 +101,20 @@ func (ds *Datastore) SavePolicy(ctx context.Context, p *fleet.Policy) error {
|
||||
}
|
||||
|
||||
// FlippingPoliciesForHost fetches previous policy membership results and returns:
|
||||
// - a list of "new" failing policies; "new" here means those that fail on their first
|
||||
// run, and those that were passing on the previous run and are failing on the incoming execution.
|
||||
// - a list of "new" passing policies; "new" here means those that failed on a previous
|
||||
// run and are passing now.
|
||||
// - a list of "new" failing policies; "new" here means those that fail on their first
|
||||
// run, and those that were passing on the previous run and are failing on the incoming execution.
|
||||
// - a list of "new" passing policies; "new" here means those that failed on a previous
|
||||
// run and are passing now.
|
||||
//
|
||||
// "Failure" here means the policy query executed successfully but didn't return any rows,
|
||||
// so policies that did not execute (incomingResults with nil bool) are ignored.
|
||||
//
|
||||
// NOTES(lucas):
|
||||
// - If a policy has been deleted (also deleted on `policy_membership` via cascade)
|
||||
// and osquery agents bring in new failing results from them then those will be returned here
|
||||
// (in newFailing or newPassing).
|
||||
// - Similar in case a host was deleted.
|
||||
// - If a policy has been deleted (also deleted on `policy_membership` via cascade)
|
||||
// and osquery agents bring in new failing results from them then those will be returned here
|
||||
// (in newFailing or newPassing).
|
||||
// - Similar in case a host was deleted.
|
||||
//
|
||||
// Trying to filter those out here would make this operation more expensive (fetch policies from the
|
||||
// `policies` table and querying the `hosts` table).
|
||||
func (ds *Datastore) FlippingPoliciesForHost(
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Package live_query implements an interface for storing and
|
||||
// retrieving live queries.
|
||||
//
|
||||
// Design
|
||||
// # Design
|
||||
//
|
||||
// This package operates by storing a single redis key for host
|
||||
// targeting information. This key has a known prefix, and the data
|
||||
@ -21,15 +21,15 @@
|
||||
// number of live queries targeting all of them. This was a big
|
||||
// factor in choosing this implementation.
|
||||
//
|
||||
// Implementation
|
||||
// # Implementation
|
||||
//
|
||||
// As mentioned in the Design section, there are three keys for each
|
||||
// live query: the bitfield, the SQL of the query and the set containing
|
||||
// the IDs of all active live queries:
|
||||
//
|
||||
// livequery:<ID> is the bitfield that indicates the hosts
|
||||
// sql:livequery:<ID> is the SQL of the query.
|
||||
// livequery:active is the set containing the active live query IDs
|
||||
// livequery:<ID> is the bitfield that indicates the hosts
|
||||
// sql:livequery:<ID> is the SQL of the query.
|
||||
// livequery:active is the set containing the active live query IDs
|
||||
//
|
||||
// Both the bitfield and sql keys have an expiration, and <ID> is the campaign
|
||||
// ID of the query. To make efficient use of Redis Cluster (without impacting
|
||||
@ -42,7 +42,6 @@
|
||||
// live on a single node in cluster mode (a "hot key"), and that node will see
|
||||
// increased activity due to that. Should that become a significant problem, an
|
||||
// alternative approach will be required.
|
||||
//
|
||||
package live_query
|
||||
|
||||
import (
|
||||
@ -84,9 +83,10 @@ func generateKeys(name string) (targetsKey, sqlKey string) {
|
||||
}
|
||||
|
||||
// returns the base name part of a target key, i.e. so that this is true:
|
||||
// tkey, _ := generateKeys(name)
|
||||
// baseName := extractTargetKeyName(tkey)
|
||||
// baseName == name
|
||||
//
|
||||
// tkey, _ := generateKeys(name)
|
||||
// baseName := extractTargetKeyName(tkey)
|
||||
// baseName == name
|
||||
func extractTargetKeyName(key string) string {
|
||||
name := strings.TrimPrefix(key, queryKeyPrefix)
|
||||
if len(name) > 0 && name[0] == '{' {
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
"github.com/fleetdm/fleet/v4/server/fleet"
|
||||
)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////////////////////////////////
|
||||
// Fleet Desktop endpoints
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////////////////////////////////
|
||||
type getFleetDesktopResponse struct {
|
||||
Err error `json:"error,omitempty"`
|
||||
FailingPolicies *uint `json:"failing_policies_count,omitempty"`
|
||||
|
@ -68,8 +68,8 @@ var statusMap = map[string]int{
|
||||
//
|
||||
// Most of the items here come from:
|
||||
//
|
||||
// - https://docs.ldap.com/specs/rfc2798.txt
|
||||
// - https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/technical-reference/the-role-of-claims
|
||||
// - https://docs.ldap.com/specs/rfc2798.txt
|
||||
// - https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/technical-reference/the-role-of-claims
|
||||
var validDisplayNameAttrs = map[string]struct{}{
|
||||
"name": {},
|
||||
"displayname": {},
|
||||
|
@ -221,17 +221,17 @@ func (r *regexpCache) Get(pattern string) (*regexp.Regexp, error) {
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// [
|
||||
// {
|
||||
// "match": {
|
||||
// "bundle_identifier": ["com.1password.1password"]
|
||||
// },
|
||||
// "translation": {
|
||||
// "product": ["1password"],
|
||||
// "vendor": ["agilebits"]
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// [
|
||||
// {
|
||||
// "match": {
|
||||
// "bundle_identifier": ["com.1password.1password"]
|
||||
// },
|
||||
// "translation": {
|
||||
// "product": ["1password"],
|
||||
// "vendor": ["agilebits"]
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
type CPETranslations []CPETranslationItem
|
||||
|
||||
func (c CPETranslations) Translate(reCache *regexpCache, s *fleet.Software) (CPETranslation, bool, error) {
|
||||
|
@ -72,12 +72,16 @@ func mapCriteria(i oval_input.CriteriaXML) (*oval_parsed.Criteria, error) {
|
||||
// Test objects can define their 'name' in one of two ways:
|
||||
// 1. Inline:
|
||||
// <:object ...>
|
||||
// <:name>software name</:name>
|
||||
//
|
||||
// <:name>software name</:name>
|
||||
//
|
||||
// </:object>
|
||||
//
|
||||
// 2. As a variable reference:
|
||||
// <:object ...>
|
||||
// <:name var_ref="var:200224390000000" var_check="at least one" />
|
||||
//
|
||||
// <:name var_ref="var:200224390000000" var_check="at least one" />
|
||||
//
|
||||
// </:object>
|
||||
func mapPackageInfoTestObject(
|
||||
obj oval_input.PackageInfoTestObjectXML,
|
||||
|
@ -35,9 +35,10 @@ func (t *DpkgInfoTest) Eval(packages []fleet.Software) ([]fleet.Software, error)
|
||||
}
|
||||
|
||||
// Returns:
|
||||
// nObjects: How many items in the set defined by the OVAL Object set exists in the system.
|
||||
// nStates: How many items in the set defined by the OVAL Object set satisfy the state requirements.
|
||||
// Slice with software matching both the object and state criteria.
|
||||
//
|
||||
// nObjects: How many items in the set defined by the OVAL Object set exists in the system.
|
||||
// nStates: How many items in the set defined by the OVAL Object set satisfy the state requirements.
|
||||
// Slice with software matching both the object and state criteria.
|
||||
func (t *DpkgInfoTest) matches(software []fleet.Software) (int, int, []fleet.Software, error) {
|
||||
var nObjects int
|
||||
var nState int
|
||||
|
@ -35,9 +35,10 @@ func (t *RpmInfoTest) Eval(packages []fleet.Software) ([]fleet.Software, error)
|
||||
}
|
||||
|
||||
// Returns:
|
||||
// nObjects: How many items in the set defined by the OVAL Object set exists in the system.
|
||||
// nStates: How many items in the set defined by the OVAL Object set satisfy the state requirements.
|
||||
// Slice with software matching both the object and state criteria.
|
||||
//
|
||||
// nObjects: How many items in the set defined by the OVAL Object set exists in the system.
|
||||
// nStates: How many items in the set defined by the OVAL Object set satisfy the state requirements.
|
||||
// Slice with software matching both the object and state criteria.
|
||||
func (t *RpmInfoTest) matches(software []fleet.Software) (int, int, []fleet.Software, error) {
|
||||
var nObjects int
|
||||
var nState int
|
||||
|
@ -7,17 +7,18 @@ import (
|
||||
)
|
||||
|
||||
// Rpmvercmp Compares two evr strings (EPOCH:VERSION-RELEASE) by looking at each part in order:
|
||||
// - EPOCHs are compared based on their numeric values, if missing then '0' is assumed,
|
||||
// if equal then VERSIONs are compared.
|
||||
// - VERSIONS are compared according to librpm's rpmvercmp algo
|
||||
// (see http://ftp.rpm.org/api/4.4.2.2/rpmvercmp_8c-source.html), if equal RELEASEs are
|
||||
// compared.
|
||||
// - RELEASEs are compared using the rpmvercmp algo, if equal then both are equal.
|
||||
// - EPOCHs are compared based on their numeric values, if missing then '0' is assumed,
|
||||
// if equal then VERSIONs are compared.
|
||||
// - VERSIONS are compared according to librpm's rpmvercmp algo
|
||||
// (see http://ftp.rpm.org/api/4.4.2.2/rpmvercmp_8c-source.html), if equal RELEASEs are
|
||||
// compared.
|
||||
// - RELEASEs are compared using the rpmvercmp algo, if equal then both are equal.
|
||||
//
|
||||
// Returns:
|
||||
// -1 if a < b
|
||||
// 0 if a == b
|
||||
// 1 if a > b
|
||||
//
|
||||
// -1 if a < b
|
||||
// 0 if a == b
|
||||
// 1 if a > b
|
||||
func Rpmvercmp(a, b string) int {
|
||||
epoch1 := epoch(a)
|
||||
epoch2 := epoch(b)
|
||||
|
@ -3,15 +3,15 @@
|
||||
// the configuration get properly passed down to the pool creation.
|
||||
//
|
||||
// To run a TLS redis server:
|
||||
// * Build redis from source with `make BUILD_TLS=yes` (https://redis.io/topics/encryption)
|
||||
// * Generate certificates and keys with `./utils/gen-test-certs.sh`
|
||||
// (the generated files will be under ./tests/tls/)
|
||||
// * Run `./src/redis-server --tls-port 7379 --port 0 --tls-ca-cert-file
|
||||
// ./tests/tls/ca.crt --tls-cert-file ./tests/tls/redis.crt --tls-key-file
|
||||
// ./tests/tls/redis.key`
|
||||
// * Run this command to test connection, e.g.:
|
||||
// `go run ./tools/redis-tests/tlsconnect.go -- -addr localhost:7379 -cacert ./tests/tls/ca.crt
|
||||
// -cert ./tests/tls/redis.crt -key ./tests/tls/redis.key PING` -skip
|
||||
// - Build redis from source with `make BUILD_TLS=yes` (https://redis.io/topics/encryption)
|
||||
// - Generate certificates and keys with `./utils/gen-test-certs.sh`
|
||||
// (the generated files will be under ./tests/tls/)
|
||||
// - Run `./src/redis-server --tls-port 7379 --port 0 --tls-ca-cert-file
|
||||
// ./tests/tls/ca.crt --tls-cert-file ./tests/tls/redis.crt --tls-key-file
|
||||
// ./tests/tls/redis.key`
|
||||
// - Run this command to test connection, e.g.:
|
||||
// `go run ./tools/redis-tests/tlsconnect.go -- -addr localhost:7379 -cacert ./tests/tls/ca.crt
|
||||
// -cert ./tests/tls/redis.crt -key ./tests/tls/redis.key PING` -skip
|
||||
package main
|
||||
|
||||
import (
|
||||
|
Loading…
Reference in New Issue
Block a user