Default variables: configuration
some of debops.stunnel default variables have more extensive configuration
than simple strings or lists, here you can find documentation and examples for
them.
stunnel_services
This is a list of stunnel tunnel connections, each one defined as a YAML
dict. Each "service" can define either one end of a connection, or both ends at
once, when used in an Ansible group. Additional parameters can also be
specified for other roles, such as firewall configuration, TCP wrappers
configuration and registering a service in /etc/services database.
stunnel parameters
These parameters are related to stunnel itself.
nameString, required. Defines a name of the tunnel, which is used as the name of the configuration file and service name in
/etc/servicesas well as daemon name in TCP wrappers.You should use only letters, numbers and a dash (
-) character. You should pick an unique name for each service, preferably unique across your entire infrastructure. Checkgetent servicesdatabase to avoid collisions with existing names.client_acceptString, optional. This parameter defines on what interface(s) and port this service will listen to for server connections. You should specify either a service port name or port number, which optional IP address on which to listen to.
By default,
stunnelbinds to IPv4 connections only, to listen to IPv6 connections as well, specify the port as:::<port>.You need to define either
client_acceptorclient_portin a service definition forstunnelto be configured correctly.client_connectString or dict or list, optional. This key defines where a
stunnelclient will connect to. It can have 3 forms:string:
'<hostname>:<port>'or'<ip address>:<port>'or'<port>'dict:
{ '<hostname>': '<port>', '<ip address>': '<port>' }list:
[ '<hostname>', '<ip address>' ]
You can can use the string format if you have only one host you want to connect, or you want to connect to a local port.
Dict format can be used to connect to multiple hosts with different ports.
List format is useful when you need to connect to multiple hosts on the same port. The port is taken automatically either from
server_acceptkey orserver_portkey, if present.client_portString, optional. This key defines the port name or port number of the
stunnelclient. It can be used by theserver_connectkey (as a list) in case thatclient_acceptis not specified, to specify the port number to which thestunnelserver should connect.You need to define either
client_portorclient_acceptin a service definition forstunnelto be configured correctly.client_optionsText block, optional. Add other options on the client side of the
stunnelconfiguration, in the form of a YAML text block.server_acceptString, optional. This parameter defines on what interface(s) and port this service will listen to for client connections. You should specify either a service port name or port number, which optional IP address on which to listen to.
By default,
stunnelbinds to IPv4 connections only, to listen to IPv6 connections as well, specify the port as:::<port>.You need to define either
server_acceptorserver_portin a service definition forstunnelto be configured correctly.server_connectString or dict or list, optional. This key defines where a
stunnelserver will connect to. It can have 3 forms:string:
'<hostname>:<port>'or'<ip address>:<port>'or'<port>'dict:
{ '<hostname>': '<port>', '<ip address>': '<port>' }list:
[ '<hostname>', '<ip address>' ]
You can can use the string format if you have only one host you want to connect, or you want to connect to a local port.
Dict format can be used to connect to multiple hosts with different ports.
List format is useful when you need to connect to multiple hosts on the same port. The port is taken automatically either from
client_acceptkey orclient_portkey, if present.server_portString, optional. This key defines the port name or port number of the
stunnelserver. It can be used by theclient_connectkey (as a list) in case thatserver_acceptis not specified, to specify the port number to which thestunnelclient should connect.You need to define either
server_portorserver_acceptin a service definition forstunnelto be configured correctly.server_optionsText block, optional. Add other options on the server side of the
stunnelconfiguration, in the form of a YAML text block.ssl_optsList, optional. SSL options for
stunnelconfiguration. Will override the defaults.
/etc/services parameters
If you want to, you can assign a user-friendly name to a client port number
(server port number is probably already present, for example 3306
= mysql). To do that, you can use debops.etc_services Ansible role,
which manages /etc/services database.
In the future the services database might be converted from the local files to a central LDAP database. Because of that it's suggested that you use unique port numbers and service names across your entire infrastructure.
portString, optional. This parameter is the port number which you want to reserve for the particular tunnel connection. Service name will be taken from the
nameparameter. Both TCP as well as UDP service name will be reserved.When you specify this parameter, the
/etc/servicessupport is activated using role dependencies. After that, you can use the service name in place of all client ports, inserver_accept,server_portandclient_connectparameters, as well as the firewall configuration (dportparameter).commentString, optional. A comment with short description will be added in the
/etc/servicesdatabase, as well as in the TCP wrappers/etc/hosts.allowfile.
ferm (iptables/ip6tables) parameters
By default, debops.stunnel role does not configure the firewall to enable
access to the server port from the outside. To do that, you can add the
parameters below to the tunnel definition. debops.ferm role will be used to
configure the iptables/ip6tables firewall using ferm.
Firewall configuration will be performed on all hosts by default. To only
configure firewall on the server hosts (stunnel clients do not require it),
look below for the enabled parameter.
typeString, optional. Enables the firewall configuration support and specifies the rule type to use. See the
debops.fermrole for available rule types. Usually,dport_acceptis the correct choice.The type of the firewall rule to use will affect the keys used, so choose the rule carefully to avoid unintended effects.
dportList, optional. Specify port numbers or service names to configure in the firewall. You can use the service name if
/etc/servicessupport has been enabled (see above).saddrList, optional. Specify list of hostnames, IP addresses or CIDR networks which are allowed to connect to specified ports. If it's not specified, no connections are allowed, unless
accept_anyparameter is enabled (see below).This list is similar to
clientlist, but they are not fully compatible.
TCP wrappers parameters
stunnel uses TCP wrappers on Debian to secure connections from remote
hosts. By default, debops.stunnel role does not configure TCP wrapper
entries in /etc/hosts.allow, but you can do that by adding the parameters
below. debops.tcpwrappers role will be used to configure
/etc/hosts.allow entries.
TCP wrappers configuration will be performed on all hosts by default. To only
configure host access on the server hosts (stunnel clients do not require
it), look below for the enabled parameter.
daemonString, optional. Enables configuration of TCP wrappers. Name of the "daemon" that TCP wrappers will allow/deny connections to. Should be the same as
nameparameter.clientList, optional. Specify list of IP addresses, CIDR networks or domain names of hosts which are allowed to connect to the
stunnelserver. If no hosts are specified, TCP wrappers will deny remote connections from anywhere unlessaccept_anyparameter is enabled (see below).This list is similar to
saddrlist, but they are not fully compatible.
Other parameters
filenameString, optional. Will influence the filename of generated configuration files in all roles, which by default is based on the
nameparameter.weightString, optional. This is a 2-digit number added at the beginning of the filename in some roles, which helps in ordering of the configuration files.
other parametersYou can add other parameters from default variables by dropping the
stunnel_prefix from the variable name. For example:stunnel_services: - name: 'tunnel' pki_realm: 'domain'