設定リファレンス
サーバは作業ディレクトリの wpg.toml、または --config / WPG_CONFIG で指定したファイルを読みます。優先順位は低い順に、組み込みの既定値、ファイル、環境変数 WPG_<SECTION>__<KEY> (__ で階層を区切る。例: WPG_SERVER__BIND=0.0.0.0:8080、WPG_TX__ALLOWED_IFACES='["eth1"]')、wpg serve --bind などのコマンドラインオプションです。未知のキーはエラーです。wpg config init で下記のコメント付きの例を書き出し、wpg config show で実効設定を表示し、wpg config validate で検査し、wpg config set-password で管理者パスワードのハッシュを保存します。管理者パスワードそのものはキーではなく、wpg serve --password、--password-file、WPG_PASSWORD が auth.password_hash、auth.password_file より優先されます。このページは設定の型から自動生成しています。
キー一覧
トップレベル
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
data_dir | string | OS のデータディレクトリ (Linux: ~/.local/share/wpg) | WPG_DATA_DIR | サーバの状態を置くディレクトリ: ユーザテンプレート、お気に入り、SQLite データベース (ユーザ、セッション、ジョブ履歴)、ドライランのキャプチャ、自己署名 TLS 証明書。 |
[auth]
認証。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
password_file | string | WPG_AUTH__PASSWORD_FILE | 管理者パスワードを書いたファイル: argon2 PHC 文字列、または起動時にハッシュする平文。 | |
password_hash | string | WPG_AUTH__PASSWORD_HASH | 管理者パスワードの argon2id PHC 文字列。wpg config set-password が書き込みます。 | |
session_ttl_secs | integer | 86400 | WPG_AUTH__SESSION_TTL_SECS | セッションの有効期間 (秒)。リクエストのたびに延長されます。 |
[dhcp]
DHCP サーバーツール(1 つのインタフェースで DHCPv4 / DHCPv6。プールとオプションは DHCP 画面で編集)。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
enabled | boolean | true | WPG_DHCP__ENABLED | DHCP 画面と /api/dhcp を有効にします。 |
iface | string | "" | WPG_DHCP__IFACE | DHCP サーバーが応答するインタフェース(例 eth1。deploy.sh --dhcp-iface で設定)。空なら画面で tx.allowed_ifaces から選びます。 |
[log]
ログ。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
ansi | boolean | true | WPG_LOG__ANSI | 端末への出力に色を付けます。 |
file | string | WPG_LOG__FILE | このファイルにも書き出します (ディレクトリは作成されます)。 | |
format | "pretty" | "json" | "pretty" | WPG_LOG__FORMAT | 行の形式: pretty (人が読む形式) または json (1 行に 1 オブジェクト)。 |
level | string | "info" | WPG_LOG__LEVEL | フィルタ指定 (RUST_LOG が優先)。例: info、wpg_tx=debug,info。 |
max_files | integer | WPG_LOG__MAX_FILES | 残すローテーション済みファイルの最大数 (古いものから削除)。 | |
rotation | "never" | "hourly" | "daily" | "never" | WPG_LOG__ROTATION | ファイルのローテーション: never、hourly、daily。 |
[protocols]
ユーザ定義プロトコル。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
dirs | string[] | [] | WPG_PROTOCOLS__DIRS | ユーザ定義プロトコルのファイル (*.yaml: 新しいプロトコル定義と既存プロトコルの下への結び付け) を置くディレクトリ。起動時にファイル名順で読み込みます。wpg serve --protocols-dir で追加できます。 |
[server]
HTTP リスナ。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
base_url | string | WPG_SERVER__BASE_URL | リバースプロキシ配下で公開する URL (https://wpg.example.net)。絶対リンクに使います。 | |
bind | string | "127.0.0.1:8080" | WPG_SERVER__BIND | 待ち受けアドレス。パスワードがなく、セットアップ画面でユーザも作っていない間は、ループバックアドレスだけを受け付けます (--allow-insecure で解除)。 |
job_history | integer | 100 | WPG_SERVER__JOB_HISTORY | メモリに保持し、ジョブ画面と API に一覧表示する終了済みジョブ数 (1–100000)。 |
job_history_db | integer | 1000 | WPG_SERVER__JOB_HISTORY_DB | データベースに残す終了済みジョブ数。古いものから削除します (1–10000000)。 |
preview_max | integer | 256 | WPG_SERVER__PREVIEW_MAX | 1 回のプレビュー (POST /api/render) で生成できる最大パケット数 (1–100000)。 |
self_signed_tls | boolean | false | WPG_SERVER__SELF_SIGNED_TLS | <data_dir>/tls/ に生成する自己署名証明書で HTTPS を提供します (次回以降も再利用)。wpg serve --tls と同じです。 |
[server.tls]
HTTPS で使う証明書チェーンと秘密鍵 (PEM)。self_signed_tls より優先します。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
cert | string | WPG_SERVER__TLS__CERT | PEM 形式の証明書チェーン。 | |
key | string | WPG_SERVER__TLS__KEY | PEM 形式の秘密鍵。 |
[snmp]
SNMP マネージャツール(Get / Walk / Set / トラップ、MIB アップロード)。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
enabled | boolean | true | WPG_SNMP__ENABLED | SNMP ツール画面と /api/snmp を有効にします。 |
mib_dir | string | "" | WPG_SNMP__MIB_DIR | アップロードした MIB ファイルのディレクトリ。空なら <data_dir>/mibs。 |
trap_listen | string | "" | WPG_SNMP__TRAP_LISTEN | 起動時からトラップ / インフォーム受信を待ち受けるアドレス(例 0.0.0.0:162。1024 未満のポートには root か CAP_NET_BIND_SERVICE が必要)。空なら起動時は受信しません(画面から開始できます)。 |
[templates]
テンプレートライブラリ。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
library_paths | string[] | ["./templates"] | WPG_TEMPLATES__LIBRARY_PATHS | 読み取り専用のテンプレートライブラリ (Git のチェックアウトなど)。*.wpg.yaml / *.wpg.json を再帰的に読み込み、ファイルが変わると再読み込みします。 |
user_dir | string | WPG_TEMPLATES__USER_DIR | GUI で作成・インポートしたテンプレートを書き込むディレクトリ。既定は <data_dir>/templates。 |
[terminal]
Web ターミナル: ログインしたユーザのためにサーバが開く SSH / Telnet セッション (Web ターミナルのガイドを参照)。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
allowed_targets | string[] | [] | WPG_TERMINAL__ALLOWED_TARGETS | セッションの接続先として許可する宛先: host、host:port、*.domain、IP アドレス、CIDR (10.0.0.0/8、[2001:db8::1]:830)。空ならすべて。 |
enabled | boolean | false | WPG_TERMINAL__ENABLED | Web ターミナルを有効にします。既定では無効です。 |
idle_timeout_secs | integer | 1800 | WPG_TERMINAL__IDLE_TIMEOUT_SECS | 入出力がこの秒数ないセッションを切断します。0 で切断しません。 |
max_sessions | integer | 8 | WPG_TERMINAL__MAX_SESSIONS | 同時に開けるセッション数の上限 (全ユーザ合計)。 |
record_sessions | boolean | true | WPG_TERMINAL__RECORD_SESSIONS | セッションログ (接続先からの出力) を <data_dir>/terminal-logs に残すことを許可します。false でサーバ側のログを無効にします。 |
[tx]
送出のポリシーと既定値。
| キー | 型 | 既定値 | 環境変数 | 説明 |
|---|---|---|---|---|
allowed_ifaces | string[] | [] | WPG_TX__ALLOWED_IFACES | ジョブが送出してよいインタフェース。空ならすべて。null バックエンドとドライランは制限しません。 |
default_backend | string | WPG_TX__DEFAULT_BACKEND | ジョブがバックエンドを指定しないときのバックエンド (null、pcapfile、afpacket、pcap、afxdp、dpdk)。未設定なら Linux は afpacket、それ以外は pcap、使えなければ null。 | |
dpdk_eal_args | string[] | [] | WPG_TX__DPDK_EAL_ARGS | dpdk バックエンドの DPDK EAL 引数 (例: ["-a", "0000:00:04.0"])。指定がなければ wpg が -l <先頭の CPU> と --in-memory を加えます。EAL はプロセスごとに最初の dpdk ジョブで 1 度だけ起動するため、変更には再起動が必要です。 |
max_rate | string | WPG_TX__MAX_RATE | ジョブが指定できる最大レート (100kpps、1Gbps)。レート指定のないジョブはこのレートで送出します。 | |
prerender_max_bytes | integer | 268435456 | WPG_TX__PRERENDER_MAX_BYTES | パケット数 × フレーム長がこのバイト数以下のストリームだけを事前生成 (送出前に全フレームを生成) し、超えるものは送出しながら生成します。0 は --plan prerender を指定しない限り事前生成しません。上限 1 TiB。wpg send --prerender-max-bytes で上書きできます。 |
prerender_max_packets | integer | 100000000 | WPG_TX__PRERENDER_MAX_PACKETS | パケット数がこの値以下のストリームだけを事前生成します。wpg send --prerender-max-packets で上書きできます。 |
ring_bytes | integer | 16777216 | WPG_TX__RING_BYTES | ワーカーごとの afpacket TX リング / afxdp UMEM のメモリ (バイト、1 MiB–1 GiB)。収まるようにリング深さを減らします。このメモリはロックされるため、大きな値では ulimit -l を引き上げてください。--ring-bytes で上書きできます。 |
設定例 (wpg config init)
有効な行はすべて組み込みの既定値と同じなので、編集するまで動作は変わりません。コメントアウトした行は省略可能なキーの例です。
# wpg.toml — Web Packet Generator configuration.
#
# Precedence (lowest first): built-in defaults < this file < environment variables
# (WPG_<SECTION>__<KEY>, e.g. WPG_SERVER__BIND=0.0.0.0:8080 or
# WPG_TX__ALLOWED_IFACES='["eth1"]') < command line options (wpg serve --bind ...).
# Unknown keys are rejected. Check a file with `wpg config validate`, print the
# effective configuration with `wpg config show`.
# Server state: user templates, favourites, job history, dry-run captures.
# Default: the OS data directory (Linux: ~/.local/share/wpg).
# data_dir = "/var/lib/wpg"
[server]
# Listen address. Without a password keep it on localhost.
bind = "127.0.0.1:8080"
# Public URL when running behind a reverse proxy.
# base_url = "https://wpg.example.net"
# Serve HTTPS with a self-signed certificate generated into <data_dir>/tls/
# (same as `wpg serve --tls`). Ignored when [server.tls] is set.
self_signed_tls = false
# Most packets one preview request may render (1-100000).
preview_max = 256
# Finished jobs listed on the Jobs screen (kept in memory, 1-100000) and kept in
# the database (1-10000000; older ones are deleted).
job_history = 100
job_history_db = 1000
# TLS certificate chain and private key (PEM) to serve HTTPS with.
# [server.tls]
# cert = "/etc/wpg/cert.pem"
# key = "/etc/wpg/key.pem"
[auth]
# Admin password. Without one (and without a user created on the first-run
# setup screen) the server only listens on localhost. Sources, highest first:
# `wpg serve --password`, `--password-file`, $WPG_PASSWORD, password_hash,
# password_file, the setup screen.
# argon2id hash of the admin password (`wpg config set-password` writes it):
# password_hash = "$argon2id$v=19$m=19456,t=2,p=1$..."
# Or a file holding the hash or the plain-text password:
# password_file = "/etc/wpg/password"
# Session lifetime in seconds (extended by every request).
session_ttl_secs = 86400
[templates]
# Read-only template libraries (Git checkouts etc.), scanned recursively for
# *.wpg.yaml / *.wpg.json and reloaded when files change.
library_paths = ["./templates"]
# Writable directory for templates created or imported in the GUI.
# Default: <data_dir>/templates
# user_dir = "/var/lib/wpg/templates"
[protocols]
# Directories of user-defined protocol files (*.yaml), loaded at startup.
# Changes need a restart.
# dirs = ["/etc/wpg/protocols.d"]
[tx]
# Interfaces jobs may send on; empty = all. The null backend and dry runs are
# not restricted.
allowed_ifaces = []
# Highest rate a job may request, e.g. "100kpps" or "1Gbps". Jobs without a rate
# are sent at this rate.
# max_rate = "100kpps"
# Backend when a job names none: null, pcapfile, afpacket, pcap, afxdp, dpdk.
# Default: afpacket on Linux, else pcap, else null.
# default_backend = "afpacket"
# DPDK EAL arguments for the dpdk backend (wpg adds "-l <first CPU>" and
# "--in-memory" unless given). EAL starts with the first dpdk job; changing them
# needs a restart.
# dpdk_eal_args = ["-a", "0000:00:04.0"]
# Streams are pre-rendered (every frame built before sending) when they have at
# most prerender_max_packets packets and packets * frame length is at most
# prerender_max_bytes (default 256 MiB, up to 1 TiB); larger ones are built on
# the fly. `wpg send --prerender-max-bytes / --prerender-max-packets` override.
prerender_max_bytes = 268435456
prerender_max_packets = 100000000
# Memory of one afpacket TX ring / afxdp UMEM per worker in bytes (1 MiB-1 GiB,
# default 16 MiB); --ring-depth is reduced to fit. Locked memory: raise
# `ulimit -l` / LimitMEMLOCK for large values.
ring_bytes = 16777216
[snmp]
# SNMP tool screen and API (Get / Walk / Set / traps, MIB upload).
enabled = true
# Trap / inform receiver started at boot, e.g. "0.0.0.0:162" (ports below 1024
# need root or CAP_NET_BIND_SERVICE). Empty: not started at boot (it can be
# started from the UI).
trap_listen = ""
# Directory of uploaded MIB files. Empty: <data_dir>/mibs
mib_dir = ""
[dhcp]
# DHCP screen and API (DHCPv4 / DHCPv6 server, Linux only). Pools and options
# are edited on the screen and kept in <data_dir>/dhcp.json.
enabled = true
# Interface the server answers on, e.g. "eth1". Empty: chosen on the screen
# among tx.allowed_ifaces. Ports 67 / 547 need root or CAP_NET_BIND_SERVICE.
iface = ""
[log]
# Filter directives (RUST_LOG overrides this), e.g. "info" or "wpg_tx=debug,info".
level = "info"
# "pretty" or "json".
format = "pretty"
# Also write to this file (its directory is created).
# file = "/var/log/wpg/wpg.log"
# Rotation of the file: "never", "hourly" or "daily".
rotation = "never"
# Keep at most this many rotated files.
# max_files = 7
# Colour the console output when it is a terminal.
ansi = true
[terminal]
enabled = false # Web terminal (SSH / Telnet)
allowed_targets = [] # "host", "host:port" or CIDR; empty = any target
record_sessions = true # keep session logs under <data_dir>/terminal-logs
idle_timeout_secs = 1800
max_sessions = 8