Skip to main content

tuna trigger

Start a command trigger.

Guide with examples: Trigger.

Subcommands​

CommandDescription
tuna trigger smtpTrigger command by incoming SMTP message.
tuna trigger webhookTrigger command by incoming HTTP request.

tuna trigger smtp​

Trigger command by incoming SMTP message.

The raw message is passed to the command's stdin, the envelope and headers are passed in environment variables:

TUNA_MAIL_FROM envelope sender (MAIL FROM)
TUNA_MAIL_TO envelope recipients (RCPT TO), comma separated
TUNA_MAIL_HEADER_<NAME> decoded header value, e.g. TUNA_MAIL_HEADER_SUBJECT
Usage
tuna trigger smtp [flags]
Examples
tuna trigger smtp /tmp/trigger.sh
tuna trigger smtp --listen-address 127.0.0.1:2525 /tmp/trigger.sh
FlagDescription
--api-key stringYour tuna.am api key with the tunnels:connect scope (env TUNA_API_KEY).
--cidr-allow stringReject connections that do not match the given CIDRs. Can be repeated.
--cidr-deny stringReject connections that match the given CIDRs. Can be repeated.
--listen-address stringLocal address of the SMTP server. Default: 127.0.0.1:1025.
--password stringPassword to use for authentication on SMTP server.
-p, --port stringPort for incoming connections.
--username stringUsername to use for authentication on SMTP server.

tuna trigger webhook​

Trigger command by incoming HTTP request.

The request body is passed to the command's stdin, the rest of the request is passed in environment variables:

TUNA_REQUEST_METHOD request method
TUNA_REQUEST_PATH URL path
TUNA_REQUEST_QUERY raw query string
TUNA_REQUEST_HEADER_<NAME> header value, e.g. TUNA_REQUEST_HEADER_CONTENT_TYPE
Usage
tuna trigger webhook [flags]
Examples
tuna trigger webhook /tmp/trigger.sh
FlagDescription
--api-key stringYour tuna.am api key with the tunnels:connect scope (env TUNA_API_KEY).
--cidr-allow stringReject connections that do not match the given CIDRs. Can be repeated.
--cidr-deny stringReject connections that match the given CIDRs. Can be repeated.
-p, --port stringPort for incoming connections.
--secret stringSecret to use for validation of an X-Webhook-Secret header.

Global flags work too.