9.8. Clair 通知程序配置字段


Clair 的一般通知配置字段如下所示。

Expand
字段类型描述

notifier

对象

提供 Clair 通知程序节点配置。

.connstring

字符串

Postgres 连接字符串。接受格式为 URL 或 libpq 连接字符串。

.migrations

布尔值

通知程序节点处理迁移到其数据库。

.indexer_addr

字符串

通知程序会联系一个索引程序来创建或获取受漏洞影响的清单。此索引器的位置是必需的。

.matcher_addr

字符串

通知程序联系一个匹配器来列出更新操作并获取 diffs。此匹配器的位置是必需的。

.poll_interval

字符串

通知程序将查询与更新操作的匹配者的频率。

.delivery_interval

字符串

通知程序尝试发送创建或之前失败通知的频率。

.disable_summary

布尔值

控制每个清单是否应当向其中一个通知进行汇总。

通知程序配置示例

以下 通知程序 片断用于最小配置。

通知程序配置示例

# ...
notifier:
  connstring: >-
    host=DB_HOST port=5432 dbname=notifier user=DB_USER password=DB_PASS
    sslmode=verify-ca sslcert=/etc/clair/ssl/cert.pem sslkey=/etc/clair/ssl/key.pem
    sslrootcert=/etc/clair/ssl/ca.pem
  indexer_addr: http://clair-v4/
  matcher_addr: http://clair-v4/
  delivery_interval: 5s
  migrations: true
  poll_interval: 15s
  webhook:
    target: "http://webhook/"
    callback: "http://clair-notifier/notifier/api/v1/notifications"
    headers: ""
  amqp: null
  stomp: null
# ...

9.8.1. Clair Webhook 配置字段

以下 webhook 字段可用于 Clair notifier 环境。

Expand
表 9.3. Clair Webhook 字段

.webhook

对象

为 webhook 发送配置通知程序。

.webhook.target

字符串

提供 webhook 的 URL。

.webhook.callback

字符串

可以检索通知的回调 URL。通知 ID 将附加到此 URL。

这通常是托管 Clair notifier 的位置。

.webhook.headers

字符串

将标头名称与值列表关联的映射。

Webhook 配置示例

Webhook 配置示例

# ...
notifier:
# ...
  webhook:
    target: "http://webhook/"
    callback: "http://clair-notifier/notifier/api/v1/notifications"
# ...

9.8.2. Clair amqp 配置字段

以下高级消息队列协议(AMQP)字段可用于 Clair 通知程序环境。

Expand

.amqp

对象

为 AMQP 交付配置通知程序。

[注意] ==== Clair 不自行声明任何 AMQP 组件。所有尝试使用交换或队列的尝试都只是被动,并且会失败。代理管理员应提前设置交换和队列。====

.amqp.direct

布尔值

如果为 true,则通知程序会向配置的 AMQP 代理提供单独的通知(而不是回调)。

.amqp.rollup

整数

amqp.direct 设为 true 时,这个值会通知通知程序在直接发送中发送了多少通知。例如,如果 direct 设为 true,并且 amqp.rollup 设为 5,则通知程序在单个 JSON 有效负载中不再提供 5 通知到代理。将值设为 0 实际的效果是将其设置为 1

.amqp.exchange

对象

要连接的 AMQP 交换。

.amqp.exchange.name

字符串

要连接的交换的名称。

.amqp.exchange.type

字符串

交换的类型。通常,以下之一: direct,fanout,topic,标头.

.amqp.exchange.durability

布尔值

配置的队列是否持久。

.amqp.exchange.auto_delete

布尔值

配置的队列是否使用 auto_delete_policy

.amqp.routing_key

字符串

每个通知发送的路由密钥的名称。

.amqp.callback

字符串

如果 amqp.direct 设为 false,则会在发送到代理的通知回调中提供此 URL。此 URL 应指向 Clair 的通知 API 端点。

.amqp.uris

字符串

按优先级顺序连接的一个或多个 AMQP 代理的列表。

.amqp.tls

对象

配置到 AMQP 代理的 TLS/SSL 连接。

.amqp.tls.root_ca

字符串

可以读取 root CA 的文件系统路径。

.amqp.tls.cert

字符串

可以读取 TLS/SSL 证书的文件系统路径。

[注意] ==== Clair 还允许 SSL_CERT_DIR,如 Go crypto/x509 软件包所记录。====

.amqp.tls.key

字符串

可以读取 TLS/SSL 私钥的文件系统路径。

AMQP 配置示例

以下示例显示了 Clair 的假设 AMQP 配置。

AMQP 配置示例

# ...
notifier:
# ...
  amqp:
    exchange:
        name: ""
        type: "direct"
        durable: true
        auto_delete: false
    uris: ["amqp://user:pass@host:10000/vhost"]
    direct: false
    routing_key: "notifications"
    callback: "http://clair-notifier/notifier/api/v1/notifications"
    tls:
     root_ca: "optional/path/to/rootca"
     cert: "madatory/path/to/cert"
     key: "madatory/path/to/key"
# ...

9.8.3. Clair STOMP 配置字段

以下简单文本介绍的消息协议(STOMP)字段可用于 Clair 通知程序环境。

Expand
.stomp对象为 STOMP 交付配置通知程序。

.stomp.direct

布尔值

如果为 true,则通知程序会向配置的 STOMP 代理提供单独的通知(而非回调)。

.stomp.rollup

整数

如果 stomp.direct 设为 true,则这个值会限制在单个直接发送中发送的通知数量。例如,如果 direct 设置为 true,并且 rollup 设为 5,则通知程序在单个 JSON 有效负载中不会提供 5 通知到代理。将值设为 0 实际的效果是将其设置为 1

.stomp.callback

字符串

如果 stomp.callback 设为 false,则通知回调中提供的 URL 将发送到代理。此 URL 应指向 Clair 的通知 API 端点。

.stomp.destination

字符串

向其发送通知的 STOMP 目的地。

.stomp.uris

字符串

以优先级顺序连接到的一个或多个 STOMP 代理的列表。

.stomp.tls

对象

配置了到 STOMP 代理的 TLS/SSL 连接。

.stomp.tls.root_ca

字符串

可以读取 root CA 的文件系统路径。

[注意] ==== Clair 还尊重 SSL_CERT_DIR,如 Go crypto/x509 软件包所述。====

.stomp.tls.cert

字符串

可以读取 TLS/SSL 证书的文件系统路径。

.stomp.tls.key

字符串

可以读取 TLS/SSL 私钥的文件系统路径。

.stomp.user

字符串

配置 STOMP 代理的登录详情。

.stomp.user.login

字符串

要连接的 STOMP 登录。

.stomp.user.passcode

字符串

要连接的 STOMP 传递码。

STOMP 配置示例

以下示例显示了 Clair 的假设 STOMP 配置。

STOMP 配置示例

# ...
notifier:
# ...
  stomp:
    desitnation: "notifications"
    direct: false
    callback: "http://clair-notifier/notifier/api/v1/notifications"
    login:
      login: "username"
      passcode: "passcode"
    tls:
     root_ca: "optional/path/to/rootca"
     cert: "madatory/path/to/cert"
     key: "madatory/path/to/key"
# ...

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部