Documentation
¶
Overview ¶
Package api holds the wire types of the vedette-host socket API (docs/specs/host-api.md), shared by host/server and host/client so the two cannot drift apart.
Index ¶
- Constants
- Variables
- func ParseAnchor(pemText []byte) []*x509.Certificate
- func PortsInUse(msg string) (list string, plural, ok bool)
- func ValidHostname(s string) bool
- func ValidZoneName(s string) bool
- func ZoneOfLink(target string) string
- type AuditPage
- type AuditPeer
- type AuditRecord
- type Backup
- type BackupCreateArgs
- type BackupList
- type BackupPurgeResult
- type BackupRestoreArgs
- type BackupRestoreResult
- type BackupResult
- type BoxAgentCheckArgs
- type BoxAgentCheckResult
- type CommandRequest
- type ContainerPullArgs
- type ContainerPullResult
- type ContainerRollbackArgs
- type ContainerRollbackResult
- type ContainerStartArgs
- type ContainerStartResult
- type ContainerState
- type ContainerStopArgs
- type ContainerStopResult
- type ContainerVersion
- type ContainersState
- type DecoyAddArgs
- type DecoyAddResult
- type DecoyPort
- type DecoyRemoveArgs
- type DecoyRemoveResult
- type DecoySetPortsArgs
- type DecoySetPortsResult
- type Detail
- type ErrorBody
- type ErrorInfo
- type Event
- type ExposureFenceCheckArgs
- type ExposureFenceCheckResult
- type ExposureTokenArgs
- type ExposureTokenForgetResult
- type ExposureTokenResult
- type ExposureTyped
- type GreenboneUpArgs
- type HPTouch
- type HPTouchesState
- type Health
- type HostSelfUpdateArgs
- type HostSelfUpdateResult
- type HostState
- type HostUpdate
- type HostVersionRef
- type Info
- type ListenPort
- type LogsExportArgs
- type LogsExportResult
- type NetApplyArgs
- type NetApplyMgmt
- type NetApplyResult
- type NetApplySPAN
- type NetConfig
- type NetCounters
- type NetDecoy
- type NetInterface
- type NetMgmt
- type NetPending
- type NetRoute
- type NetRunArgs
- type NetState
- type OSAutoSecurityArgs
- type OSAutoSecurityResult
- type OSDetails
- type OSInfo
- type OSInstallArgs
- type OSPackage
- type OSRebootArgs
- type OSRebootResult
- type OSRunResult
- type OSState
- type OSTimezoneArgs
- type OSTimezoneResult
- type Package
- type PackagesState
- type PortsState
- type Run
- type RunError
- type RunList
- type Status
- type TimeState
- type ZapActiveArgs
- type ZapActiveResult
- type ZapAuthorizeArgs
- type ZapAuthorizeResult
- type ZapBaselineArgs
- type ZapBaselineResult
- type ZapPrepareResult
- type ZapSettings
- type ZapStopArgs
- type ZapStopResult
Constants ¶
const ( Proto = 1 MinProto = 1 )
Proto is the protocol number this build speaks; MinProto is the oldest it still accepts (N and N-1, spec section 13). Version 1 is the first, so both are 1.
const ( HeaderRequestID = "X-Request-Id" HeaderActor = "X-Vedette-Actor" HeaderProto = "X-Vedette-Host-Proto" )
Header names (spec section 3).
const ( CodeInvalidArgs = "invalid_args" CodeInvalidRequestID = "invalid_request_id" CodeInvalidActor = "invalid_actor" CodePeerNotAllowed = "peer_not_allowed" CodeUnknownCommand = "unknown_command" CodeRunNotFound = "run_not_found" CodeBusy = "busy" // CodePendingConfirm is 409: a run is awaiting confirmation and holds the write lock (spec 4); // the error carries that run's id. CodeNotAwaitingConfirm is 412: the run id of a // net.confirm or net.revert is not the run that is waiting (finished, expired or unknown). CodePendingConfirm = "pending_confirm" CodeNotAwaitingConfirm = "not_awaiting_confirm" CodeRequestIDReuse = "request_id_reuse" CodeRateLimited = "rate_limited" CodeShuttingDown = "host_shutting_down" CodeHostRestarted = "host_restarted" CodeTimeout = "timeout" CodeCommandFailed = "command_failed" CodeInternal = "internal" CodeHostWedged = "host_wedged" )
Error codes (spec section 11). Command-specific refusal codes (low_disk, ...) live with the commands.
const ( KindLog = "log" KindProgress = "progress" KindState = "state" )
Event kinds.
const ( BoxAgentNone = "none" // no Vedette agent configuration on the box BoxAgentCurrent = "current" // it pins a certificate of the anchor core gave: left as it is BoxAgentElsewhere = "elsewhere" // it reports to another address than the box's own (another Vedette box): left as it is // BoxAgentNotVedettes: the osquery here is not set up the way Vedette's install command sets it up (its flags or its unit could // point it at another server): a doubt, so it is left as it is. BoxAgentNotVedettes = "not_vedette" BoxAgentRemoved = "removed" // it pinned another CA and pointed at the box: stopped, disabled and its Vedette settings removed )
States of box_agent.check.
const ( CmdContainerStart = "container.start" CmdContainerStop = "container.stop" CmdContainerPull = "container.pull" CmdContainerRollback = "container.rollback" )
Commands of the container part (slice 3-6 start and stop, slice 3-7 pull, slice 3-8a start with a version and rollback).
const ( ServiceCore = "core" ServiceSensor = "sensor" ServiceHoneypot = "honeypot" ServiceScan = "scan" ServiceGreenbone = "greenbone" )
The services (spec section 6): the closed set a service argument may name.
const ( // CodeNotPulled: there is no installed image to start (a unit with a pinned digest), or a // version was named but switching versions arrives with container.pull (slice 3-7). CodeNotPulled = "not_pulled" // CodeCannotStopCore: container.stop would kill the caller (spec 6.9). CodeCannotStopCore = "cannot_stop_core" // CodeUnitFailed ends a run as reverted: the new unit did not become healthy and the previous one // was put back; as failed when the previous one could not be put back either. CodeUnitFailed = "unit_failed" // CodeUnitUnsafe: the Quadlet directory, one of its parents, or the unit file is not what a root // write may touch (a link, another owner, open to group or others). CodeUnitUnsafe = "unit_unsafe" // CodeUnitUnwritable: the unit could not be written, or systemd would not reload or restart it. CodeUnitUnwritable = "unit_unwritable" // CodeStopNotVerified: systemctl is-active did not say inactive after the stop. CodeStopNotVerified = "stop_not_verified" // CodeTransitionPending: an earlier change of that unit left a journal that has not been recovered // yet (the host recovers at its next start); container commands for the service wait. CodeTransitionPending = "transition_pending" // CodeHostConfIncomplete: the unit needs a uid or gid that host.conf did not give the host. CodeHostConfIncomplete = "host_conf_incomplete" // CodePortInUse (412, container.start and container.rollback): the unit the command would write publishes a host port that the // unit on disk does not, and another program listens on it, so the service would not start; nothing was changed. CodePortInUse = "port_in_use" // Refusals of container.pull (spec 6.7): what the host's own verification found. CodeSignatureInvalid = "signature_invalid" // a document or a cosign signature does not verify, or does not parse CodeKeyRevoked = "key_revoked" // the signing key is revoked by the stored index CodeReleaseRevoked = "release_revoked" // the release version or an image digest is revoked CodeDigestNotInManifest = "digest_not_in_manifest" // the manifest has no image for that service CodeRegistryNotAllowed = "registry_not_allowed" // an image ref is not the fixed registry ref CodeSequenceRegress = "sequence_regress" // the index is older than the stored one CodePlatformMismatch = "platform_mismatch" // no image for linux/<GOARCH> CodeManifestMismatch = "manifest_mismatch" // version differs from the args, or the hash differs from the index CodeBundleUnsupported = "bundle_unsupported" // source=bundle on an older host (this host no longer sends it) CodeNoTrustedKeys = "no_trusted_keys" // this build embeds no release keys: it refuses everything CodeReleaseStateInvalid = "release_state_invalid" // the stored index is damaged: the host will not guess CodePullFailed = "pull_failed" // run ended failed: podman could not pull or tag // CodeScanBuildFailed ends a container.pull of scan as failed: the signed base image was pulled and verified, but the image with // nmap that the host builds on the box from it was not (no package mirror, a build error, or nmap below the floor). The previous // localhost/vedette-scan-nmap image, if any, is untouched and the previous unit keeps running. CodeScanBuildFailed = "scan_build_failed" // Codes of container.pull with source=bundle (spec 6.7). The bundle is <core_data>/bundles/<bundle_id>.tar. // CodeBundleNotFound (412): core has not written that bundle (or core_data is not set or not safe to read). CodeBundleNotFound = "bundle_not_found" // CodeBundleInvalid: the file or the tar is not what the bundle contract allows (a link, not core's, over 8 GiB, a name // outside the closed list, a link or device entry, a member over its cap, a duplicate, a missing document or image, an // image archive that is not a complete OCI layout). 412 when Check finds it, a failed run when the run does. CodeBundleInvalid = "bundle_invalid" // CodeArchiveDigestMismatch ends a bundle pull as failed: the image archive is not the image the signed manifest names // (its index.json names another digest, or a blob does not hash to its name). CodeArchiveDigestMismatch = "archive_digest_mismatch" // Refusals of container.start with a version and of container.rollback (spec 6.8, 6.10). CodeDowngradeNotAllowed = "downgrade_not_allowed" // the version is lower than the running one: going back is container.rollback CodeUpgradePathRequired = "upgrade_path_required" // the running version is below the target's min_upgrade_from CodeNoPrevious = "no_previous" // nothing to roll back to (or its image is gone) CodePreviousRevoked = "previous_revoked" // the previous version, its image digest or its signing key is revoked CodeRollbackNotAllowed = "rollback_not_allowed" // the previous version is below the running release's rollback.min_version CodeRollbackBackupMissing = "rollback_backup_missing" // rollback.safe=false and the pre_update backup of the transition is gone CodeRollbackIsUpgrade = "rollback_is_upgrade" // core: the previous version is higher than the running one: use container.start with a version and a snapshot CodeCoreDataInvalid = "core_data_invalid" // an entry of core's data directory that a rollback would move is not a regular file CodeCurrentVersionUnknown = "current_version_unknown" // the running version is not recorded (bootstrap 3-8b writes it), so a switch cannot be judged // CodeRollbackRevertFailed ends a rollback as failed: it did not work and putting the running release back failed too. CodeRollbackRevertFailed = "rollback_revert_failed" )
Codes of the container commands: refusals (HTTP 412) and the codes a run can end with.
const ( PullSourceRegistry = "registry" PullSourceBundle = "bundle" )
Sources of container.pull.
const ( UnitActive = "active" UnitInactive = "inactive" UnitFailed = "failed" UnitOther = "other" UnitUnknown = "unknown" HealthHealthy = "healthy" HealthUnhealthy = "unhealthy" HealthStarting = "starting" HealthNone = "none" // no container, or one without a health check HealthUnknown = "unknown" )
Unit states (systemctl is-active) and health (podman) as the state endpoint reports them.
const ( CmdDecoyAdd = "decoy_ip.add" CmdDecoyRemove = "decoy_ip.remove" // CmdDecoySetPorts replaces the ports a decoy address answers on. Core sends ports (here // and in decoy_ip.add) only when GET /v1/info lists this command: an older host refuses the field. CmdDecoySetPorts = "decoy_ip.set_ports" )
Commands of the decoy part.
const ( ProtoTCP = "tcp" ProtoUDP = "udp" )
The protocols of a DecoyPort.
const ( CodeIPNotInMgmtSubnet = "ip_not_in_mgmt_subnet" CodeIPIsGateway = "ip_is_gateway" CodeIPIsHost = "ip_is_host" CodeIPIsNetwork = "ip_is_network" CodeIPIsBroadcast = "ip_is_broadcast" CodeIPInUse = "ip_in_use" CodeDuplicateDecoy = "duplicate_decoy" CodeLimitReached = "limit_reached" // CodeLinkNameInUse: a link called vdh<8 hex of the IP> already exists outside the honeypot // namespace and the host did not create it, so it is never touched (slice 3-5). CodeLinkNameInUse = "link_name_in_use" // CodeMACInUse: the MAC the key and the IP give is already a decoy's (only possible with an // oui: three bytes of HMAC). CodeMACInUse = "mac_in_use" // CodeNotADecoy: decoy_ip.set_ports for an address that is not a decoy (412). CodeNotADecoy = "not_a_decoy" // Failure codes. CodeMACKeyInvalid = "mac_key_invalid" CodeDecoysStateInvalid = "decoys_state_invalid" CodeDecoyFailed = "decoy_failed" CodeHPStateUnusable = "hp_state_unusable" // MaxDecoys is the limit of decoy addresses (spec 6.6). MaxDecoys = 32 )
Refusal codes (HTTP 412) of the decoy commands, and the codes a decoy run can end failed with.
const ( // CmdExposureToken gives the box-bound token of a domain: hex(HMAC-SHA256(fence key, "vedette-verify\x00"+domain)), its first 16 // hex digits (the length of every domain token). CmdExposureToken = "exposure.token" // CmdExposureFenceCheck checks a domain_ip scan with the host's own fence (core/domainfence): the token is this box's, the domain's // TXT record carries it, the name resolves to the address now (and, for a disruptive scan, the name stays inside the domain). CmdExposureFenceCheck = "exposure.fence_check" // CmdExposureTokenForget takes a domain off the host's fence list (a deleted domain target, an add that failed): its slot is free // again and every executor refuses the domain. Idempotent; args ExposureTokenArgs. CmdExposureTokenForget = "exposure.token_forget" )
Names of the commands.
const ( // CodeTokenForeign: the token is not the one this box's fence key gives for the domain (another box's, or one made before the fence). CodeTokenForeign = "token_foreign" // CodeNameMoved: the name no longer resolves to the address (that address only). CodeNameMoved = "name_moved" // CodeCNAMEOutside: a disruptive scan of a name whose CNAME leaves the domain. CodeCNAMEOutside = "cname_outside" // CodeFenceDomainsFull: exposure.token for a new domain while the host's list holds its cap of domains (review r1 H1). CodeFenceDomainsFull = "fence_domains_full" CodeFenceUnavailable = "fence_unavailable" )
Refusal codes of the domain fence (with CodeTargetNotOwned and CodeOwnershipUnchecked of zap.baseline).
const ( // CmdGreenboneUp makes sure the compose provider is installed and the podman API socket runs, starts the project (the first time it // pulls about 9 GB of images and the feed) with the GMP login for gvmd, and checks that gvmd, ospd-openvas, pg-gvm and redis run. CmdGreenboneUp = "greenbone.up" // CmdGreenboneDown stops the project and keeps its volumes; it first cancels an up or a feed update that runs. CmdGreenboneDown = "greenbone.down" // CmdGreenboneSyncFeed is Greenbone's feed update: pull the four feed data images Vedette runs, then start those services again. CmdGreenboneSyncFeed = "greenbone.sync_feed" )
Names of the commands.
const ( // CodeGreenboneNoProvider: this OS release has no compose provider package Vedette knows, or the one installed is too old. CodeGreenboneNoProvider = "greenbone_no_provider" // CodeGreenboneFailed: a step failed (podman, compose, the login); the message says which and the host log has the rest. CodeGreenboneFailed = "greenbone_failed" // CodeGreenboneCancelled: greenbone.down stopped this up or feed update. CodeGreenboneCancelled = "greenbone_cancelled" )
Refusal and failure codes of the OpenVAS commands (spec §6.16).
const ( GreenboneRunDir = "/run/vedette-greenbone" GreenboneSocketDir = GreenboneRunDir + "/gvmd" GreenboneSocket = GreenboneSocketDir + "/gvmd.sock" // GreenboneUser is the GMP user Vedette signs in as: the admin user Greenbone's gvmd image creates. GreenboneUser = "admin" )
GreenboneSocketDir is where gvmd's socket directory lives on the host, and core's view of it (core's unit mounts its parent GreenboneRunDir at the same path). GreenboneSocket is the socket core dials.
const ( NetRoleManagement = "management" NetRoleSPAN = "span" )
Interface roles.
const ( NetModeDHCP = "dhcp" NetModeStatic = "static" )
Management modes.
const ( CmdNetApply = "net.apply" CmdNetConfirm = "net.confirm" CmdNetRevert = "net.revert" )
Commands of the network part (spec 6.5).
const ( CodeAddressConflict = "address_conflict" CodeGatewayOutsideSubnet = "gateway_outside_subnet" CodeSameIface = "same_iface" CodeIfaceUnknown = "iface_unknown" CodeNetBackendUnsupported = "net_backend_unsupported" CodeConnectivityCheckFail = "connectivity_check_failed" CodeSPANHasAddress = "span_has_address" CodeSPANNotPhysical = "span_not_physical" CodeNotConfirmed = "not_confirmed" CodeCancelled = "cancelled" CodeRevertedByReboot = "reverted_by_reboot" CodeRevertFailed = "revert_failed" CodeNetplanApplyFailed = "netplan_apply_failed" CodeNTPNotApplied = "ntp_not_applied" CodePendingInvalid = "pending_invalid" CodeConfirmFailed = "confirm_failed" CodeARPProbeFailed = "arp_probe_failed" CodeBootIDUnreadable = "boot_id_unreadable" DefaultConfirmTimeoutS = 120 MinConfirmTimeoutS = 30 MaxConfirmTimeoutS = 600 MaxNTPServers = 4 )
Refusal codes (HTTP 412) and run-ending codes of the network commands (spec 11).
const ( CmdOSCheck = "os.check" CmdOSInstall = "os.install" CmdOSAutoSecuritySet = "os.auto_security.set" CmdOSReboot = "os.reboot" CmdOSRebootCancel = "os.reboot.cancel" CmdBackupCreate = "backup.create" CmdBackupRestore = "backup.restore" CmdBackupPurge = "backup.purge" CmdLogsExport = "logs.export" )
Command names (spec section 6).
const ( CodeNotAppliance = "not_appliance" CodeDpkgLocked = "dpkg_locked" CodeDpkgInconsistent = "dpkg_inconsistent" CodeLowDisk = "low_disk" CodeStaleCheck = "stale_check" CodeAptFailed = "apt_failed" CodeHealthCheckFailed = "health_check_failed" CodeInstallInProgress = "install_in_progress" CodeNetPendingConfirm = "net_pending_confirm" CodeAtInPast = "at_in_past" CodeAtTooFar = "at_too_far" CodeRebootLimit = "reboot_limit_reached" CodeDBUnreadable = "db_unreadable" CodeBackupUnknown = "backup_unknown" CodeChecksumMismatch = "checksum_mismatch" CodeSchemaNewer = "schema_newer" CodeSecretsMissing = "secrets_missing" CodeContainsSecrets = "contains_secrets" CodeRestoreFailed = "restore_failed" CodeRestoreHealthFailed = "restore_health_failed" CodeRangeTooLarge = "range_too_large" CodeUnitUnknown = "unit_unknown" CodeOutputTooLarge = "output_too_large" CodeNoCheckYet = "no_check_yet" CodeExportUnknown = "export_unknown" CodeEffectNotVerified = "effect_not_verified" CodeSnapshotRequired = "snapshot_required" CodeSnapshotInvalid = "snapshot_invalid" CodeRebooting = "rebooting" // CodeRebootInhibited is os.reboot now refused while a logind block inhibitor of shutdown is held (apt // installing); the message names who holds it and why. CodeRebootInhibited = "reboot_inhibited" )
Refusal and failure codes of the system commands (spec sections 6 and 11).
const ( CodeHostVersionUnknown = "host_version_unknown" // the running binary has no SemVer version (a dev build) CodeNoHostPackage = "no_host_package" // the manifest has no host part, or its file entry is out of range CodeTestVersionRefused = "test_version_refused" // a -test. host version, a build that does not trust the test keys, on a host that is not itself a test build CodeCurrentPackageMissing = "current_package_missing" // versions.json, the binary and dpkg do not agree, or the kept .deb of the running version is gone CodePackageMissing = "package_missing" // core's file host-packages/<package>.deb is not there CodePackageInvalid = "package_invalid" // core's file is not a plain file of core, or its size is not the manifest's CodePackageMismatch = "package_mismatch" // dpkg-deb names another package, version or architecture CodeApplierFailed = "applier_failed" // the copy of the binary or the start of the transient unit failed CodePackageChanged = "package_changed" // the applier found a staged or kept .deb that is not the one the journal names CodeSelfUpdateUnhealthy = "self_update_unhealthy" // the new host did not prove itself healthy; the previous one is back CodeInstallFailed = "install_failed" // apt or dpkg failed; the previous one is back CodeRollbackFailed = "rollback_failed" // putting the previous one back failed too: RUNBOOK CodeSelfUpdateInterrupted = "self_update_interrupted" // the applier died twice, or would outlive the deadline: RUNBOOK )
Refusal and failure codes of host.self_update (spec 6.14). The signature and index codes are the ones of container.pull (containers.go); transition_pending, low_disk, dpkg_locked, dpkg_inconsistent, db_unreadable, checksum_mismatch and downgrade_not_allowed are shared with other commands.
const ( // CodeZoneUnknown (412) is a well-formed name the operating system has no zone file for (an old alias its tzdata package left // out, a zone that does not exist). CodeZoneUnknown = "zone_unknown" // CodeTimezoneNotSet is a timedatectl that exited non-zero. CodeTimezoneNotSet = "timezone_not_set" )
Refusal and failure codes of os.timezone.set.
const ( ZapImageReady = "ready" // the image is on the box ZapImagePulling = "pulling" // its download runs (started now, or earlier) )
The states of the ZAP image in ZapPrepareResult.
const ( ZapKindIP = "ip" ZapKindDomain = "domain" )
Kinds of the target a page belongs to (exposure's target kinds).
const ( // CodeZapPulling: the ZAP image is not on the box; the host started its download (or one is running). Ask again later. CodeZapPulling = "zap_image_pulling" // CodeZapPullFailed: the last download of the ZAP image failed; the next call tries again. CodeZapPullFailed = "zap_image_pull_failed" // CodeTargetNotOwned: the host's own re-check says the page is not the box's own address (IP target), or the domain no longer // has its TXT token (domain target). CodeTargetNotOwned = "target_not_owned" // CodeZapCleaningUp: an earlier run's container could not be proven gone yet, so its fence is kept and no new run starts. CodeZapCleaningUp = "zap_cleaning_up" // CodeZapNameMoved: the page's name no longer resolves to the IP ZAP would be pinned to (a moved record, or a CDN or load balancer // that answers with another subset of its addresses). This page only: the domain's TXT record was there. CodeZapNameMoved = "zap_name_moved" // CodeOwnershipUnchecked: the host could not re-check (the public-IP services or DNS did not answer), so nothing was sent. CodeOwnershipUnchecked = "ownership_unchecked" // CodeZapFenceFailed: the network vedette-zap or its egress rule could not be set up and proven, so ZAP was not started. CodeZapFenceFailed = "zap_fence_failed" // CodeZapFailed: ZAP ran but did not end with a report (exit 3 or another code, or no report file), or the host could not // prepare the run's work folder. CodeZapFailed = "zap_failed" // CodeZapTimedOut: ZAP did not finish within the host's bound; the container was removed. CodeZapTimedOut = "zap_timed_out" // CodeZapReportTooLarge: the report is bigger than MaxZapReport. CodeZapReportTooLarge = "zap_report_too_large" // CodeZapReportUnknown: GET /v1/zap/{id}/content of a report the host no longer keeps. CodeZapReportUnknown = "zap_report_unknown" // CodeZapStopped: zap.stop stopped this run; the container was removed. CodeZapStopped = "zap_stopped" // CodeZapGrantNotPerson: zap.authorize was sent with an actor label that does not name a person (exposure:<person>): a scan // the box runs by itself (exposure:system) never gets a grant of the disruptive rules. CodeZapGrantNotPerson = "zap_grant_not_person" )
Refusal and failure codes of zap.baseline (spec §6.15).
const ( // ZapRefusedGrantMissing: no grant came with the run. ZapRefusedGrantMissing = "zap_grant_missing" // ZapRefusedGrantUnknown: the host does not hold the grant (it never minted it, it restarted since the press, or ZapGrantsMax later // presses took its place). ZapRefusedGrantUnknown = "zap_grant_unknown" // ZapRefusedGrantExpired: the run came more than ZapGrantTTL after the press. ZapRefusedGrantExpired = "zap_grant_expired" // ZapRefusedGrantSpent: the grant's one active pass is over (more than ZapGrantPass after its first page, or ZapGrantPages used). ZapRefusedGrantSpent = "zap_grant_spent" // ZapRefusedGrantMismatch: the grant was minted for another IP, or for a person other than the run's actor. ZapRefusedGrantMismatch = "zap_grant_mismatch" // NAT): the public IP is then the provider's, shared with its other customers. ZapRefusedGatewayShared = "zap_gateway_shared" // ZapRefusedGatewayUnreadable: the host could not read a default IPv4 gateway right before the run (fail closed). ZapRefusedGatewayUnreadable = "zap_gateway_unreadable" )
Why the host ran a page of zap.active without the disruptive rules core asked for (ZapActiveResult.DisruptiveRefused). The run itself goes on: the active scan proper runs, with the disruptive rules and form posting off.
const ( ZapGrantTTL = 6 * time.Hour // from the press: the scan may wait in the queue and run its deep steps first ZapGrantPass = 90 * time.Minute // from the grant's first page: one active pass (core's 60 minutes, and its last page) ZapGrantPages = 4 // pages of one active pass (exposure.MaxWebScans) ZapGrantsMax = 32 // grants kept at once: a grant whose pass is over gives up its place, and a press drops the oldest )
The bounds of a grant of zap.authorize.
const ( ZapMaxSkipPaths = 20 ZapMaxSkipPathLen = 200 )
The limits of ZapSettings.SkipPaths (exposure's own limits of a target's web paths to skip).
const CmdBoxAgentCheck = "box_agent.check"
CmdBoxAgentCheck is box_agent.check.
const CmdHostSelfUpdate = "host.self_update"
CmdHostSelfUpdate is the command name.
const CmdOSTimezoneSet = "os.timezone.set"
CmdOSTimezoneSet is os.timezone.set.
const CmdZapActive = "zap.active"
CmdZapActive is ZAP's active scan of one page (§6.15a): the same page, checks, fence and container as zap.baseline, with ZAP's Automation Framework plan the host writes itself (one context anchored to the page's scheme, host and port, a bounded spider, the active scan rules of the host's rule split). Disruptive turns on the rules that may crash a service or change data heavily, and form posting; the host takes it only for the box's own IP (kind ip, not a typed IP).
const CmdZapAuthorize = "zap.authorize"
CmdZapAuthorize mints the host's grant of the disruptive rules for one person's press of Scan now (ZapAuthorizeArgs): core sends it when a person starts the scan of the box's own IP, with that person's actor label, and passes the grant back in the zap.active runs of that scan (ZapActiveArgs.Grant). The host keeps the grant in memory: it is good for one active pass (at most four pages within 90 minutes of its first page), on that IP, for runs of that actor, until 6 hours after the press. A run of zap.active that asks for the disruptive rules without a grant that holds runs without them (ZapActiveResult.DisruptiveRefused).
const CmdZapBaseline = "zap.baseline"
CmdZapBaseline is the name of the command.
const CmdZapPrepare = "zap.prepare"
CmdZapPrepare (no args) makes sure the ZAP image is on the box: when it is not and no download runs, the host starts its download by digest in the background (as zap.baseline does on first need) and answers at once (ZapPrepareResult). Core sends it when the External exposure module is switched on and at its own start with the module on (after an install or an update), so the first scan does not find the image missing.
const CmdZapStop = "zap.stop"
CmdZapStop stops one ZAP run (zap.baseline or zap.active), named by the request id it was sent with (ZapStopArgs): when it runs, its context is cancelled, the container removed and proven gone, and the fence deleted, before the command answers; when it has not started yet, the host remembers the stop and that run refuses to start. A run of another request id is left alone.
const CodePackagesChanging = "packages_changing"
CodePackagesChanging (409) is GET /v1/state/packages while a package is half-installed, unpacked or half-configured: dpkg is in the middle of a change (or an interrupted one), so the list is no snapshot of the box. Retryable: core keeps the list it has and reads again at its next run.
const HPTouchesFull = 1000
HPTouchesFull is the number of elements from which the set touched (1024) counts as full.
const MaxBoxAgentCA = 16 << 10
MaxBoxAgentCA is the largest trust anchor core passes (a box CA is under 1 KiB; an owner's chain a few).
const MaxDecoyPorts = 64
MaxDecoyPorts is the most ports one decoy address may answer on.
const MaxHostname = 64
MaxHostname is the longest host name either side passes on: Linux keeps at most 64 bytes (HOST_NAME_MAX).
const MaxPackages = 20000
MaxPackages bounds the list: a longer one is refused (500), not cut, so core never stores half a box.
const MaxPorts = 1000
MaxPorts bounds the list (the inventory keeps at most 1000 services of one source): the lowest ports are kept.
const MaxZapReport = 4 << 20
MaxZapReport is the largest report the host keeps and serves (exposure.MaxWebReport).
const MaxZoneName = 64
MaxZoneName is the longest zone name either side passes on (the longest IANA name is 32 bytes).
Variables ¶
var Services = []string{ServiceCore, ServiceSensor, ServiceHoneypot, ServiceScan, ServiceGreenbone}
Services lists every service in the order the state endpoint reports them.
Functions ¶
func ParseAnchor ¶
func ParseAnchor(pemText []byte) []*x509.Certificate
ParseAnchor returns the certificates of a PEM trust anchor; nil when it holds none, holds anything else, or is too large.
func PortsInUse ¶
PortsInUse reads the ports, and the program holding each when the host found it in /proc (name from comm, printable ASCII, at most 15 characters, and pid), out of a port_in_use message, for core to show. list is printable ASCII, plural is true for more than one port, ok is false for a message of another shape.
func ValidHostname ¶
ValidHostname reports whether s is a host name the box shows and sends on (Info.Hostname): RFC 1123 labels, at most MaxHostname bytes, no trailing dot, no space, underscore, control or non-ASCII character. The name is text set by whoever runs the machine and ends in a device row and in the HOSTNAME of a syslog record, so the host checks it before answering and core again when it reads it; anything else is not passed on.
func ValidZoneName ¶
ValidZoneName reports whether s has the shape of a zone name the box may set (see zoneNameRE and notZones). It says nothing of whether the zone exists: core checks its own database, the host the operating system's.
func ZoneOfLink ¶
ZoneOfLink is the zone name a /etc/localtime link points at: the part after the last "zoneinfo/" of the target ("/usr/share/zoneinfo/Asia/Ho_Chi_Minh", "../usr/share/zoneinfo/Etc/UTC"); "" when the target is not in a zone database or the rest is not a valid name.
Types ¶
type AuditPage ¶
type AuditPage struct {
Records []AuditRecord `json:"records"`
Next string `json:"next,omitempty"`
}
AuditPage is the body of GET /v1/audit. Next is the value to pass as `since` for the following page ("" at the end).
type AuditRecord ¶
type AuditRecord struct {
Seq int64 `json:"seq"`
ID string `json:"id"`
TS string `json:"ts"`
RequestID string `json:"request_id"`
Actor string `json:"actor"`
Peer AuditPeer `json:"peer"`
Command string `json:"command"`
ArgsDigest string `json:"args_digest"`
ArgsRedacted json.RawMessage `json:"args_redacted"`
Result string `json:"result"`
Code *string `json:"code"`
RunID *string `json:"run_id"`
PrevHash string `json:"prev_hash"`
Hash string `json:"hash"`
}
AuditRecord is one line of audit.jsonl as served by GET /v1/audit. Unknown fields a newer host adds are kept out of this view but stay in the chain.
type Backup ¶
type Backup struct {
BackupID string `json:"backup_id"`
Kind string `json:"kind"`
Label string `json:"label,omitempty"`
CreatedAt time.Time `json:"created_at"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
Version int `json:"version"`
DBSchema string `json:"db_schema"`
IncludesSecrets bool `json:"includes_secrets"`
Downloadable bool `json:"downloadable"`
}
Backup is one entry of GET /v1/state/backups.
type BackupCreateArgs ¶
type BackupCreateArgs struct {
Kind string `json:"kind"` // manual | pre_update | pre_os_update | pre_restore
IncludeSecrets bool `json:"include_secrets"`
Label string `json:"label,omitempty"`
// Snapshot is the id (32 hex) of the snapshot core wrote to <core_data>/snapshots/<id>/ just
// before the call (spec 6.11): the host never opens core's database, it copies this one.
Snapshot string `json:"snapshot"`
}
BackupCreateArgs are the args of backup.create.
type BackupList ¶
type BackupList struct {
Backups []Backup `json:"backups"`
}
BackupList is the body of GET /v1/state/backups.
type BackupPurgeResult ¶
type BackupPurgeResult struct {
Deleted int `json:"deleted"`
}
BackupPurgeResult is the result of backup.purge: how many archives were deleted.
type BackupRestoreArgs ¶
type BackupRestoreArgs struct {
BackupID string `json:"backup_id"`
// Snapshot is a snapshot of the state core has right now (spec 6.11): the host keeps it as the
// pre_restore backup, the way back if the restore does not work.
Snapshot string `json:"snapshot"`
}
BackupRestoreArgs are the args of backup.restore.
type BackupRestoreResult ¶
type BackupRestoreResult struct {
RestoredBackupID string `json:"restored_backup_id"`
PreRestoreBackupID string `json:"pre_restore_backup_id"`
Version int `json:"version"`
Health []Health `json:"health"`
}
BackupRestoreResult is the result of backup.restore.
type BackupResult ¶
type BackupResult struct {
BackupID string `json:"backup_id"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
}
BackupResult is the result of backup.create.
type BoxAgentCheckArgs ¶
type BoxAgentCheckArgs struct {
CA string `json:"ca"`
}
BoxAgentCheckArgs are the args of box_agent.check: the certificates (PEM) agents pin to trust the box now (GET /intake/ca.pem).
type BoxAgentCheckResult ¶
type BoxAgentCheckResult struct {
State string `json:"state"`
}
BoxAgentCheckResult is the result of box_agent.check.
type CommandRequest ¶
type CommandRequest struct {
Args json.RawMessage `json:"args"`
}
CommandRequest is the body of POST /v1/commands/{name}. It carries arguments only: no binary, no argv, no path (INV-1).
type ContainerPullArgs ¶
type ContainerPullArgs struct {
Service string `json:"service"`
Version string `json:"version"`
Source string `json:"source"` // "registry" | "bundle"
BundleID string `json:"bundle_id,omitempty"`
Index string `json:"index,omitempty"`
IndexSig string `json:"index_sig,omitempty"`
Manifest string `json:"manifest,omitempty"`
ManifestSig string `json:"manifest_sig,omitempty"`
}
ContainerPullArgs are the args of container.pull (spec 6.7). Index and Manifest are the signed documents, base64, with their minisign signatures (each at most 256 KiB decoded); the host verifies them itself and never takes an image reference, a digest or a path from here. With source=bundle the four documents are not sent: the host reads them from the bundle core wrote at <core_data>/bundles/<bundle_id>.tar.
type ContainerPullResult ¶
type ContainerPullResult struct {
Digest string `json:"digest"`
Size int64 `json:"size"`
Verified []string `json:"verified"` // ["minisign","cosign"]
// IndexExpired says the index this pull was verified with is past its expires_at. An old index only
// warns; the caller shows it.
IndexExpired bool `json:"index_expired"`
}
ContainerPullResult is the result of container.pull: the verified digest, the size the manifest declares, and the checks that passed.
type ContainerRollbackArgs ¶
type ContainerRollbackArgs struct {
Service string `json:"service"`
}
ContainerRollbackArgs are the args of container.rollback: only the service. The target is always the stored previous version.
type ContainerRollbackResult ¶
type ContainerRollbackResult struct {
Digest string `json:"digest"`
FromDigest string `json:"from_digest"`
RestoredBackupID *string `json:"restored_backup_id,omitempty"`
}
ContainerRollbackResult is the result of container.rollback. RestoredBackupID is the pre_update backup that was restored (core, when the release it left says rollback.safe=false).
type ContainerStartArgs ¶
type ContainerStartArgs struct {
Service string `json:"service"`
Version string `json:"version,omitempty"`
Restart bool `json:"restart,omitempty"`
Snapshot string `json:"snapshot,omitempty"`
}
ContainerStartArgs are the args of container.start. Version is semver and names an image that container.pull verified on this host (without it: the current image). Snapshot is the id of a snapshot core wrote: core must send one with a version (the host makes the pre_update backup from it when the digest changes), and no other service may.
type ContainerStartResult ¶
type ContainerStartResult struct {
Service string `json:"service"`
Version *string `json:"version"`
Digest string `json:"digest"`
PreviousDigest *string `json:"previous_digest"`
Healthy bool `json:"healthy"`
Restarted bool `json:"restarted"`
BackupID *string `json:"backup_id,omitempty"`
IndexExpired bool `json:"index_expired,omitempty"`
}
ContainerStartResult is the result of container.start. Version is null for a start without a version; Restarted is false when the service already ran the right image and was healthy. PreviousDigest is the digest the service ran before a switch. BackupID is the pre_update backup core's switch made. IndexExpired says the index the version was checked against is past its expires_at: the caller shows it.
type ContainerState ¶
type ContainerState struct {
Service string `json:"service"`
Installed bool `json:"installed"`
Version *string `json:"version"`
Digest *string `json:"digest"`
ConfiguredDigest *string `json:"configured_digest"`
Previous *ContainerVersion `json:"previous"`
LatestPulled *ContainerVersion `json:"latest_pulled"`
Enabled bool `json:"enabled"`
UnitState string `json:"unit_state"`
Health string `json:"health"`
}
ContainerState is one service in GET /v1/state/containers. Installed says a unit with a pinned digest exists; ConfiguredDigest is the digest in that unit and Digest the one the running container reports (null when no container exists), so a unit that was changed but not restarted shows. Version and Previous come from the versions the host recorded (null when it knows none); LatestPulled is the version container.pull verified last.
type ContainerStopArgs ¶
ContainerStopArgs are the args of container.stop. Persist rewrites the unit without its [Install] section so the service stays down after a reboot.
type ContainerStopResult ¶
type ContainerStopResult struct {
Service string `json:"service"`
Persist bool `json:"persist"`
Changed bool `json:"changed"`
}
ContainerStopResult is the result of container.stop. Changed is false when the service was already stopped and the unit already in the asked state.
type ContainerVersion ¶
ContainerVersion is a version and digest pair. Version is null until container.pull records it.
type ContainersState ¶
type ContainersState struct {
Services []ContainerState `json:"services"`
}
ContainersState is the body of GET /v1/state/containers.
type DecoyAddArgs ¶
type DecoyAddArgs struct {
IP string `json:"ip"`
OUI string `json:"oui,omitempty"`
Ports *[]DecoyPort `json:"ports,omitempty"`
}
DecoyAddArgs are the args of decoy_ip.add. OUI is six hex digits (unicast, globally administered); empty means "no OUI": the MAC is then locally administered. Ports nil means no allow-list: the address answers on every port the honeypot listens on (what an older core gets); a list, even an empty one, means only those ports.
type DecoyAddResult ¶
DecoyAddResult is the result of decoy_ip.add.
type DecoyPort ¶
DecoyPort is one port a decoy address answers on: Proto "tcp" or "udp", Port 1 to 65535.
type DecoyRemoveArgs ¶
type DecoyRemoveArgs struct {
IP string `json:"ip"`
}
DecoyRemoveArgs are the args of decoy_ip.remove.
type DecoyRemoveResult ¶
type DecoyRemoveResult struct {
Removed bool `json:"removed"`
}
DecoyRemoveResult is the result of decoy_ip.remove: Removed is false when the IP was no decoy.
type DecoySetPortsArgs ¶
DecoySetPortsArgs are the args of decoy_ip.set_ports: the whole allow-list of one decoy address (required; an empty list closes every TCP and UDP port of it).
type DecoySetPortsResult ¶
DecoySetPortsResult is the result of decoy_ip.set_ports: the allow-list now in force, sorted.
type ErrorBody ¶
type ErrorBody struct {
Error ErrorInfo `json:"error"`
}
ErrorBody is the body of every non-2xx response: {"error":{...}}.
type ErrorInfo ¶
type ErrorInfo struct {
Code string `json:"code"`
Message string `json:"message"`
Details []Detail `json:"details,omitempty"`
RunID string `json:"run_id,omitempty"`
RetryAfterS int `json:"retry_after_s,omitempty"`
}
ErrorInfo is the error object. RunID is set for busy (the run in progress) and for pending_confirm (the run that is waiting for confirmation); RetryAfterS for rate_limited.
type Event ¶
type Event struct {
Seq uint64 `json:"seq"`
TS time.Time `json:"ts"`
Kind string `json:"kind"`
Line string `json:"line,omitempty"`
Percent *int `json:"percent,omitempty"`
Status Status `json:"status,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
Event is one SSE event of a run. Truncated is true when older events were dropped.
type ExposureFenceCheckArgs ¶
type ExposureFenceCheckArgs struct {
Domain string `json:"domain"`
Name string `json:"name"`
IP string `json:"ip"`
Token string `json:"token"`
Disruptive bool `json:"disruptive,omitempty"`
// ProofAt: the name above Domain where the token of Domain sits (the zone apex or a parent name); "" = on Domain. Name may then be
// any name under ProofAt, not only under Domain (a name covered by the record of another domain of the box). Never on or above a public suffix.
ProofAt string `json:"proof_at,omitempty"`
// Recheck: the check of a task that runs (every 3 minutes): the host asks DNS again instead of answering from its 5-minute cache.
Recheck bool `json:"recheck,omitempty"`
// Typed makes this the check of a public IP a person typed in: Domain and Name are the IP literal, Token the box-bound token of that
// literal, and the host checks the IP's own proof (the token file, or reverse DNS) itself.
Typed *ExposureTyped `json:"typed,omitempty"`
}
ExposureFenceCheckArgs are the args of exposure.fence_check: the domain_ip job fields of plan 2026-11-14 §5.
type ExposureFenceCheckResult ¶
type ExposureFenceCheckResult struct {
Chain string `json:"chain"`
}
ExposureFenceCheckResult is the result of a check that said yes: the CNAME chain of the name ("a -> b"), for the probe log.
type ExposureTokenArgs ¶
type ExposureTokenArgs struct {
Domain string `json:"domain"`
// Proved, for a public IP a person typed in: core found its proof, so the host lists it (its own list, its own cap) for the executors.
// Without it the IP gets its token and no list place, so an IP nobody proved takes none.
Proved bool `json:"proved,omitempty"`
}
ExposureTokenArgs are the args of exposure.token.
type ExposureTokenForgetResult ¶
type ExposureTokenForgetResult struct {
Removed bool `json:"removed"`
}
ExposureTokenForgetResult is the result of exposure.token_forget: whether the domain was on the list.
type ExposureTokenResult ¶
type ExposureTokenResult struct {
Token string `json:"token"`
}
ExposureTokenResult is its result.
type ExposureTyped ¶
type ExposureTyped struct {
Method string `json:"method"`
PTRName string `json:"ptr_name,omitempty"`
CoverDomain string `json:"cover_domain,omitempty"`
CoverToken string `json:"cover_token,omitempty"`
CoverProofAt string `json:"cover_proof_at,omitempty"`
}
ExposureTyped is the proof of a typed IP (core/domainfence.TypedProof): Method "file" or "ptr"; for "ptr" the PTR name and the domain of this box that proves it (its box-bound token, and the parent name its record sits on when it is not its own).
type GreenboneUpArgs ¶
type GreenboneUpArgs struct {
Password string `json:"password"`
}
GreenboneUpArgs are the args of greenbone.up. Password is the GMP password core generated and keeps in core/secrets (48 lower-case hex characters); the host hands it to gvmd at every up as a file only root and gvmd read, so gvmd creates its admin user with it, and sets it again in the background on a volume that keeps another one (host-api §6.16). The server's audit line redacts it by its key and records only a digest of the args.
type HPTouch ¶
HPTouch is one source that tried a new TCP or UDP connection to a decoy address (allowed port or not): AgeS is the seconds since it first did within the set's two minutes.
type HPTouchesState ¶
type HPTouchesState struct {
Touches []HPTouch `json:"touches"`
Recording bool `json:"recording"`
Full bool `json:"full"`
}
HPTouchesState is the body of GET /v1/state/hp-touches; Touches is [] when none (or while the namespace is not proven). Recording is false when the host loaded the ruleset without the set (its print form could not be proven, B2 review H1): no attempt is recorded then. Full is true when the set holds close to its 1024 elements: new pairs may be missing.
type HostSelfUpdateArgs ¶
type HostSelfUpdateArgs struct {
Version string `json:"version"`
Index string `json:"index"`
IndexSig string `json:"index_sig"`
Manifest string `json:"manifest"`
ManifestSig string `json:"manifest_sig"`
Package string `json:"package"`
}
HostSelfUpdateArgs are the args of host.self_update. Index, IndexSig, Manifest and ManifestSig are standard padded base64 as for container.pull; Package is the 32-hex id of the file core wrote at <core_data>/host-packages/<package>.deb. No path, URL or hash is taken from the request.
type HostSelfUpdateResult ¶
type HostSelfUpdateResult struct {
From string `json:"from"`
To string `json:"to"`
Changed bool `json:"changed"`
SHA256 string `json:"sha256"`
RolledBackTo string `json:"rolled_back_to,omitempty"`
}
HostSelfUpdateResult is the result of host.self_update. Changed is false when the release's host version is the running one (nothing was touched). RolledBackTo is set when the previous version was put back.
type HostState ¶
type HostState struct {
Version string `json:"version"`
Previous *HostVersionRef `json:"previous"`
PackagesKept []string `json:"packages_kept"`
Update *HostUpdate `json:"update"`
}
HostState is the body of GET /v1/state/host. A field whose file is damaged is null (and logged).
type HostUpdate ¶
type HostUpdate struct {
RunID string `json:"run_id"`
Phase string `json:"phase"`
To string `json:"to"`
}
HostUpdate is a self-update the journal says is under way.
type HostVersionRef ¶
type HostVersionRef struct {
Version string `json:"version"`
}
HostVersionRef names one version of the host package.
type Info ¶
type Info struct {
HostVersion string `json:"host_version"`
Proto int `json:"proto"`
Commands []string `json:"commands"`
Runner string `json:"runner"`
Hostname string `json:"hostname,omitempty"`
OS OSInfo `json:"os"`
Arch string `json:"arch"`
BootedAt time.Time `json:"booted_at"`
Time time.Time `json:"time"`
AuditOK bool `json:"audit_ok"`
}
Info is the body of GET /v1/info. Hostname is the machine's OS host name (#471): core runs in a container whose own name is not the machine's. It is optional: absent when the name is unreadable or fails ValidHostname, and a host older than the field never sends it, so a reader falls back on its own name.
type ListenPort ¶
type ListenPort struct {
Port int `json:"port"`
Proto string `json:"proto"`
Process string `json:"process"`
}
ListenPort is one port the box listens on at an address other than loopback (every address, 0.0.0.0 or ::, counts). Proto is "tcp" (a socket in LISTEN) or "udp" (a bound socket with no peer). Process names what holds it: the Vedette service ("vedette-core") when the process runs in a vedette-*.service unit or is a container monitor (conmon) of a unit, else the process name of /proc/<pid>/comm reduced to printable ASCII ("sshd"); "" when no process could be found. Proto is ProtoTCP or ProtoUDP (decoy.go): the same protocol names, a word of the answer, never a network the host listens on or dials.
type LogsExportArgs ¶
type LogsExportArgs struct {
Units []string `json:"units"`
Since string `json:"since"`
Until string `json:"until"`
}
LogsExportArgs are the args of logs.export. Since and Until are RFC 3339.
type LogsExportResult ¶
type LogsExportResult struct {
ExportID string `json:"export_id"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
Lines int `json:"lines"`
}
LogsExportResult is the result of logs.export.
type NetApplyArgs ¶
type NetApplyArgs struct {
Mgmt NetApplyMgmt `json:"mgmt"`
SPAN NetApplySPAN `json:"span"`
// NTP holds up to four IPv4 addresses or names, added to the sources of the distribution's own chrony configuration; empty writes the default `pool pool.ntp.org` into vedette.sources.
NTP []string `json:"ntp"`
// ConfirmTimeoutS is the confirm window of a management change, 30 to 600; 0 means 120.
ConfirmTimeoutS int `json:"confirm_timeout_s"`
}
NetApplyArgs is the desired state of the part Vedette manages (spec 6.5): every call carries the whole state, so a field left out means "none", never "keep".
type NetApplyMgmt ¶
type NetApplyMgmt struct {
Iface string `json:"iface"`
Mode string `json:"mode"` // "dhcp" | "static"
Address string `json:"address"` // CIDR; required with static
Gateway string `json:"gateway"` // optional with static
DNS []string `json:"dns"`
}
NetApplyMgmt is the management card of net.apply.
type NetApplyResult ¶
NetApplyResult is the result of net.apply. Confirm is true when the run waits for net.confirm.
type NetApplySPAN ¶
type NetApplySPAN struct {
Iface *string `json:"iface"`
}
NetApplySPAN is the SPAN card of net.apply; Iface null (or the whole object absent) means none.
type NetConfig ¶
type NetConfig struct {
Mgmt *NetMgmt `json:"mgmt"`
SPAN *string `json:"span"` // name of the SPAN card, or null
NTP []string `json:"ntp"` // the servers of vedette.sources; empty when the file is absent or holds the default pool.ntp.org line (the distribution's own sources stay either way)
}
NetConfig is what the host wrote to its netplan file. Mgmt is null when the host has not written one (the box still has the network the installer gave it).
type NetCounters ¶
type NetCounters struct {
RxPackets uint64 `json:"rx_packets"`
TxPackets uint64 `json:"tx_packets"`
RxBytes uint64 `json:"rx_bytes"`
TxBytes uint64 `json:"tx_bytes"`
RxErrors uint64 `json:"rx_errors"`
TxErrors uint64 `json:"tx_errors"`
RxDropped uint64 `json:"rx_dropped"`
TxDropped uint64 `json:"tx_dropped"`
}
NetCounters are the kernel's counters of one interface (/sys/class/net/<if>/statistics).
type NetDecoy ¶
type NetDecoy struct {
IP string `json:"ip"`
MAC string `json:"mac"`
// Ports is the allow-list of the address; nil (absent) = no allow-list, the address
// answers every port the honeypot listens on. An older host never sends it.
Ports *[]DecoyPort `json:"ports,omitempty"`
}
NetDecoy is a secondary address the honeypot answers on: what hp/decoys.json holds.
type NetInterface ¶
type NetInterface struct {
Name string `json:"name"`
MAC string `json:"mac"`
// State is the kernel's operstate: "up", "down", "dormant" or "unknown".
State string `json:"state"`
SpeedMbps *int `json:"speed_mbps"` // null when the link is down or the card does not say
// Role is "management" for the management card, "span" for the SPAN card, "" for any other.
Role string `json:"role"`
// Promisc is the kernel's IFF_PROMISC flag. On the SPAN card it is on while the sensor listens
// (the sensor sets it on its own socket); netplan has no such key.
Promisc bool `json:"promisc"`
// Addresses are the IPv4 and IPv6 addresses of the card as CIDR text, "10.0.0.5/24".
Addresses []string `json:"addresses"`
// Dynamic are the addresses of Addresses that have a lease (a DHCP lease, an IPv6 SLAAC address): the kernel's IFA_F_PERMANENT
// flag is unset, what `ip address` prints as "dynamic". [] when none; absent from an older host.
Dynamic []string `json:"dynamic"`
Counters NetCounters `json:"counters"`
}
NetInterface is one network card (a device with a hardware parent; bridges, veth and macvlan links are not cards).
type NetMgmt ¶
type NetMgmt struct {
Iface string `json:"iface"`
Mode string `json:"mode"` // "dhcp" or "static"
Address string `json:"address"` // CIDR; "" with dhcp
Gateway string `json:"gateway"` // "" with dhcp
DNS []string `json:"dns"`
Search []string `json:"search"`
}
NetMgmt is the management part of the running configuration, as the host wrote it.
type NetPending ¶
type NetPending struct {
RunID string `json:"run_id"`
RevertAt time.Time `json:"revert_at"`
// RebootAt is set when a revert could not be applied: the host has scheduled a reboot at this
// time, because the saved configuration on disk is the old one. Not set otherwise.
RebootAt *time.Time `json:"reboot_at,omitempty"`
}
NetPending is a network change that waits for confirmation. Null when none waits.
type NetRoute ¶
type NetRoute struct {
Iface string `json:"iface"`
// Gateway is the next hop as plain address text, never with a zone: an IPv6 link-local next hop ("fe80::1") is on Iface.
Gateway string `json:"gateway"`
// MAC is the gateway's link-layer address from the kernel's neighbour table; absent when the table has no usable entry for it
// on Iface (no traffic yet, or a resolution that failed). Absent from an older host.
MAC string `json:"mac,omitempty"`
}
NetRoute is a default route the kernel has: IPv4 from /proc/net/route, IPv6 from /proc/net/ipv6_route.
type NetRunArgs ¶
type NetRunArgs struct {
RunID string `json:"run_id"`
}
NetRunArgs are the args of net.confirm and net.revert: the run that waits.
type NetState ¶
type NetState struct {
Interfaces []NetInterface `json:"interfaces"`
Config NetConfig `json:"config"`
DefaultRoute *NetRoute `json:"default_route"`
// DefaultRoutes6 are the IPv6 default routes of every routing table, each next hop of an equal-cost route on its own, lowest metric
// first; [] when there is none (absent from an older host).
DefaultRoutes6 []NetRoute `json:"default_routes6"`
Pending *NetPending `json:"pending"`
Decoys []NetDecoy `json:"decoys"`
// Resolvers are the DNS servers the box's resolver uses now, whoever set them (a DHCP lease, netplan, an administrator): the
// nameserver lines of /run/systemd/resolve/resolv.conf and /etc/resolv.conf, without loopback stubs. An older host does not
// send the field.
Resolvers []string `json:"resolvers"`
}
NetState is the body of GET /v1/state/net.
type OSAutoSecurityArgs ¶
type OSAutoSecurityArgs struct {
Enabled bool `json:"enabled"`
}
OSAutoSecurityArgs are the args of os.auto_security.set.
type OSAutoSecurityResult ¶
type OSAutoSecurityResult struct {
Enabled bool `json:"enabled"`
}
OSAutoSecurityResult is the result of os.auto_security.set: what was read back.
type OSDetails ¶
type OSDetails struct {
Distro string `json:"distro"`
Name string `json:"name"`
Release string `json:"release"`
Kernel string `json:"kernel"`
SupportEnd string `json:"support_end"`
ExtendedEnd *string `json:"extended_end"`
BootedAt time.Time `json:"booted_at"`
LastCheck time.Time `json:"last_check"`
Mirrors []string `json:"mirrors"`
}
OSDetails is the os part of OSState (fields of the GUI's OsInfo that the host knows).
type OSInfo ¶
type OSInfo struct {
Distro string `json:"distro"`
Release string `json:"release"`
Kernel string `json:"kernel"`
}
OSInfo is the os part of Info.
type OSInstallArgs ¶
type OSInstallArgs struct {
Scope string `json:"scope"` // "security" | "all"
// Snapshot is the id (32 hex) of the snapshot core wrote to <core_data>/snapshots/<id>/ just
// before the call; the host copies it into the pre_os_update backup (spec 6.11).
Snapshot string `json:"snapshot"`
}
OSInstallArgs are the args of os.install.
type OSPackage ¶
type OSPackage struct {
Name string `json:"name"`
Current string `json:"current"`
New string `json:"new"`
Security bool `json:"security"`
Origin string `json:"origin"`
CVEs []string `json:"cves"`
}
OSPackage is one pending upgrade. CVEs is empty: the host does not know them (core adds them).
type OSRebootArgs ¶
type OSRebootArgs struct {
When string `json:"when"` // "now" | "at"
At string `json:"at,omitempty"`
}
OSRebootArgs are the args of os.reboot. At is RFC 3339 UTC, required (and only allowed) for When "at".
type OSRebootResult ¶
OSRebootResult is the result of os.reboot. At is set when a reboot was scheduled.
type OSRunResult ¶
type OSRunResult struct {
Installed int `json:"installed"`
Security int `json:"security"`
Backup string `json:"backup"`
Health []Health `json:"health"`
RebootRequired bool `json:"reboot_required"`
}
OSRunResult is the result of os.install (the GUI's OsRunResult). Backup is "" when there was nothing to install and so no backup was needed.
type OSState ¶
type OSState struct {
OS OSDetails `json:"os"`
Pending []OSPackage `json:"pending"`
SecurityCount int `json:"security_count"`
RebootRequired bool `json:"reboot_required"`
RebootReasons []string `json:"reboot_reasons"`
RebootScheduledAt *time.Time `json:"reboot_scheduled_at"`
AutoSecurity bool `json:"auto_security"`
LastCheck time.Time `json:"last_check"`
}
OSState is the result of os.check and the body of GET /v1/state/os: what the host knows of the operating system. Core adds what only it knows (maintenance window, release_upgrade guidance, busy).
type OSTimezoneArgs ¶
type OSTimezoneArgs struct {
Zone string `json:"zone"`
}
OSTimezoneArgs are the args of os.timezone.set.
type OSTimezoneResult ¶
OSTimezoneResult is the result of os.timezone.set: the zone the operating system uses now (read back), and whether the run changed it (false: it already was).
type Package ¶
type Package struct {
Name string `json:"name"`
Version string `json:"version"`
Arch string `json:"arch"`
Source string `json:"source"`
}
Package is one installed package as dpkg lists it. Version is the full Debian version (epoch and revision kept); Source is the source package (dpkg prints the package's own name when it has no Source field).
type PackagesState ¶
type PackagesState struct {
Packages []Package `json:"packages"`
}
PackagesState is the body of GET /v1/state/packages: the packages whose files are on the box (dpkg status installed, triggers-awaited or triggers-pending), sorted by name and architecture. Never empty: a dpkg-query that lists no installed package is an error, so core never empties the box's list on a bad read.
type PortsState ¶
type PortsState struct {
Ports []ListenPort `json:"ports"`
}
PortsState is the body of GET /v1/state/ports, sorted by protocol then port, one entry per port and protocol.
type Run ¶
type Run struct {
RunID string `json:"run_id"`
Command string `json:"command"`
Status Status `json:"status"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Actor string `json:"actor"`
RequestID string `json:"request_id"`
Result json.RawMessage `json:"result,omitempty"`
Error *RunError `json:"error,omitempty"`
RevertAt *time.Time `json:"revert_at,omitempty"`
// ParkedDeadline is set while a running run is parked (server.Parked): the run outlives
// the host process, and its command's own code ends it (server.SettleParked) by then.
ParkedDeadline *time.Time `json:"parked_deadline,omitempty"`
AuditID string `json:"audit_id"`
}
Run is one command invocation (spec section 4).
type RunList ¶
type RunList struct {
Runs []Run `json:"runs"`
}
RunList is the body of GET /v1/runs.
type Status ¶
type Status string
Status is the state of a Run.
type TimeState ¶
type TimeState struct {
Timezone string `json:"timezone"`
}
TimeState is the body of GET /v1/state/time: the operating system's time zone, read from the /etc/localtime link ("" when it is not a link into a zone database: a copied file, no file, a name that is not valid).
type ZapActiveArgs ¶
type ZapActiveArgs struct {
ZapBaselineArgs
// Disruptive runs the disruptive rules of the rule split (denial of service, and checks that may change data heavily) and lets the
// spider post forms. Only for kind ip without Typed: the box's own public IP, proven by the host's own check right before the run.
// The host runs them only when Grant holds and its own read of the default gateway allows them; otherwise the page runs without
// them and ZapActiveResult.DisruptiveRefused says why.
Disruptive bool `json:"disruptive,omitempty"`
// Grant is the result of zap.authorize at the press of the person who started the scan (32 hex characters); only with Disruptive.
Grant string `json:"grant,omitempty"`
}
ZapActiveArgs are the args of zap.active: the page as in zap.baseline, and whether the disruptive rules run.
type ZapActiveResult ¶
type ZapActiveResult struct {
ReportID string `json:"report_id"`
Size int64 `json:"size"`
ExitCode int `json:"exit_code"`
CutShort bool `json:"cut_short"`
// DisruptiveRules are the ZAP plugin ids of the host's rule split that a run without Disruptive does not run as a run with it
// does (the disruptive rules, and SQL Injection, whose stronger payloads need Disruptive): an alert of one of them found with
// Disruptive is closed by core only after another run with Disruptive. The same list for every run of a host version.
DisruptiveRules []int `json:"disruptive_rules"`
// DisruptiveRefused is set when the run asked for the disruptive rules and the host ran the page without them: one of the
// ZapRefused* codes. "" when they ran, or were not asked for.
DisruptiveRefused string `json:"disruptive_refused,omitempty"`
// SkippedRules are the ZAP plugin ids of the rule split that this page did not run, or ran with weaker payloads, because of the
// settings of the run (ZapSettings) where the same run without them would have: core closes no issue of one of them with this
// page.
SkippedRules []int `json:"skipped_rules,omitempty"`
}
ZapActiveResult is the result of a zap.active that produced a report: the Automation Framework's exit code (0 no error or warning, 1 a job reported an error, 2 a warning) and the report as for zap.baseline. CutShort says the active scan reached its time limit (or was ended by ZAP) before it finished: the report holds what it found until then. It is also set when the run asked for the disruptive rules without a grant (DisruptiveRefused zap_grant_missing, how a core older than the grant asks): not every rule asked for ran, so a core that reads only CutShort closes no issue with the page.
type ZapAuthorizeArgs ¶
type ZapAuthorizeArgs struct {
IP string `json:"ip"`
}
ZapAuthorizeArgs are the args of zap.authorize: the box's own public IPv4 address the person's scan is of.
type ZapAuthorizeResult ¶
type ZapAuthorizeResult struct {
Grant string `json:"grant"`
ExpiresAt time.Time `json:"expires_at"`
}
ZapAuthorizeResult is the grant (32 hex characters) and when it expires.
type ZapBaselineArgs ¶
type ZapBaselineArgs struct {
URL string `json:"url"`
Host string `json:"host"`
IP string `json:"ip"`
Port int `json:"port"`
Kind string `json:"kind"`
Domain string `json:"domain,omitempty"`
TXTToken string `json:"txt_token,omitempty"`
// ProofAt: the name above Domain (the zone apex or a parent name) where the token of Domain sits; "" = on Domain. Host may then
// be any name under ProofAt, not only under Domain. Only with the token bound to this box for Domain (the domain fence), and
// between Domain and its registered domain.
ProofAt string `json:"proof_at,omitempty"`
// Typed, with Kind ip, says the IP is one a person typed in: TXTToken is the box-bound token of the IP and the host checks the IP's
// own proof (the token file, or reverse DNS) itself before ZAP starts.
Typed *ExposureTyped `json:"typed,omitempty"`
// ProvenAt, with Kind ip and no Typed (the box's own public IP), is the latest sighting of IP as the box's egress, RFC 3339, that
// core's gate took the address on: the address stays the box's own for 90 days from it (egressip.ProofHolds), also while the box
// goes out through another line, and the host then takes the page on it instead of its own sighting. Empty: the host's sighting
// right before the run decides, as before.
ProvenAt string `json:"proven_at,omitempty"`
// Settings are the target's deep-scan settings (nil: none). They only narrow what the run does. A host older than the field
// refuses the run (an unknown field): nothing is requested.
Settings *ZapSettings `json:"settings,omitempty"`
}
ZapBaselineArgs are the args of zap.baseline. URL is http(s)://Host[:Port]/; IP is the public IPv4 address ZAP is pinned to and Port its TCP port. Kind ip: Host is the IP itself, and the host checks that the box leaves the Internet through it. Kind domain: Host is Domain or a name under it, and the host checks that Domain still has the TXT record vedette-verify=<TXTToken> and that Host resolves to IP.
type ZapBaselineResult ¶
type ZapBaselineResult struct {
ReportID string `json:"report_id"`
Size int64 `json:"size"`
ExitCode int `json:"exit_code"`
}
ZapBaselineResult is the result of a zap.baseline that produced a report: zap-baseline.py's exit code (0 no rule matched, 1 a FAIL rule, 2 a WARN rule) and the id of the report, served by GET /v1/zap/{report_id}/content until the next run or the next start of the host.
type ZapPrepareResult ¶
type ZapPrepareResult struct {
State string `json:"state"`
LastError string `json:"last_error,omitempty"`
}
ZapPrepareResult is the state of the ZAP image after zap.prepare: ZapImageReady or ZapImagePulling, and LastError the reason the previous download failed ("" when none; a new download has started).
type ZapSettings ¶
type ZapSettings struct {
// SkipPaths are URL path prefixes ZAP never requests (at most ZapMaxSkipPaths, each starting with "/", other than "/" alone, at
// most ZapMaxSkipPathLen characters of a URL path: letters, digits and - . _ ~ % ! & ' , ; = : @ /). The host matches each one
// literally as a prefix of the page's own origin, in any case: it builds the excludes of ZAP's context itself from the validated
// prefixes. With paths to skip, the passive pass runs as an Automation Framework plan with those excludes (zap-baseline.py has
// none), and the active pass leaves out the rules that request fixed file names (ZAP does not apply the context's excludes to
// them), naming them in ZapActiveResult.SkippedRules.
SkipPaths []string `json:"skip_paths,omitempty"`
// NoDoS and NoChange turn classes of the disruptive rules of zap.active off: NoDoS the denial-of-service rules, NoChange the rules
// that may change data or make the server fetch something elsewhere, with form posting and SQL Injection's stronger payloads.
// They never stand in for Disruptive, the grant or the gateway check; without the disruptive rules (and in zap.baseline, which
// has none) they change nothing.
NoDoS bool `json:"no_dos,omitempty"`
NoChange bool `json:"no_change,omitempty"`
// Gentle runs zap.active's scan and its spider on one thread with 500 ms between requests (fixed in the host). zap.baseline's
// spider runs on one thread anyway.
Gentle bool `json:"gentle,omitempty"`
}
ZapSettings are a target's deep-scan settings as zap.baseline and zap.active take them. Each one only narrows the run.
type ZapStopArgs ¶
type ZapStopArgs struct {
RequestID string `json:"request_id"`
}
ZapStopArgs are the args of zap.stop: the X-Request-Id (a UUID v4) of the zap.baseline or zap.active run to stop.
type ZapStopResult ¶
type ZapStopResult struct {
Stopped bool `json:"stopped"`
}
ZapStopResult says whether zap.stop found the run running and stopped it (false: the run had not started, and will refuse to, or had already ended).