{
    "mode": "man",
    "parameter": "STUNNEL",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/STUNNEL/8/json",
    "generated": "2026-10-10T19:59:03Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "stunnel - TLS offloading and load-balancing proxy\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "Unix:",
                    "content": "stunnel [FILE] | -fd N | -help | -version | -sockets | -options\n"
                },
                {
                    "name": "WIN32:",
                    "content": "stunnel [ [ -install | -uninstall | -start | -stop |\n-reload | -reopen | -exit ] [-quiet] [FILE] ] |\n-help | -version | -sockets | -options\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "The  stunnel program is designed to work as TLS encryption wrapper between remote clients and\nlocal (inetd-startable) or remote servers. The concept is that having non-TLS  aware  daemons\nrunning on your system you can easily set them up to communicate with clients over secure TLS\nchannels.\n\nstunnel  can  be  used  to  add  TLS functionality to commonly used Inetd daemons like POP-2,\nPOP-3, and IMAP servers, to standalone daemons like NNTP, SMTP and HTTP, and in tunneling PPP\nover network sockets without changes to the source code.\n\nThis product includes cryptographic software written by Eric Young (eay@cryptsoft.com)\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "FILE\nUse specified configuration file\n",
            "subsections": [
                {
                    "name": "-fd N",
                    "content": "Read the config file from specified file descriptor\n"
                },
                {
                    "name": "-help",
                    "content": "Print stunnel help menu\n"
                },
                {
                    "name": "-version",
                    "content": "Print stunnel version and compile time defaults\n"
                },
                {
                    "name": "-sockets",
                    "content": "Print default socket options\n"
                },
                {
                    "name": "-options",
                    "content": "Print supported TLS options\n"
                },
                {
                    "name": "-install",
                    "content": "Install NT Service\n"
                },
                {
                    "name": "-uninstall",
                    "content": "Uninstall NT Service\n"
                },
                {
                    "name": "-start",
                    "content": "Start NT Service\n"
                },
                {
                    "name": "-stop",
                    "content": "Stop NT Service\n"
                },
                {
                    "name": "-reload",
                    "content": "Reload the configuration file of the running NT Service\n"
                },
                {
                    "name": "-reopen",
                    "content": "Reopen the log file of the running NT Service\n"
                },
                {
                    "name": "-exit",
                    "content": "Exit an already started stunnel\n"
                },
                {
                    "name": "-quiet",
                    "content": "Don't display any message boxes\n"
                }
            ]
        },
        "CONFIGURATION FILE": {
            "content": "Each line of the configuration file can be either:\n\n•   An empty line (ignored).\n\n•   A comment starting with ';' (ignored).\n\n•   An 'optionname = optionvalue' pair.\n\n•   '[servicename]' indicating a start of a service definition.\n\nAn address parameter of an option may be either:\n\n•   A port number.\n\n•   A colon-separated pair of IP address (either IPv4, IPv6, or domain name) and port number.\n\n•   A Unix socket path (Unix only).\n\nGLOBAL OPTIONS\nchroot = DIRECTORY (Unix only)\ndirectory to chroot stunnel process\n\nchroot keeps stunnel in a chrooted jail.  CApath,  CRLpath,  pid  and  exec  are  located\ninside  the  jail  and  the  patches  have to be relative to the directory specified with\nchroot.\n\nSeveral functions of the operating system also need their files to be located within  the\nchroot jail, e.g.:\n\n•   Delayed resolver typically needs /etc/nsswitch.conf and /etc/resolv.conf.\n\n•   Local time in log files needs /etc/timezone.\n\n•   Some other functions may need devices, e.g. /dev/zero or /dev/null.\n\ncompression = deflate | zlib\nselect data compression algorithm\n\ndefault: no compression\n\nDeflate is the standard compression method as described in RFC 1951.\n\ndebug = [FACILITY.]LEVEL\ndebugging level\n\nLevel  is  one  of  the syslog level names or numbers emerg (0), alert (1), crit (2), err\n(3), warning (4), notice (5), info (6), or debug (7).  All logs for the  specified  level\nand all levels numerically less than it will be shown.\n\nThe debug = debug (or the equivalent <debug = 7>) level produces for the most verbose log\noutput.  This logging level is only meant to be understood by stunnel developers, and not\nby  users.   Please  either  use  the  debug  level when requested to do so by an stunnel\ndeveloper, or when you intend to get confused.\n\nThe default logging level is notice (5).\n\nThe  syslog  'daemon'  facility  will  be  used  unless  a  facility  name  is  supplied.\n(Facilities are not supported on Win32.)\n\nCase is ignored for both facilities and levels.\n\nEGD = EGDPATH (Unix only)\npath to Entropy Gathering Daemon socket\n\nEntropy Gathering Daemon socket to use to feed the OpenSSL random number generator.\n\nengine = auto | ENGINEID\nselect hardware or software cryptographic engine\n\ndefault: software-only cryptography\n\nSee  Examples  section  for  an  engine  configuration  to  use  the  certificate and the\ncorresponding private key from a cryptographic device.\n\nengineCtrl = COMMAND[:PARAMETER]\ncontrol hardware engine\n\nengineDefault = TASKLIST\nset OpenSSL tasks delegated to the current engine\n\nThe parameter specifies a comma-separated list of task to be  delegated  to  the  current\nengine.\n\nThe  following  tasks  may be available, if supported by the engine: ALL, RSA, DSA, ECDH,\nECDSA, DH, RAND, CIPHERS, DIGESTS, PKEY, PKEYCRYPTO, PKEYASN1.\n\nfips = yes | no\nenable or disable FIPS 140-2 mode.\n\nThis option allows you to disable entering FIPS mode if stunnel was  compiled  with  FIPS\n140-2 support.\n\ndefault: no (since version 5.00)\n\nforeground = yes | quiet | no (Unix only)\nforeground mode\n\nStay in foreground (don't fork).\n\nWith  the  yes parameter it also logs to stderr in addition to the destinations specified\nwith syslog and output.\n\ndefault: background in daemon mode\n\niconActive = ICONFILE (GUI only)\nGUI icon to be displayed when there are established connections\n\nOn Windows platform the parameter should be an .ico file containing a 16x16 pixel image.\n\niconError = ICONFILE (GUI only)\nGUI icon to be displayed when no valid configuration is loaded\n\nOn Windows platform the parameter should be an .ico file containing a 16x16 pixel image.\n\niconIdle = ICONFILE (GUI only)\nGUI icon to be displayed when there are no established connections\n\nOn Windows platform the parameter should be an .ico file containing a 16x16 pixel image.\n\nlog = append | overwrite\nlog file handling\n\nThis option allows you to choose whether the log file (specified with the output  option)\nis appended or overwritten when opened or re-opened.\n\ndefault: append\n\noutput = FILE\nappend log messages to a file\n\n/dev/stdout  device  can be used to send log messages to the standard output (for example\nto log them with daemontools splogger).\n\npid = FILE (Unix only)\npid file location\n\nIf the argument is empty, then no pid file will be created.\n\npid path is relative to the chroot directory if specified.\n\nRNDbytes = BYTES\nbytes to read from random seed files\n\nRNDfile = FILE\npath to file with random seed data\n\nThe OpenSSL library will use data  from  this  file  first  to  seed  the  random  number\ngenerator.\n\nRNDoverwrite = yes | no\noverwrite the random seed files with new random data\n\ndefault: yes\n\nservice = SERVICE (Unix only)\nstunnel service name\n\nThe  specified service name is used for syslog and as the inetd mode service name for TCP\nWrappers.  While this option can technically be specified in the service sections, it  is\nonly useful in global options.\n\ndefault: stunnel\n\nsyslog = yes | no (Unix only)\nenable logging via syslog\n\ndefault: yes\n\ntaskbar = yes | no (WIN32 only)\nenable the taskbar icon\n\ndefault: yes\n\nSERVICE-LEVEL OPTIONS\nEach  configuration  section begins with a service name in square brackets.  The service name\nis used for libwrap (TCP Wrappers) access control and lets you distinguish  stunnel  services\nin your log files.\n\nNote  that if you wish to run stunnel in inetd mode (where it is provided a network socket by\na server such as inetd, xinetd, or tcpserver) then you should read the section entitled INETD\nMODE below.\n\naccept = [HOST:]PORT\naccept connections on specified address\n\nIf no host specified, defaults to all IPv4 addresses for the local host.\n\nTo listen on all IPv6 addresses use:\n\naccept = :::PORT\n\nCAengine = ENGINE-SPECIFICCACERTIFICATEIDENTIFIER\nload a trusted CA certificate from an engine\n\nThe loaded CA certificates will be used with the verifyChain and verifyPeer options.\n\nMultiple CAengine options are allowed in a single service section.\n\nCurrently supported engines: pkcs11, cng.\n\nCApath = CADIRECTORY\nload trusted CA certificates from a directory\n\nThe loaded CA certificates will be used with  the  verifyChain  and  verifyPeer  options.\nNote that the certificates in this directory should be named XXXXXXXX.0 where XXXXXXXX is\nthe hash value of the DER encoded subject of the cert.\n\nThe  hash  algorithm  has  been changed in OpenSSL 1.0.0.  It is required to crehash the\ndirectory on upgrade from OpenSSL 0.x.x to OpenSSL 1.x.x or later.\n\nCApath path is relative to the chroot directory if specified.\n\nCAfile = CAFILE\nload trusted CA certificates from a file\n\nThe loaded CA certificates will be used with the verifyChain and verifyPeer options.\n\ncert = CERTFILE\ncertificate chain file name\n\nThe parameter specifies the file containing certificates used by stunnel to  authenticate\nitself  against  the  remote  client  or  server.   The  file  should  contain  the whole\ncertificate chain starting from the actual server/client certificate, and ending with the\nself-signed root CA certificate.  The file must be either in PEM or P12 format.\n\nA certificate chain is required in server mode, and optional in client mode.\n\nThis parameter is also used as the certificate  identifier  when  a  hardware  engine  is\nenabled.\n\ncheckEmail = EMAIL\nverify the email address of the end-entity (leaf) peer certificate subject\n\nCertificates  are  accepted  if no subject checks were specified, or the email address of\nthe end-entity (leaf) peer certificate matches any of the email addresses specified  with\ncheckEmail.\n\nMultiple checkEmail options are allowed in a single service section.\n\nThis option requires OpenSSL 1.0.2 or later.\n\ncheckHost = HOST\nverify the host of the end-entity (leaf) peer certificate subject\n\nCertificates  are  accepted  if no subject checks were specified, or the host name of the\nend-entity (leaf) peer certificate matches any of the hosts specified with checkHost.\n\nMultiple checkHost options are allowed in a single service section.\n\nThis option requires OpenSSL 1.0.2 or later.\n\ncheckIP = IP\nverify the IP address of the end-entity (leaf) peer certificate subject\n\nCertificates are accepted if no subject checks were specified, or the IP address  of  the\nend-entity  (leaf)  peer  certificate  matches  any  of  the  IP addresses specified with\ncheckIP.\n\nMultiple checkIP options are allowed in a single service section.\n\nThis option requires OpenSSL 1.0.2 or later.\n\nciphers = CIPHERLIST\nselect permitted TLS ciphers (TLSv1.2 and below)\n\nThis option does not impact TLSv1.3 ciphersuites.\n\nA colon-delimited list of the ciphers  to  allow  in  the  TLS  connection,  for  example\nDES-CBC3-SHA:IDEA-CBC-MD5.\n\nciphersuites = CIPHERSUITESLIST\nselect permitted TLSv1.3 ciphersuites\n\nA colon-delimited list of TLSv1.3 ciphersuites names in order of preference.\n\nThis option requires OpenSSL 1.1.1 or later.\n\ndefault: TLSCHACHA20POLY1305SHA256:TLSAES256GCMSHA384:TLSAES128GCMSHA256\n\nclient = yes | no\nclient mode (remote service uses TLS)\n\ndefault: no (server mode)\n\nconfig = COMMAND[:PARAMETER]\nOpenSSL configuration command\n\nThe  OpenSSL configuration command is executed with the specified parameter.  This allows\nany configuration commands to be invoked from the stunnel configuration file.   Supported\ncommands are described on the SSLCONFcmd(3ssl) manual page.\n\nSeveral config lines can be used to specify multiple configuration commands.\n\nUse  curves  option  instead  of enabling config = Curves:listcurves to support elliptic\ncurves.\n\nThis option requires OpenSSL 1.0.2 or later.\n\nconnect = [HOST:]PORT\nconnect to a remote address\n\nIf no host is specified, the host defaults to localhost.\n\nMultiple connect options are allowed in a single service section.  If  host  resolves  to\nmultiple  addresses  and/or  if  multiple  connect options are specified, then the remote\naddress is chosen using a round-robin algorithm.\n\nCRLpath = DIRECTORY\nCertificate Revocation Lists directory\n\nThis is the directory in which stunnel will look for CRLs when using the verifyChain  and\nverifyPeer  options.  Note  that  the  CRLs in this directory should be named XXXXXXXX.r0\nwhere XXXXXXXX is the hash value of the CRL.\n\nThe hash algorithm has been changed in OpenSSL 1.0.0.  It is  required  to  crehash  the\ndirectory on upgrade from OpenSSL 0.x.x to OpenSSL 1.x.x.\n\nCRLpath path is relative to the chroot directory if specified.\n\nCRLfile = CRLFILE\nCertificate Revocation Lists file\n\nThis file contains multiple CRLs, used with the verifyChain and verifyPeer options.\n\ncurves = list\nECDH curves separated with ':'\n\nOnly a single curve name is allowed for OpenSSL older than 1.1.1.\n\nTo get a list of supported curves use:\n\nopenssl ecparam -listcurves\n\ndefault:\n\nX25519:P-256:X448:P-521:P-384 (OpenSSL 1.1.1 or later)\n\nprime256v1 (OpenSSL older than 1.1.1)\n\nlogId = TYPE\nconnection identifier type\n\nThis  identifier  allows  you  to  distinguish  log  entries  generated  for  each of the\nconnections.\n\nCurrently supported types:\n\nsequential\nThe numeric sequential identifier is only unique within a single instance of stunnel,\nbut very compact.  It is most useful for manual log analysis.\n\nunique\nThis alphanumeric identifier is globally  unique,  but  longer  than  the  sequential\nnumber.  It is most useful for automated log analysis.\n\nthread\nThe  operating  system  thread  identifier  is  neither  unique (even within a single\ninstance of stunnel) nor  short.   It  is  most  useful  for  debugging  software  or\nconfiguration issues.\n\nprocess\nThe operating system process identifier (PID) may be useful in the inetd mode.\n\ndefault: sequential\n\ndebug = LEVEL\ndebugging level\n\nLevel  is  a one of the syslog level names or numbers emerg (0), alert (1), crit (2), err\n(3), warning (4), notice (5), info (6), or debug (7).  All logs for the  specified  level\nand all levels numerically less than it will be shown.  The default is notice (5).\n\nWhile  the debug = debug or debug = 7 level generates the most verbose output, it is only\nintended to be used by stunnel developers.  Please only use  this  value  if  you  are  a\ndeveloper,  or  you  intend  to  send your logs to our technical support.  Otherwise, the\ngenerated logs will be confusing.\n\ndelay = yes | no\ndelay DNS lookup for the connect option\n\nThis option is useful for dynamic DNS, or  when  DNS  is  not  available  during  stunnel\nstartup (road warrior VPN, dial-up configurations).\n\nDelayed  resolver  mode is automatically engaged when stunnel fails to resolve on startup\nany of the connect targets for a service.\n\nDelayed resolver inflicts failover = prio.\n\ndefault: no\n\nengineId = ENGINEID\nselect engine ID for the service\n\nengineNum = ENGINENUMBER\nselect engine number for the service\n\nThe engines are numbered starting from 1.\n\nexec = EXECUTABLEPATH\nexecute a local inetd-type program\n\nexec path is relative to the chroot directory if specified.\n\nThe  following  environmental  variables  are  set  on   Unix   platforms:   REMOTEHOST,\nREMOTEPORT, SSLCLIENTDN, SSLCLIENTIDN.\n\nexecArgs = $0 $1 $2 ...\narguments for exec including the program name ($0)\n\nQuoting  is currently not supported.  Arguments are separated with an arbitrary amount of\nwhitespace.\n\nfailover = rr | prio\nFailover strategy for multiple \"connect\" targets.\n\nrr  round robin - fair load distribution\n\nprio\npriority - use the order specified in config file\n\ndefault: prio\n\nident = USERNAME\nuse IDENT (RFC 1413) username checking\n\ninclude = DIRECTORY\ninclude all configuration file parts located in DIRECTORY\n\nThe files  are  included  in  the  ascending  alphabetical  order  of  their  names.  The\nrecommended filename convention is\n\nfor global options:\n\n00-global.conf\n\nfor local service-level options:\n\n01-service.conf\n\n02-service.conf\n\nkey = KEYFILE\nprivate key for the certificate specified with cert option\n\nA private key is needed to authenticate the certificate owner.  Since this file should be\nkept  secret  it  should  only be readable by its owner.  On Unix systems you can use the\nfollowing command:\n\nchmod 600 keyfile\n\nThis parameter is also used as the private key  identifier  when  a  hardware  engine  is\nenabled.\n\ndefault: the value of the cert option\n\nlibwrap = yes | no\nEnable or disable the use of /etc/hosts.allow and /etc/hosts.deny.\n\ndefault: no (since version 5.00)\n\nlocal = HOST\nBy  default,  the  IP  address of the outgoing interface is used as the source for remote\nconnections.  Use this option to bind a static local IP address instead.\n\nOCSP = URL\nselect OCSP responder for the end-entity (leaf) peer certificate verification\n\nOCSPaia = yes | no\nvalidate certificates with their AIA OCSP responders\n\nThis option enables stunnel to validate certificates with the list of OCSP responder URLs\nretrieved from their AIA (Authority Information Access) extension.\n\nOCSPflag = OCSPFLAG\nspecify OCSP responder flag\n\nSeveral OCSPflag can be used to specify multiple flags.\n\ncurrently supported flags: NOCERTS,  NOINTERN,  NOSIGS,  NOCHAIN,  NOVERIFY,  NOEXPLICIT,\nNOCASIGN, NODELEGATED, NOCHECKS, TRUSTOTHER, RESPIDKEY, NOTIME\n\nOCSPnonce = yes | no\nsend and verify the OCSP nonce extension\n\nThis  option protects the OCSP protocol against replay attacks.  Due to its computational\noverhead, the nonce extension is usually only  supported  on  internal  (e.g.  corporate)\nresponders, and not on public OCSP responders.\n\nOCSPrequire = yes | no\nrequire a conclusive OCSP response\n\nDisable  this  option  to  allow a connection even though no conclusive OCSP response was\nretrieved from stapling and a direct request to the OCSP responder.\n\ndefault: yes\n\noptions = SSLOPTIONS\nOpenSSL library options\n\nThe parameter is the OpenSSL option name as described  in  the  SSLCTXsetoptions(3ssl)\nmanual,  but  without  SSLOP  prefix.   stunnel  -options lists the options found to be\nallowed in the current combination of stunnel and the OpenSSL library used to build it.\n\nSeveral option lines can be used to specify multiple options.   An  option  name  can  be\nprepended with a dash (\"-\") to disable the option.\n\nFor  example,  for  compatibility  with  the  erroneous  Eudora  TLS  implementation, the\nfollowing option can be used:\n\noptions = DONTINSERTEMPTYFRAGMENTS\n\ndefault:\n\noptions = NOSSLv2\noptions = NOSSLv3\n\nUse sslVersionMax or sslVersionMin option instead  of  disabling  specific  TLS  protocol\nversions when compiled with OpenSSL 1.1.0 or later.\n\nprotocol = PROTO\napplication protocol to negotiate TLS\n\nThis  option  enables  initial, protocol-specific negotiation of the TLS encryption.  The\nprotocol option should not be used with TLS encryption on a separate port.\n\nCurrently supported protocols:\n\ncifs\nProprietary (undocummented) extension of CIFS protocol implemented in Samba.  Support\nfor this extension was dropped in Samba 3.0.0.\n\ncapwin\nhttp://www.capwin.org/ application support\n\ncapwinctrl\nhttp://www.capwin.org/ application support\n\nThis protocol is only supported in client mode.\n\nconnect\nBased on RFC 2817 - Upgrading to TLS Within HTTP/1.1,  section  5.2  -  Requesting  a\nTunnel with CONNECT\n\nThis protocol is only supported in client mode.\n\nimap\nBased on RFC 2595 - Using TLS with IMAP, POP3 and ACAP\n\nldap\nBased  on  RFC  2830  -  Lightweight  Directory  Access  Protocol (v3): Extension for\nTransport Layer Security\n\nnntp\nBased on RFC 4642 - Using Transport Layer Security (TLS) with Network  News  Transfer\nProtocol (NNTP)\n\nThis protocol is only supported in client mode.\n\npgsql\nBased on http://www.postgresql.org/docs/8.3/static/protocol-flow.html#AEN73982\n\npop3\nBased on RFC 2449 - POP3 Extension Mechanism\n\nproxy\nPassing  of  the  original  client  IP  address with HAProxy PROXY protocol version 1\nhttps://www.haproxy.org/download/1.8/doc/proxy-protocol.txt\n\nsmtp\nBased on RFC 2487 - SMTP Service Extension for Secure SMTP over TLS\n\nsocks\nSOCKS versions 4, 4a, and 5 are supported.  The SOCKS protocol itself is encapsulated\nwithin TLS encryption layer to protect the final destination address.\n\nhttp://www.openssh.com/txt/socks4.protocol\n\nhttp://www.openssh.com/txt/socks4a.protocol\n\nThe BIND command of the SOCKS protocol is not supported.   The  USERID  parameter  is\nignored.\n\nSee  Examples  section  for  sample  configuration  files  for  VPN  based  on  SOCKS\nencryption.\n\nprotocolAuthentication = AUTHENTICATION\nauthentication type for the protocol negotiations\n\nCurrently, this option  is  only  supported  in  the  client-side  'connect'  and  'smtp'\nprotocols.\n\nSupported  authentication  types  for  the 'connect' protocol are 'basic' or 'ntlm'.  The\ndefault 'connect' authentication type is 'basic'.\n\nSupported authentication types for the 'smtp'  protocol  are  'plain'  or  'login'.   The\ndefault 'smtp' authentication type is 'plain'.\n\nprotocolDomain = DOMAIN\ndomain for the protocol negotiations\n\nCurrently, this option is only supported in the client-side 'connect' protocol.\n\nprotocolHeader = HEADER\nheader for the protocol negotiations\n\nCurrently, this option is only supported in the client-side 'connect' protocol.\n\nprotocolHost = ADDRESS\nhost address for the protocol negotiations\n\nFor  the  'connect'  protocol negotiations, protocolHost specifies HOST:PORT of the final\nTLS server to be connected to by the proxy.   The  proxy  server  directly  connected  by\nstunnel must be specified with the connect option.\n\nFor  the  'smtp'  protocol  negotiations, protocolHost controls the client SMTP HELO/EHLO\nvalue.\n\nprotocolPassword = PASSWORD\npassword for the protocol negotiations\n\nCurrently, this option  is  only  supported  in  the  client-side  'connect'  and  'smtp'\nprotocols.\n\nprotocolUsername = USERNAME\nusername for the protocol negotiations\n\nCurrently,  this  option  is  only  supported  in  the  client-side  'connect' and 'smtp'\nprotocols.\n\nPSKidentity = IDENTITY\nPSK identity for the PSK client\n\nPSKidentity can be  used  on  stunnel  clients  to  select  the  PSK  identity  used  for\nauthentication.  This option is ignored in server sections.\n\ndefault: the first identity specified in the PSKsecrets file.\n\nPSKsecrets = FILE\nfile with PSK identities and corresponding keys\n\nEach line of the file in the following format:\n\nIDENTITY:KEY\n\nHexadecimal  keys are automatically converted to binary form.  Keys are required to be at\nleast 16 bytes long, which implies at least 32 characters for hexadecimal keys.  The file\nshould neither be world-readable nor world-writable.\n\npty = yes | no (Unix only)\nallocate a pseudoterminal for 'exec' option\n\nredirect = [HOST:]PORT\nredirect TLS client connections on certificate-based authentication failures\n\nThis option only works in server mode.  Some protocol negotiations are also  incompatible\nwith the redirect option.\n\nrenegotiation = yes | no\nsupport TLS renegotiation\n\nApplications of the TLS renegotiation include some authentication scenarios, or re-keying\nlong lasting connections.\n\nOn the other hand this feature can facilitate a trivial CPU-exhaustion DoS attack:\n\nhttp://vincent.bernat.im/en/blog/2011-ssl-dos-mitigation.html\n\nPlease note that disabling TLS renegotiation does not fully mitigate this issue.\n\ndefault: yes (if supported by OpenSSL)\n\nreset = yes | no\nattempt to use the TCP RST flag to indicate an error\n\nThis option is not supported on some platforms.\n\ndefault: yes\n\nretry = yes | no | DELAY\nreconnect a connect+exec section after it was disconnected\n\nThe  DELAY value specifies the number of milliseconds before retrying.  \"retry = yes\" has\nthe same effect as \"retry = 1000\".\n\ndefault: no\n\nsecurityLevel = LEVEL\nset the security level\n\nThe meaning of each level is described below:\n\nlevel 0\nEverything is permitted.\n\nlevel 1\nThe security level corresponds to a minimum of 80 bits of  security.  Any  parameters\noffering  below  80  bits  of security are excluded. As a result RSA, DSA and DH keys\nshorter than 1024 bits and ECC keys shorter than 160 bits are prohibited. All  export\ncipher  suites are prohibited since they all offer less than 80 bits of security. SSL\nversion 2 is prohibited. Any cipher suite using MD5 for the MAC is also prohibited.\n\nlevel 2\nSecurity level set to 112 bits of security. As a result RSA, DSA and DH keys  shorter\nthan  2048 bits and ECC keys shorter than 224 bits are prohibited. In addition to the\nlevel 1 exclusions any cipher suite using RC4 is also prohibited. SSL  version  3  is\nalso not allowed. Compression is disabled.\n\nlevel 3\nSecurity  level set to 128 bits of security. As a result RSA, DSA and DH keys shorter\nthan 3072 bits and ECC keys shorter than 256 bits are prohibited. In addition to  the\nlevel  2  exclusions  cipher  suites not offering forward secrecy are prohibited. TLS\nversions below 1.1 are not permitted. Session tickets are disabled.\n\nlevel 4\nSecurity level set to 192 bits of security. As a result RSA, DSA and DH keys  shorter\nthan  7680  bits  and  ECC  keys shorter than 384 bits are prohibited.  Cipher suites\nusing SHA1 for the MAC are prohibited. TLS versions below 1.2 are not permitted.\n\nlevel 5\nSecurity level set to 256 bits of security. As a result RSA, DSA and DH keys  shorter\nthan 15360 bits and ECC keys shorter than 512 bits are prohibited.\n\ndefault: 2\n\nThe securityLevel option is only available when compiled with OpenSSL 1.1.0 and later.\n\nrequireCert = yes | no\nrequire a client certificate for verifyChain or verifyPeer\n\nWith  requireCert  set  to no, the stunnel server accepts client connections that did not\npresent a certificate.\n\nBoth verifyChain = yes and verifyPeer = yes imply requireCert = yes.\n\ndefault: no\n\nsetgid = GROUP (Unix only)\nUnix group id\n\nAs a global option: setgid() to the specified group in daemon mode and  clear  all  other\ngroups.\n\nAs a service-level option: set the group of the Unix socket specified with \"accept\".\n\nsetuid = USER (Unix only)\nUnix user id\n\nAs a global option: setuid() to the specified user in daemon mode.\n\nAs a service-level option: set the owner of the Unix socket specified with \"accept\".\n\nsessionCacheSize = NUMENTRIES\nsession cache size\n\nsessionCacheSize specifies the maximum number of the internal session cache entries.\n\nThe  value of 0 can be used for unlimited size.  It is not recommended for production use\ndue to the risk of a memory exhaustion DoS attack.\n\nsessionCacheTimeout = TIMEOUT\nsession cache timeout\n\nThis is the number of seconds to keep cached TLS sessions.\n\nsessionResume = yes | no\nallow or disallow session resumption\n\ndefault: yes\n\nsessiond = HOST:PORT\naddress of sessiond TLS cache server\n\nsni = SERVICENAME:SERVERNAMEPATTERN (server mode)\nUse the service as a secondary service (a name-based  virtual  server)  for  Server  Name\nIndication TLS extension (RFC 3546).\n\nSERVICENAME  specifies  the  primary  service  that  accepts client connections with the\naccept option.  SERVERNAMEPATTERN specifies  the  host  name  to  be  redirected.   The\npattern  may  start  with  the  '*' character, e.g.  '*.example.com'.  Multiple secondary\nservices are normally specified for a single primary service.  The sni option can also be\nspecified more than once within a single secondary service.\n\nThis service, as well as the primary service, may not be configured in client mode.\n\nThe connect option of the secondary service  is  ignored  when  the  protocol  option  is\nspecified, as protocol connects to the remote host before TLS handshake.\n\nLibwrap  checks  (Unix only) are performed twice: with the primary service name after TCP\nconnection is accepted, and with the secondary service name during the TLS handshake.\n\nThe sni option is only available when compiled with OpenSSL 1.0.0 and later.\n\nsni = SERVERNAME (client mode)\nUse the parameter as the value of TLS Server Name Indication (RFC 3546) extension.\n\nEmpty SERVERNAME disables sending the SNI extension.\n\nThe sni option is only available when compiled with OpenSSL 1.0.0 and later.\n\nsocket = a|l|r:OPTION=VALUE[:VALUE]\nSet an option on the accept/local/remote socket\n\nThe values for the linger option are  lonof:llinger.   The  values  for  the  time  are\ntvsec:tvusec.\n\nExamples:\n\nsocket = l:SOLINGER=1:60\nset one minute timeout for closing local socket\nsocket = r:SOOOBINLINE=yes\nplace out-of-band data directly into the\nreceive data stream for remote sockets\nsocket = a:SOREUSEADDR=no\ndisable address reuse (enabled by default)\nsocket = a:SOBINDTODEVICE=lo\nonly accept connections on loopback interface\n\nsslVersion = SSLVERSION\nselect the TLS protocol version\n\nSupported versions: all, SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3\n\nAvailability of specific protocols depends on the linked OpenSSL library.  Older versions\nof OpenSSL do not support TLSv1.1, TLSv1.2 and TLSv1.3.  Newer versions of OpenSSL do not\nsupport SSLv2.\n\nObsolete SSLv2 and SSLv3 are currently disabled by default.\n\nSetting the option\n\nsslVersion = SSLVERSION\n\nis equivalent to options\n\nsslVersionMax = SSLVERSION\nsslVersionMin = SSLVERSION\n\nwhen compiled with OpenSSL 1.1.0 and later.\n\nsslVersionMax = SSLVERSION\nmaximum supported protocol versions\n\nSupported versions: all, SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3\n\nall  enable  protocol  versions up to the highest version supported by the linked OpenSSL\nlibrary.\n\nAvailability of specific protocols depends on the linked OpenSSL library.\n\nThe sslVersionMax option is only available when compiled with OpenSSL 1.1.0 and later.\n\ndefault: all\n\nsslVersionMin = SSLVERSION\nminimum supported protocol versions\n\nSupported versions: all, SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3\n\nall enable protocol versions down to the lowest version supported by the  linked  OpenSSL\nlibrary.\n\nAvailability of specific protocols depends on the linked OpenSSL library.\n\nThe sslVersionMin option is only available when compiled with OpenSSL 1.1.0 and later.\n\ndefault: TLSv1\n\nstack = BYTES (except for FORK model)\nCPU stack size of created threads\n\nExcessive  thread  stack  size increases virtual memory usage.  Insufficient thread stack\nsize may cause application crashes.\n\ndefault: 65536 bytes (sufficient for all platforms we tested)\n\nticketKeySecret = SECRET\nhexadecimal symmetric key used for session ticket confidentiality protection\n\nSession tickets defined in RFC 5077 provide an enhanced  session  resumption  capability,\nwhere the server-side caching is not required to maintain per session state.\n\nCombining  ticketKeySecret  and  ticketMacSecret  options  allow  to  resume a negotiated\nsession on other cluster nodes, or to resume a negotiated session after server restart.\n\nThe key is required to be either 16 or 32 bytes long, which  implies  exactly  32  or  64\nhexadecimal  digits.   Colons  may  optionally  be used between two-character hexadecimal\nbytes.\n\nThis option only works in server mode.\n\nThe ticketKeySecret option is only available when compiled with OpenSSL 1.0.0 and later.\n\nDisabling NOTICKET option is required for the  ticket  support  in  OpenSSL  older  than\n1.1.1, but note that this option is incompatible with the redirect option.\n\nticketMacSecret = SECRET\nhexadecimal symmetric key used for session ticket integrity protection\n\nThe  key  is  required  to  be either 16 or 32 bytes long, which implies exactly 32 or 64\nhexadecimal digits.  Colons may optionally  be  used  between  two-character  hexadecimal\nbytes.\n\nThis option only works in server mode.\n\nThe ticketMacSecret option is only available when compiled with OpenSSL 1.0.0 and later.\n\nTIMEOUTbusy = SECONDS\ntime to wait for expected data\n\nTIMEOUTclose = SECONDS\ntime to wait for closenotify (set to 0 for buggy MSIE)\n\nTIMEOUTconnect = SECONDS\ntime to wait to connect a remote host\n\nTIMEOUTidle = SECONDS\ntime to keep an idle connection\n\nTIMEOUTocsp = SECONDS\ntime to wait to connect an OCSP responder\n\ntransparent = none | source | destination | both (Unix only)\nenable transparent proxy support on selected platforms\n\nSupported values:\n\nnone\nDisable transparent proxy support.  This is the default.\n\nsource\nRe-write  the  address  to  appear  as if a wrapped daemon is connecting from the TLS\nclient machine instead of the machine running stunnel.\n\nThis option is currently available in:\n\nRemote mode (connect option) on Linux >=2.6.28\nThis configuration requires stunnel to be executed as root and without the setuid\noption.\n\nThis  configuration  requires  the  following  setup  for  iptables  and  routing\n(possibly in /etc/rc.local or equivalent file):\n\niptables -t mangle -N DIVERT\niptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT\niptables -t mangle -A DIVERT -j MARK --set-mark 1\niptables -t mangle -A DIVERT -j ACCEPT\nip rule add fwmark 1 lookup 100\nip route add local 0.0.0.0/0 dev lo table 100\necho 0 >/proc/sys/net/ipv4/conf/lo/rpfilter\n\nstunnel must also to be executed as root and without the setuid option.\n\nRemote mode (connect option) on Linux 2.2.x\nThis  configuration requires the kernel to be compiled with the transparent proxy\noption.  Connected service must be installed on a separate host.  Routing towards\nthe clients has to go through the stunnel box.\n\nstunnel must also to be executed as root and without the setuid option.\n\nRemote mode (connect option) on FreeBSD >=8.0\nThis configuration requires additional firewall and routing setup.  stunnel  must\nalso to be executed as root and without the setuid option.\n\nLocal mode (exec option)\nThis  configuration  works  by  pre-loading  the  libstunnel.so  shared  library.\nRLDLIST environment variable is used on Tru64, and LDPRELOAD variable on other\nplatforms.\n\ndestination\nThe original destination is used instead of the connect option.\n\nA service section for transparent destination may look like this:\n\n[transparent]\nclient = yes\naccept = <stunnelport>\ntransparent = destination\n\nThis configuration requires iptables setup to  work,  possibly  in  /etc/rc.local  or\nequivalent file.\n\nFor a connect target installed on the same host:\n\n/sbin/iptables -t nat -I OUTPUT -p tcp --dport <redirectedport> \\\n-m ! --uid-owner <stunneluserid> \\\n-j DNAT --to-destination <localip>:<stunnelport>\n\nFor a connect target installed on a remote host:\n\n/sbin/iptables -I INPUT -i eth0 -p tcp --dport <stunnelport> -j ACCEPT\n/sbin/iptables -t nat -I PREROUTING -p tcp --dport <redirectedport> \\\n-i eth0 -j DNAT --to-destination <localip>:<stunnelport>\n\nThe transparent destination option is currently only supported on Linux.\n\nboth\nUse both source and destination transparent proxy.\n\nTwo legacy options are also supported for backward compatibility:\n\nyes This option has been renamed to source.\n\nno  This option has been renamed to none.\n\nverify = LEVEL\nverify the peer certificate\n\nThis  option  is  obsolete  and  should  be  replaced with the verifyChain and verifyPeer\noptions.\n\nlevel 0\nRequest and ignore the peer certificate chain.\n\nlevel 1\nVerify the peer certificate chain if present.\n\nlevel 2\nVerify the peer certificate chain.\n\nlevel 3\nVerify the peer certificate chain and the end-entity (leaf) peer certificate  against\na locally installed certificate.\n\nlevel 4\nIgnore  the  peer  certificate  chain  and  only  verify  the  end-entity (leaf) peer\ncertificate against a locally installed certificate.\n\ndefault\nNo verify.\n\nverifyChain = yes | no\nverify the peer certificate chain starting from the root CA\n\nFor  server  certificate  verification  it  is  essential  to  also  require  a  specific\ncertificate with checkHost or checkIP.\n\nThe  self-signed root CA certificate needs to be stored either in the file specified with\nCAfile, or in the directory specified with CApath.\n\ndefault: no\n\nverifyPeer = yes | no\nverify the end-entity (leaf) peer certificate\n\nThe end-entity (leaf) peer certificate needs to be stored either in  the  file  specified\nwith CAfile, or in the directory specified with CApath.\n\ndefault: no\n",
            "subsections": []
        },
        "RETURN VALUE": {
            "content": "stunnel returns zero on success, non-zero on error.\n",
            "subsections": []
        },
        "SIGNALS": {
            "content": "The following signals can be used to control stunnel in Unix environment:\n\nSIGHUP\nForce a reload of the configuration file.\n\nSome global options will not be reloaded:\n\n•   chroot\n\n•   foreground\n\n•   pid\n\n•   setgid\n\n•   setuid\n\nThe  use  of  the  'setuid'  option  will also prevent stunnel from binding to privileged\n(<1024) ports during configuration reloading.\n\nWhen the 'chroot' option is used, stunnel will look for  all  its  files  (including  the\nconfiguration file, certificates, the log file and the pid file) within the chroot jail.\n\nSIGUSR1\nClose and reopen the stunnel log file.  This function can be used for log rotation.\n\nSIGUSR2\nLog the list of active connections.\n\nSIGTERM, SIGQUIT, SIGINT\nShut stunnel down.\n\nThe result of sending any other signals to the server is undefined.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "In order to provide TLS encapsulation to your local imapd service, use:\n\n[imapd]\naccept = 993\nexec = /usr/sbin/imapd\nexecArgs = imapd\n\nor in remote mode:\n\n[imapd]\naccept = 993\nconnect = 143\n\nIn  order  to  let your local e-mail client connect to a TLS-enabled imapd service on another\nserver, configure the e-mail client to connect to localhost on port 119 and use:\n\n[imap]\nclient = yes\naccept = 143\nconnect = servername:993\n\nIf you want to provide tunneling to your pppd daemon on port 2020, use something like:\n\n[vpn]\naccept = 2020\nexec = /usr/sbin/pppd\nexecArgs = pppd local\npty = yes\n\nIf you want to use stunnel in inetd mode  to  launch  your  imapd  process,  you'd  use  this\nstunnel.conf.  Note there must be no [servicename] section.\n\nexec = /usr/sbin/imapd\nexecArgs = imapd\n\nTo setup SOCKS VPN configure the following client service:\n\n[socksclient]\nclient = yes\naccept = 127.0.0.1:1080\nconnect = vpnserver:9080\nverifyPeer = yes\nCAfile = stunnel.pem\n\nThe corresponding configuration on the vpnserver host:\n\n[socksserver]\nprotocol = socks\naccept = 9080\ncert = stunnel.pem\nkey = stunnel.key\n\nNow test your configuration on the client machine with:\n\ncurl --socks4a localhost http://www.example.com/\n\nAn example server mode SNI configuration:\n\n[virtual]\n; primary service\naccept = 443\ncert =  default.pem\nconnect = default.internal.mydomain.com:8080\n\n[sni1]\n; secondary service 1\nsni = virtual:server1.mydomain.com\ncert = server1.pem\nconnect = server1.internal.mydomain.com:8081\n\n[sni2]\n; secondary service 2\nsni = virtual:server2.mydomain.com\ncert = server2.pem\nconnect = server2.internal.mydomain.com:8082\nverifyPeer = yes\nCAfile = server2-allowed-clients.pem\n\nAn  example  of  advanced  engine  configuration  allows for authentication with private keys\nstored in the Windows certificate store (Windows only).  With the CAPI engine you don't  need\nto  manually select the client key to use.  The client key is automatically selected based on\nthe list of CAs trusted by the server.\n\nengine = capi\n\n[service]\nengineId = capi\nclient = yes\naccept = 127.0.0.1:8080\nconnect = example.com:8443\n\nAn example of advanced engine configuration to use  the  certificate  and  the  corresponding\nprivate key from a pkcs11 engine:\n\nengine = pkcs11\nengineCtrl = MODULEPATH:opensc-pkcs11.so\nengineCtrl = PIN:123456\n\n[service]\nengineId = pkcs11\nclient = yes\naccept = 127.0.0.1:8080\nconnect = example.com:843\ncert = pkcs11:token=MyToken;object=MyCert\nkey = pkcs11:token=MyToken;object=MyKey\n\nAn  example  of  advanced  engine  configuration to use the certificate and the corresponding\nprivate key from a SoftHSM token:\n\nengine = pkcs11\nengineCtrl = MODULEPATH:softhsm2.dll\nengineCtrl = PIN:12345\n\n[service]\nengineId = pkcs11\nclient = yes\naccept = 127.0.0.1:8080\nconnect = example.com:843\ncert = pkcs11:token=MyToken;object=KeyCert\n",
            "subsections": []
        },
        "NOTES": {
            "content": "RESTRICTIONS\nstunnel cannot be used for the FTP daemon because of the nature of  the  FTP  protocol  which\nutilizes  multiple ports for data transfers.  There are available TLS-enabled versions of FTP\nand telnet daemons, however.\n\nINETD MODE\nThe most common use of stunnel is to listen on a network  port  and  establish  communication\nwith either a new port via the connect option, or a new program via the exec option.  However\nthere  is a special case when you wish to have some other program accept incoming connections\nand launch stunnel, for example with inetd, xinetd, or tcpserver.\n\nFor example, if you have the following line in inetd.conf:\n\nimaps stream tcp nowait root /usr/bin/stunnel stunnel /etc/stunnel/imaps.conf\n\nIn these cases, the inetd-style program is responsible for binding a  network  socket  (imaps\nabove) and handing it to stunnel when a connection is received.  Thus you do not want stunnel\nto  have  any  accept  option.   All the Service Level Options should be placed in the global\noptions section, and no [servicename] section will be present.  See the EXAMPLES section for\nexample configurations.\n\nCERTIFICATES\nEach TLS-enabled daemon needs to present a valid X.509 certificate to the peer. It also needs\na private key to decrypt the incoming data. The easiest way to obtain a certificate and a key\nis to generate them with  the  free  OpenSSL  package.  You  can  find  more  information  on\ncertificates generation on pages listed below.\n\nThe  .pem  file  should  contain  the  unencrypted  private key and a signed certificate (not\ncertificate request).  So the file should look like this:\n\n-----BEGIN RSA PRIVATE KEY-----\n[encoded key]\n-----END RSA PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\n[encoded certificate]\n-----END CERTIFICATE-----\n\nRANDOMNESS\nstunnel needs to seed the PRNG (pseudo-random number generator) in order for TLS to use  good\nrandomness.   The following sources are loaded in order until sufficient random data has been\ngathered:\n\n•   The file specified with the RNDfile flag.\n\n•   The file specified by the RANDFILE environment variable, if set.\n\n•   The file .rnd in your home directory, if RANDFILE not set.\n\n•   The file specified with '--with-random' at compile time.\n\n•   The contents of the screen if running on Windows.\n\n•   The egd socket specified with the EGD flag.\n\n•   The egd socket specified with '--with-egd-sock' at compile time.\n\n•   The /dev/urandom device.\n\nNote that on Windows machines that do not have console  user  interaction  (mouse  movements,\ncreating windows, etc.) the screen contents are not variable enough to be sufficient, and you\nshould provide a random file for use with the RNDfile flag.\n\nNote  that  the file specified with the RNDfile flag should contain random data -- that means\nit should  contain  different  information  each  time  stunnel  is  run.   This  is  handled\nautomatically  unless  the  RNDoverwrite  flag  is  used.   If  you  wish to update this file\nmanually, the openssl rand command in recent versions of OpenSSL, would be useful.\n\nImportant note: If /dev/urandom is available, OpenSSL often seeds  the  PRNG  with  it  while\nchecking  the  random  state.   On systems with /dev/urandom OpenSSL is likely to use it even\nthough it is listed at the very bottom of the list above.  This is the behaviour  of  OpenSSL\nand not stunnel.\n\nDH PARAMETERS\nstunnel  4.40  and  later  contains  hardcoded 2048-bit DH parameters.  Starting with stunnel\n5.18, these hardcoded DH parameters are replaced every 24 hours with autogenerated  temporary\nDH parameters.  DH parameter generation may take several minutes.\n\nAlternatively,  it is possible to specify static DH parameters in the certificate file, which\ndisables generating temporary DH parameters:\n\nopenssl dhparam 2048 >> stunnel.pem\n",
            "subsections": []
        },
        "FILES": {
            "content": "@sysconfdir@/stunnel/stunnel.conf\nstunnel configuration file\n",
            "subsections": []
        },
        "BUGS": {
            "content": "The execArgs option and the Win32 command line do not support quoting.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "tcpd(8)\naccess control facility for internet services\n\ninetd(8)\ninternet 'super-server'\n\nhttp://www.stunnel.org/\nstunnel homepage\n\nhttp://www.openssl.org/\nOpenSSL project website\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Michał Trojnara\n<Michal.Trojnara@stunnel.org>\n\n5.72                                         2024.04.01                                   stunnel(8)",
            "subsections": []
        }
    },
    "summary": "stunnel - TLS offloading and load-balancing proxy",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Read the config file from specified file descriptor"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print stunnel help menu"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print stunnel version and compile time defaults"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print default socket options"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print supported TLS options"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Install NT Service"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Uninstall NT Service"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Start NT Service"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Stop NT Service"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Reload the configuration file of the running NT Service"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Reopen the log file of the running NT Service"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Exit an already started stunnel"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Don't display any message boxes"
        }
    ],
    "examples": [
        "In order to provide TLS encapsulation to your local imapd service, use:",
        "[imapd]",
        "accept = 993",
        "exec = /usr/sbin/imapd",
        "execArgs = imapd",
        "or in remote mode:",
        "[imapd]",
        "accept = 993",
        "connect = 143",
        "In  order  to  let your local e-mail client connect to a TLS-enabled imapd service on another",
        "server, configure the e-mail client to connect to localhost on port 119 and use:",
        "[imap]",
        "client = yes",
        "accept = 143",
        "connect = servername:993",
        "If you want to provide tunneling to your pppd daemon on port 2020, use something like:",
        "[vpn]",
        "accept = 2020",
        "exec = /usr/sbin/pppd",
        "execArgs = pppd local",
        "pty = yes",
        "If you want to use stunnel in inetd mode  to  launch  your  imapd  process,  you'd  use  this",
        "stunnel.conf.  Note there must be no [servicename] section.",
        "exec = /usr/sbin/imapd",
        "execArgs = imapd",
        "To setup SOCKS VPN configure the following client service:",
        "[socksclient]",
        "client = yes",
        "accept = 127.0.0.1:1080",
        "connect = vpnserver:9080",
        "verifyPeer = yes",
        "CAfile = stunnel.pem",
        "The corresponding configuration on the vpnserver host:",
        "[socksserver]",
        "protocol = socks",
        "accept = 9080",
        "cert = stunnel.pem",
        "key = stunnel.key",
        "Now test your configuration on the client machine with:",
        "curl --socks4a localhost http://www.example.com/",
        "An example server mode SNI configuration:",
        "[virtual]",
        "; primary service",
        "accept = 443",
        "cert =  default.pem",
        "connect = default.internal.mydomain.com:8080",
        "[sni1]",
        "; secondary service 1",
        "sni = virtual:server1.mydomain.com",
        "cert = server1.pem",
        "connect = server1.internal.mydomain.com:8081",
        "[sni2]",
        "; secondary service 2",
        "sni = virtual:server2.mydomain.com",
        "cert = server2.pem",
        "connect = server2.internal.mydomain.com:8082",
        "verifyPeer = yes",
        "CAfile = server2-allowed-clients.pem",
        "An  example  of  advanced  engine  configuration  allows for authentication with private keys",
        "stored in the Windows certificate store (Windows only).  With the CAPI engine you don't  need",
        "to  manually select the client key to use.  The client key is automatically selected based on",
        "the list of CAs trusted by the server.",
        "engine = capi",
        "[service]",
        "engineId = capi",
        "client = yes",
        "accept = 127.0.0.1:8080",
        "connect = example.com:8443",
        "An example of advanced engine configuration to use  the  certificate  and  the  corresponding",
        "private key from a pkcs11 engine:",
        "engine = pkcs11",
        "engineCtrl = MODULEPATH:opensc-pkcs11.so",
        "engineCtrl = PIN:123456",
        "[service]",
        "engineId = pkcs11",
        "client = yes",
        "accept = 127.0.0.1:8080",
        "connect = example.com:843",
        "cert = pkcs11:token=MyToken;object=MyCert",
        "key = pkcs11:token=MyToken;object=MyKey",
        "An  example  of  advanced  engine  configuration to use the certificate and the corresponding",
        "private key from a SoftHSM token:",
        "engine = pkcs11",
        "engineCtrl = MODULEPATH:softhsm2.dll",
        "engineCtrl = PIN:12345",
        "[service]",
        "engineId = pkcs11",
        "client = yes",
        "accept = 127.0.0.1:8080",
        "connect = example.com:843",
        "cert = pkcs11:token=MyToken;object=KeyCert"
    ],
    "see_also": [
        {
            "name": "tcpd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/tcpd/8/json"
        },
        {
            "name": "inetd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/inetd/8/json"
        }
    ]
}