Forwards varlink messages to remote http (https) server.
The listener is interface agnostic. The remote service is solely responsible
for implementing the appropriate varlink interfaces, including the standard
interface (org.varlink.service) used for introspection.
Usage: altlink [--cacert file] [--bearer token] remote target
Required positional arguments
remote string
Remote (http) endpoint receiving forwarded varlink messages.
target string
Socket (unix) to serve locally.
Optional arguments
--cacert string
Use the specified CA certificate, must be in PEM format.
--bearer string
Use the specified http/bearer authentication token.
Set to @ to read from BEARER environment variable.
Usage: altlink [--cacert file] [--bearer token] remote target
Required positional arguments
remote string
Remote (http) endpoint receiving forwarded varlink messages.
target string
Socket (unix) to serve locally.
Optional arguments
--cacert string
Use the specified CA certificate, must be in PEM format.
--bearer string
Use the specified http/bearer authentication token.
Set to @ to read from BEARER environment variable.
Optional arguments (experimental)
--cache
Cache requests (and responses).
--cache-entry-expire time.Duration
Cache entry expiration time (default 8s).
--cache-evict-period time.Duration
Cache eviction period (default 16s).
Features
- Listening on local unix socket and forwarding varlink messages.
- The forwarded messages are sent verbatim as application/json payloads to
remote HTTP endpoint over POST.
- Support for self-signed cerificates.
- Support for http/bearer authentication.
Examples
The examples are to be used in conjunction with the example server.
Its setup is detailed below and should be performed first.
# Start the altlink client.
./build/altlink \
--bearer 9W4qlFTUloXHCrIO --cacert example/ssl.ca/CA.crt \
https://localhost:8443/varlink /tmp/test.sock
# Probe request/reply functionality using varlinkctl (no replies)
varlinkctl call /tmp/test.sock example.Ping '' --oneway
# Probe request/reply functionality using varlinkctl (single reply)
varlinkctl call /tmp/test.sock example.Ping '{ "ping": 5 }'
# Probe request/reply functionality using varlinkctl (multiple replies)
varlinkctl call /tmp/test.sock example.Ping '{ "ping": 5 }' --more
Using the example server
The server requires deno to run.
It has no external dependencies otherwise.
# It is necessary to create the ssl certificates first.
mkdir -p example/ssl.ca example/ssl.https
openssl req -x509 \
-new -newkey rsa:4096 -days 16 -nodes \
-keyout example/ssl.ca/CA.key -out example/ssl.ca/CA.crt \
-subj "/CN=XY-CA" \
-addext "keyUsage = critical, keyCertSign, cRLSign" \
-addext "basicConstraints = critical, CA:TRUE"
openssl req \
-CA example/ssl.ca/CA.crt -CAkey example/ssl.ca/CA.key \
-newkey rsa:4096 -days 16 -nodes \
-keyout example/ssl.https/server.key -out example/ssl.https/server.crt \
-subj "/CN=XY-SERVER" \
-addext "subjectAltName=IP:127.0.0.1,DNS:localhost" \
-addext "keyUsage = critical, keyEncipherment, keyAgreement" \
-addext "basicConstraints = critical, CA:FALSE" \
-addext "extendedKeyUsage = critical, serverAuth"
# Run the server
deno --allow-net --allow-read example/server.mjs
Please note the server does not implement the org.varlink.service interface.