feat/wip/fix: add inbounds support, fix ssh-proxy
This commit is contained in:
39 files changed
+5093
-48
No files matched your search
@@ -4,6 +4,7 @@
|
||||
imports = [
|
||||
./other.nix
|
||||
./ssh-proxy.nix
|
||||
./proxy-inbounds.nix
|
||||
./amnezia-wg.nix
|
||||
./legacy-sing-box.nix
|
||||
./sing-box.nix
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
# Server-side proxy inbound options.
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
literalExpression
|
||||
mkEnableOption
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
inboundTypes = import ./types/proxy-inbounds.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.proxyInbounds = {
|
||||
enable = mkEnableOption "server-side proxy inbounds (accept connections from outside)";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.xray;
|
||||
defaultText = literalExpression "pkgs.xray";
|
||||
example = literalExpression "pkgs.xray";
|
||||
description = ''
|
||||
XRay package serving the inbounds.
|
||||
|
||||
This is independent of proxy.xray.package: the inbound service always
|
||||
runs XRay, whichever backend the client side uses, and works with
|
||||
proxy.enable = false.
|
||||
'';
|
||||
};
|
||||
|
||||
serverAddress = mkOption {
|
||||
type = types.nullOr (types.strMatching "[^[:space:]]+");
|
||||
default = null;
|
||||
description = ''
|
||||
Public hostname or address clients connect to. Used for generated share
|
||||
links only; it does not affect what the listeners bind.
|
||||
|
||||
Leave null to detect the machine's uplink IPv4 address at service start
|
||||
time. Set it explicitly when the server is behind NAT or reached by a
|
||||
domain name.
|
||||
'';
|
||||
example = "vpn.example.com";
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Add every listener port to networking.firewall. Disable to manage the
|
||||
firewall yourself.
|
||||
'';
|
||||
example = false;
|
||||
};
|
||||
|
||||
shareLinks = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Write client share links to /run/proxy-suite-inbounds/links.json at
|
||||
service start, for `proxy-ctl inbounds link` and
|
||||
`proxy-ctl inbounds qr`.
|
||||
|
||||
The file is readable by root and the userControl group only, because
|
||||
the links carry the listener credentials.
|
||||
'';
|
||||
example = false;
|
||||
};
|
||||
|
||||
via = mkOption {
|
||||
type = types.str;
|
||||
default = "proxy";
|
||||
description = ''
|
||||
Default egress for traffic arriving on the inbounds. Individual
|
||||
listeners can override it with their own via option, which is how two
|
||||
listeners can leave through two different servers.
|
||||
|
||||
- "proxy": chain out through the local proxy stack, so the machine
|
||||
relays rather than exits. Requires proxy.enable. The inbound service
|
||||
hands traffic to the SOCKS listener on proxy.listenAddress, so it
|
||||
follows whatever the client side is currently doing: the selected
|
||||
outbound, subscriptions, urltest, and `proxy-ctl select` all apply,
|
||||
with no second copy of that machinery.
|
||||
- A proxy.outbounds tag: pin this traffic to that specific server,
|
||||
independently of what the client side has selected. The outbound is
|
||||
built into the inbound service's own config, so it must be one XRay
|
||||
can represent (a url/urlFile entry, or xrayJson). Subscription
|
||||
proxies cannot be named here, because their tags only exist at
|
||||
runtime; use "proxy" to reach those.
|
||||
- "direct": leave from this machine, making it a plain exit node. Needs
|
||||
no client-side proxy configuration at all.
|
||||
- "block": drop the traffic.
|
||||
'';
|
||||
example = "direct";
|
||||
};
|
||||
|
||||
zapretDirect = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Route zapret's hostlist domains and IPs to the direct outbound instead
|
||||
of through the proxy, so this host's own zapret unblocks them for
|
||||
inbound clients.
|
||||
|
||||
Has no effect unless zapret.enable and zapret.syncDirectRouting are on:
|
||||
the rules are built from the same hostlists that already feed
|
||||
routing.direct on the client side, so they are empty when zapret is not
|
||||
running here.
|
||||
|
||||
On by default because a zapret host is by definition inside the filtered
|
||||
network, and paying for a proxy hop to reach something zapret already
|
||||
unblocks locally is pure latency. Only applies to listeners using the
|
||||
default via; an explicit per-listener via still wins.
|
||||
'';
|
||||
example = false;
|
||||
};
|
||||
|
||||
blockRu = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Send traffic destined for Russian domains and IP ranges
|
||||
("category-ru" geosite, "ru" geoip) to the block outbound.
|
||||
|
||||
On by default: a relay whose whole point is leaving the RKN-filtered
|
||||
network has no reason to carry traffic back into it, and it keeps the
|
||||
server out of the way of domestic services that geo-check.
|
||||
'';
|
||||
example = false;
|
||||
};
|
||||
|
||||
blockPrivate = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Send traffic destined for private and loopback addresses to the block
|
||||
outbound.
|
||||
|
||||
On by default: without it, anyone holding an inbound credential can
|
||||
reach the server's LAN, its localhost services, and the local proxy
|
||||
ports of proxy-suite itself.
|
||||
'';
|
||||
example = false;
|
||||
};
|
||||
|
||||
listeners = mkOption {
|
||||
type = types.attrsOf inboundTypes.inboundType;
|
||||
default = { };
|
||||
description = ''
|
||||
Named inbound listeners. The attribute name becomes the inbound tag
|
||||
used in routing rules and in `proxy-ctl inbounds`.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
vless-reality = {
|
||||
type = "vless";
|
||||
port = 443;
|
||||
users = [ { uuidFile = "/run/secrets/proxy-inbound-uuid"; } ];
|
||||
flow = "xtls-rprx-vision";
|
||||
reality = {
|
||||
enable = true;
|
||||
dest = "www.microsoft.com:443";
|
||||
serverNames = [ "www.microsoft.com" ];
|
||||
privateKeyFile = "/run/secrets/proxy-inbound-reality-key";
|
||||
publicKey = "jNXH...";
|
||||
shortIds = [ "0123abcd" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -23,6 +23,9 @@ in
|
||||
description = ''
|
||||
Unix user for the systemd SSH proxy service. Leave unset to use
|
||||
systemd's default user.
|
||||
|
||||
OpenSSH path only: ignored when a SingBox or hybrid backend dials SSH
|
||||
natively and no separate unit is created.
|
||||
'';
|
||||
example = "proxy";
|
||||
};
|
||||
@@ -46,14 +49,24 @@ in
|
||||
listenAddress = mkOption {
|
||||
type = types.strMatching "[^[:space:]]+";
|
||||
default = "127.0.0.1";
|
||||
description = "Local address for the SSH-created SOCKS5 listener.";
|
||||
description = ''
|
||||
Local address for the SSH-created SOCKS5 listener.
|
||||
|
||||
OpenSSH path only: a SingBox or hybrid backend dials SSH natively and
|
||||
creates no local listener.
|
||||
'';
|
||||
example = "127.0.0.1";
|
||||
};
|
||||
|
||||
listenPort = mkOption {
|
||||
type = types.port;
|
||||
default = 1091;
|
||||
description = "Local port for the SSH-created SOCKS5 listener.";
|
||||
description = ''
|
||||
Local port for the SSH-created SOCKS5 listener.
|
||||
|
||||
OpenSSH path only: a SingBox or hybrid backend dials SSH natively and
|
||||
creates no local listener.
|
||||
'';
|
||||
example = 1091;
|
||||
};
|
||||
|
||||
@@ -72,10 +85,85 @@ in
|
||||
default = null;
|
||||
description = ''
|
||||
Optional runtime path to the known-hosts file passed to OpenSSH.
|
||||
|
||||
OpenSSH path only. A SingBox or hybrid backend verifies host keys with
|
||||
sshProxy.hostKey instead.
|
||||
'';
|
||||
example = "/run/secrets/proxy-suite-ssh-known-hosts";
|
||||
};
|
||||
|
||||
hostKey = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Accepted SSH host public keys, in `authorized_keys` one-line form.
|
||||
Used by the sing-box backend, which verifies host keys by value rather
|
||||
than against a known-hosts file.
|
||||
|
||||
List **every** key the server offers, not just one. The host key
|
||||
algorithm is negotiated, so pinning a single key fails the handshake
|
||||
outright whenever the server picks a different algorithm. Get the full
|
||||
set with `ssh-keyscan -p PORT HOST`, or from an existing known-hosts
|
||||
entry with `ssh-keygen -F '[HOST]:PORT'`.
|
||||
|
||||
Leaving this empty accepts **any** host key, which allows a
|
||||
machine-in-the-middle on the tunnel. Set it whenever sshProxy.asOutbound
|
||||
is used with a SingBox or hybrid backend.
|
||||
|
||||
Ignored by the XRay backend and by a standalone tunnel, which use
|
||||
knownHostsFile and strictHostKeyChecking instead.
|
||||
'';
|
||||
example = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..." ];
|
||||
};
|
||||
|
||||
hostKeyFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to a known-hosts file to read the accepted host keys from,
|
||||
instead of listing them inline in sshProxy.hostKey. Every key recorded
|
||||
there for `host:sshPort` is accepted, so a single known-hosts file stays
|
||||
the one source of truth. Hashed known-hosts files work.
|
||||
|
||||
Read when the service starts, not at evaluation time, so the file never
|
||||
enters the Nix store. Set either this or sshProxy.hostKey; if both are
|
||||
set the file wins.
|
||||
|
||||
Used by the sing-box backend. The XRay backend and a standalone tunnel
|
||||
pass knownHostsFile to OpenSSH instead.
|
||||
'';
|
||||
example = "/root/.ssh/known_hosts";
|
||||
};
|
||||
|
||||
domainStrategy = mkOption {
|
||||
type = types.nullOr (
|
||||
types.enum [
|
||||
"prefer_ipv4"
|
||||
"prefer_ipv6"
|
||||
"ipv4_only"
|
||||
"ipv6_only"
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = ''
|
||||
Resolve destination domains locally before sending them through the
|
||||
SSH SOCKS5 proxy, so the remote SSH server never has to resolve them.
|
||||
Null preserves the backend's default behavior.
|
||||
|
||||
Only applies to the XRay backend, which reaches the tunnel through the
|
||||
local SOCKS5 listener and maps this onto the outbound's
|
||||
`sockopt.domainStrategy`. SingBox and hybrid backends dial SSH natively
|
||||
and resolve destinations themselves, so this option is ignored there.
|
||||
|
||||
Note that local resolution hands the remote server an address chosen by
|
||||
*this* machine's DNS. For anycast or geo-steered CDNs that address can
|
||||
be unreachable from the remote network, which surfaces as connection
|
||||
timeouts rather than as a DNS error. Prefer fixing DNS on the remote
|
||||
server if you have access to it.
|
||||
'';
|
||||
example = "prefer_ipv4";
|
||||
};
|
||||
|
||||
strictHostKeyChecking = mkOption {
|
||||
type = types.enum [
|
||||
"yes"
|
||||
@@ -86,6 +174,9 @@ in
|
||||
description = ''
|
||||
OpenSSH host-key verification policy. Use "yes" with pinned
|
||||
knownHostsFile contents for strict verification.
|
||||
|
||||
OpenSSH path only. A SingBox or hybrid backend verifies host keys with
|
||||
sshProxy.hostKey instead.
|
||||
'';
|
||||
example = "yes";
|
||||
};
|
||||
@@ -96,6 +187,10 @@ in
|
||||
description = ''
|
||||
Additional arguments passed to OpenSSH before the destination.
|
||||
This can be used for options such as jump hosts or agent forwarding.
|
||||
|
||||
OpenSSH path only: ignored when a SingBox or hybrid backend dials SSH
|
||||
natively. Keepalive, connect-timeout and restart behavior are already
|
||||
set by the module, so they do not need to be repeated here.
|
||||
'';
|
||||
example = [
|
||||
"-o"
|
||||
@@ -107,9 +202,15 @@ in
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Add the local SSH SOCKS5 listener as a proxy-suite outbound tagged
|
||||
"ssh-proxy". Requires proxy.enable and an active SingBox or XRay
|
||||
backend.
|
||||
Add the SSH tunnel as a proxy-suite outbound tagged "ssh-proxy".
|
||||
Requires proxy.enable and an active SingBox or XRay backend.
|
||||
|
||||
How the tunnel is built depends on the backend. SingBox and hybrid
|
||||
backends dial SSH natively, with no systemd unit and no local SOCKS5
|
||||
listener. XRay has no SSH outbound, so it keeps the OpenSSH `ssh -D`
|
||||
unit and proxies through its local SOCKS5 listener. With
|
||||
asOutbound = false the OpenSSH unit is always used, since the tunnel is
|
||||
then a standalone listener the backends know nothing about.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,432 @@
|
||||
# Server-side inbound listener option type definitions.
|
||||
{ lib }:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
|
||||
userType = types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Optional label for this account. Used as the share-link fragment so
|
||||
clients show a readable server name, and as the XRay user email.
|
||||
'';
|
||||
example = "phone";
|
||||
};
|
||||
|
||||
uuid = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Literal UUID for vless/vmess accounts.
|
||||
|
||||
This value is embedded in the Nix store. Prefer uuidFile for real
|
||||
credentials.
|
||||
|
||||
Set exactly one of uuid or uuidFile for vless and vmess listeners.
|
||||
'';
|
||||
example = "b831381d-6324-4d53-ad4f-8cda48b30811";
|
||||
};
|
||||
|
||||
uuidFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to a file containing the account UUID.
|
||||
Intended for use with secret managers (sops-nix, agenix, etc.).
|
||||
The file is read at service start time and never lands in the Nix store.
|
||||
'';
|
||||
example = "/run/secrets/proxy-inbound-uuid";
|
||||
};
|
||||
|
||||
password = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Literal password for trojan, shadowsocks, socks, and http listeners.
|
||||
|
||||
This value is embedded in the Nix store. Prefer passwordFile for real
|
||||
credentials.
|
||||
'';
|
||||
example = "hunter2";
|
||||
};
|
||||
|
||||
passwordFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to a file containing the account password.
|
||||
The file is read at service start time and never lands in the Nix store.
|
||||
'';
|
||||
example = "/run/secrets/proxy-inbound-password";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
transportType = types.submodule {
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = types.enum [
|
||||
"raw"
|
||||
"ws"
|
||||
"grpc"
|
||||
"httpupgrade"
|
||||
"xhttp"
|
||||
];
|
||||
default = "raw";
|
||||
description = ''
|
||||
Stream transport for this listener. "raw" is plain TCP and is what
|
||||
REALITY setups normally use.
|
||||
'';
|
||||
example = "ws";
|
||||
};
|
||||
|
||||
path = mkOption {
|
||||
type = types.str;
|
||||
default = "/";
|
||||
description = ''
|
||||
Request path for the "ws", "httpupgrade", and "xhttp" transports.
|
||||
Ignored by the other transports.
|
||||
'';
|
||||
example = "/download";
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Expected Host header for the "ws", "httpupgrade", and "xhttp"
|
||||
transports. Leave null to accept any host.
|
||||
'';
|
||||
example = "cdn.example.com";
|
||||
};
|
||||
|
||||
mode = mkOption {
|
||||
type = types.nullOr (
|
||||
types.enum [
|
||||
"auto"
|
||||
"packet-up"
|
||||
"stream-up"
|
||||
"stream-one"
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = ''
|
||||
Transfer mode for the "xhttp" transport. Ignored by the others.
|
||||
|
||||
Leave null for XRay's own default, which lets the client choose.
|
||||
Behind an HTTP/1.1 reverse proxy, "packet-up" is the mode that works:
|
||||
"stream-one" needs a full-duplex HTTP/2 path from the client all the
|
||||
way to the listener, which a proxy speaking HTTP/1.1 upstream cannot
|
||||
provide.
|
||||
'';
|
||||
example = "packet-up";
|
||||
};
|
||||
|
||||
serviceName = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
gRPC service name for the "grpc" transport. Ignored otherwise.
|
||||
'';
|
||||
example = "GunService";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
tlsType = types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Terminate TLS on this listener. Mutually exclusive with reality.
|
||||
|
||||
Always on for trojan listeners regardless of this setting.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
certificateFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to the PEM certificate chain. Compose with
|
||||
security.acme to keep it renewed.
|
||||
'';
|
||||
example = "/var/lib/acme/example.com/fullchain.pem";
|
||||
};
|
||||
|
||||
keyFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to the PEM private key matching certificateFile.
|
||||
'';
|
||||
example = "/var/lib/acme/example.com/key.pem";
|
||||
};
|
||||
|
||||
serverName = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
SNI advertised in generated share links. Defaults to
|
||||
proxyInbounds.serverAddress when unset.
|
||||
'';
|
||||
example = "example.com";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
realityType = types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Enable REALITY on this listener. Mutually exclusive with tls.enable.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
dest = mkOption {
|
||||
type = types.str;
|
||||
default = "www.microsoft.com:443";
|
||||
description = ''
|
||||
Real TLS server that unauthenticated probes are proxied to. Must be a
|
||||
host:port that serves TLS 1.3 with HTTP/2.
|
||||
'';
|
||||
example = "www.microsoft.com:443";
|
||||
};
|
||||
|
||||
serverNames = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
SNI values accepted by this listener. These must be names the dest
|
||||
server actually serves. The first entry is used in share links.
|
||||
'';
|
||||
example = [ "www.microsoft.com" ];
|
||||
};
|
||||
|
||||
privateKeyFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to the REALITY x25519 private key, as produced by
|
||||
`xray x25519`. Read at service start time; never lands in the Nix
|
||||
store.
|
||||
'';
|
||||
example = "/run/secrets/proxy-inbound-reality-key";
|
||||
};
|
||||
|
||||
privateKey = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Literal REALITY x25519 private key.
|
||||
|
||||
This value is embedded in the Nix store. Prefer privateKeyFile.
|
||||
'';
|
||||
example = "gG1Yz...";
|
||||
};
|
||||
|
||||
publicKey = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
REALITY x25519 public key matching privateKeyFile, as printed
|
||||
alongside it by `xray x25519`. Not a secret: clients need it, and it
|
||||
is what generated share links carry as `pbk`.
|
||||
|
||||
Required when proxyInbounds.shareLinks is enabled.
|
||||
'';
|
||||
example = "jNXH...";
|
||||
};
|
||||
|
||||
shortIds = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "" ];
|
||||
description = ''
|
||||
Accepted REALITY short IDs (hex, up to 16 characters). The default
|
||||
accepts the empty short ID. The first entry is used in share links.
|
||||
'';
|
||||
example = [ "0123abcd" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
inboundType = types.submodule {
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = types.nullOr (types.enum [
|
||||
"vless"
|
||||
"vmess"
|
||||
"trojan"
|
||||
"shadowsocks"
|
||||
"socks"
|
||||
"http"
|
||||
]);
|
||||
default = null;
|
||||
description = ''
|
||||
Proxy protocol served by this listener.
|
||||
|
||||
Set exactly one of type, xrayJson, or jsonFile for each listener.
|
||||
'';
|
||||
example = "vless";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 443;
|
||||
description = ''
|
||||
Port this listener binds. Opened in the firewall automatically unless
|
||||
proxyInbounds.openFirewall is disabled.
|
||||
'';
|
||||
example = 443;
|
||||
};
|
||||
|
||||
sharePort = mkOption {
|
||||
type = types.nullOr types.port;
|
||||
default = null;
|
||||
description = ''
|
||||
Port generated share links advertise, for when clients do not reach
|
||||
this listener on the port it binds. Set it when something in front of
|
||||
it owns the public port: an nginx vhost proxying to a loopback bind,
|
||||
a container port mapping, a DNAT rule.
|
||||
|
||||
Leave null to advertise port.
|
||||
'';
|
||||
example = 443;
|
||||
};
|
||||
|
||||
listenAddress = mkOption {
|
||||
type = types.strMatching "[^[:space:]]+";
|
||||
default = "::";
|
||||
description = ''
|
||||
Address this listener binds. The default accepts both IPv4 and IPv6
|
||||
connections from anywhere.
|
||||
'';
|
||||
example = "0.0.0.0";
|
||||
};
|
||||
|
||||
via = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Egress for traffic arriving on this listener: "proxy" (out through
|
||||
the local proxy stack, following its current selection), a
|
||||
proxy.outbounds tag (pinned to that specific server), "direct" (out
|
||||
from this machine), or "block".
|
||||
|
||||
Give two listeners two different tags to have them leave through two
|
||||
different servers.
|
||||
|
||||
Leave null to inherit proxyInbounds.via.
|
||||
'';
|
||||
example = "nl-vps";
|
||||
};
|
||||
|
||||
users = mkOption {
|
||||
type = types.listOf userType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Accounts accepted by this listener. vless and vmess use uuid/uuidFile;
|
||||
trojan, shadowsocks, socks, and http use password/passwordFile.
|
||||
|
||||
A share link is generated for the first user of each listener.
|
||||
'';
|
||||
example = [ { uuidFile = "/run/secrets/proxy-inbound-uuid"; } ];
|
||||
};
|
||||
|
||||
flow = mkOption {
|
||||
type = types.nullOr (types.enum [ "xtls-rprx-vision" ]);
|
||||
default = null;
|
||||
description = ''
|
||||
VLESS flow control. "xtls-rprx-vision" is the usual pairing with
|
||||
REALITY on the "raw" transport; it is not valid over ws, grpc,
|
||||
httpupgrade, or xhttp.
|
||||
'';
|
||||
example = "xtls-rprx-vision";
|
||||
};
|
||||
|
||||
method = mkOption {
|
||||
type = types.str;
|
||||
default = "2022-blake3-aes-128-gcm";
|
||||
description = ''
|
||||
Shadowsocks cipher. Ignored by other protocols.
|
||||
|
||||
The 2022 ciphers require a base64 pre-shared key of the matching
|
||||
length as the password, not a passphrase.
|
||||
'';
|
||||
example = "aes-128-gcm";
|
||||
};
|
||||
|
||||
transport = mkOption {
|
||||
type = transportType;
|
||||
default = { };
|
||||
description = ''
|
||||
Stream transport settings for this listener.
|
||||
'';
|
||||
};
|
||||
|
||||
tls = mkOption {
|
||||
type = tlsType;
|
||||
default = { };
|
||||
description = ''
|
||||
TLS termination settings for this listener. Mutually exclusive with
|
||||
reality.
|
||||
'';
|
||||
};
|
||||
|
||||
reality = mkOption {
|
||||
type = realityType;
|
||||
default = { };
|
||||
description = ''
|
||||
REALITY settings for this listener. Mutually exclusive with tls.
|
||||
'';
|
||||
};
|
||||
|
||||
xrayJson = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
description = ''
|
||||
Raw XRay inbound configuration as a Nix attribute set, for protocols
|
||||
or options the typed fields do not cover. Embedded into the config at
|
||||
build time, so avoid putting credentials here; use jsonFile instead.
|
||||
The tag field is overridden by the listener name.
|
||||
|
||||
Set exactly one of type, xrayJson, or jsonFile for each listener.
|
||||
'';
|
||||
example = {
|
||||
protocol = "dokodemo-door";
|
||||
settings = {
|
||||
address = "127.0.0.1";
|
||||
port = 8080;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
jsonFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Runtime path to a file containing a complete XRay inbound object as
|
||||
JSON. Read at service start time, so the whole inbound including its
|
||||
credentials can be rendered by a secret manager and never lands in
|
||||
the Nix store. The tag field is overridden by the listener name.
|
||||
|
||||
No share link is generated for listeners defined this way.
|
||||
|
||||
Set exactly one of type, xrayJson, or jsonFile for each listener.
|
||||
'';
|
||||
example = "/run/secrets/proxy-inbound-vless.json";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit inboundType;
|
||||
}
|
||||
Reference in new issue
Block a user