https://github.com/msantos/tlsexec-go
tlsexec: a minimal, UCSPI TLS inetd
https://github.com/msantos/tlsexec-go
daemontools exec inetd tls
Last synced: over 1 year ago
JSON representation
tlsexec: a minimal, UCSPI TLS inetd
- Host: GitHub
- URL: https://github.com/msantos/tlsexec-go
- Owner: msantos
- License: isc
- Created: 2022-03-07T13:18:12.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-25T11:54:09.000Z (about 2 years ago)
- Last Synced: 2025-02-13T05:30:08.842Z (over 1 year ago)
- Topics: daemontools, exec, inetd, tls
- Language: Go
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SYNOPSIS
tlsexec [*OPTION*] [*IPADDR:*]*PORT* *COMMAND* *...*
# DESCRIPTION
tlsexec: a minimal, [UCSPI](https://jdebp.uk/FGA/UCSPI.html) inetd
`tlsexec` attaches the standard input and output of a command to a
TLS socket:
* `SO_REUSEPORT`: multiple processes concurrently listen and accept data
on the same port
# EXAMPLES
Generate a self-signed cert for testing:
```
openssl req -nodes -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem \
-days 3650 -subj '/CN=example.com'
```
## echo server
```
$ tlsexec :9090 cat
$ tlsexec 127.0.0.1:9090 cat
$ tlsexec [::1]:9090 env
```
## Supervised using daemontools
An echo server allowing 3 concurrent connections:
```
service/
├── echo1
│ └── run
├── echo2
│ └── run
└── echo3
└── run
```
* service/echo1/run
```
#!/bin/sh
exec tlsexec 127.0.0.1:9090 cat
```
* service/echo2/run
```
#!/bin/sh
exec tlsexec 127.0.0.1:9090 cat
```
* service/echo3/run
```
#!/bin/sh
exec tlsexec 127.0.0.1:9090 cat
```
Then run:
```
svscan service
```
# Build
```
CGO_ENABLED=0 go build -C cmd/tlsexec -trimpath -ldflags "-w"
```
# OPTIONS
cert *string*
: Path to TLS cert file (default "cert.pem")
enable-strict-tls
: Restrict TLS protocols to TLS 1.2+ and use a reduced cipher suite for
TLS 1.2 (default true)
key *string*
: Path to TLS key file (default "key.pem")
verbose
: Display service information
# ENVIRONMENT VARIABLES
PROTO
: protocol, always set to SSL
SSLREMOTEIP
: source IPv4 or IPv6 address
SSLREMOTEPORT
: source port
SSLLOCALIP
: destination IPv4 or IPv6 address
SSLLOCALPORT
: destination port