$Revision: 1.2 $
$Date: 2007/02/28 01:38:48 $

# Parameters

## `tls_method` (string)

Sets the SSL protocol method. Possible values are:

- TLSv1 - only TLSv1 connections are accepted. This is the default and recommended method (if you want to be rfc3261 conformant don't change it).

- SSLv3 - only SSLv3 connections are accepted

- SSLv2 - only SSLv2 connections, for old clients. Note: you shouldn't use SSLv2 for anything which should be highly secure.

- SSLv23 - any of the above methods will be accepted, with the following limitation: the initial SSL hello message must be V2 (in the initial hello all the supported protocols are advertised enabling switching to a higher and more secure version). This means connections from SSLv3 or TLSv1 clients will not be accepted.

If rfc3261 conformance is desired, TLSv1 must be used. For compatibility with older clients SSLv23 is a good option.

### Set `tls_method` parameter

    ...
    modparam("tls", "tls_method", "TLSv1")
    ...

## `certificate` (string)

Sets the certificate file name. The certificate file can also contain the private key.

Warning: try not to use certificate with keys longer then 1024 bytes. Longer keys will severely impact performance, in particular the tls connection rate.

The default value is [SER_CFG_DIR]/cert.pem.

### Set `certificate` parameter

    ...
    modparam("tls", "certificate", "/usr/local/etc/ser/my_certificate.pem")
    ...

## `private_key` (string)

Sets the private key file name.

Note: the private key can be contained in the same file as the certificate (just append it to the certificate file, e.g.: cat pkey.pem >> cert.pem)

The default value is [SER_CFG_DIR]/cert.pem.

### Set `private_key` parameter

    ...
    modparam("tls", "private", "/usr/local/etc/ser/my_pkey.pem")
    ...

## `ca_list` (string)

Sets the CA list file name. This file contains a list of all the trusted CAs certificates. If a signature in a certificate chain belongs to one of the listed CAs, the authentication will succeed. See also verify_certificate, verify_depth and require_certificate.

By default the CA file is not set.

An easy way to create the CA list is to append each trusted trusted CA certificate in the PEM format to one file, e.g.: for f in trusted_cas/*.pem ; do cat "$f" >> ca_list.pem ; done .

### Set `ca_list` parameter

    ...
    modparam("tls", "ca_list", "/usr/local/etc/ser/ca_list.pem")
    ...

## `verify_certificate` (boolean)

If enabled it will force certificate verification. For more information see the verify(1) openssl man page.

Note: the certificate verification will always fail if the ca_list is empty.

See also: `ca_list`, `require_certificate`, `verify_depth`.

By default the certificate verification is off.

### Set `verify_certificate` parameter

    ...
    modparam("tls", "verify_certificate", 1)
    ...

## `verify_depth` (integer)

Sets how far up the certificate chain will the certificate verification go in the search for a trusted CA.

See also: `ca_list`, `require_certificate`, `verify_certificate`,

The default value is 9.

### Set `verify_depth` parameter

    ...
    modparam("tls", "verify_depth", 9)
    ...

## `require_certificate` (boolean)

When enabled it will require a certificate from a client. If the client does not offer a certificate and `verify_certificate` is on, the certificate verification will fail.

The default value is off.

### Set `require_certificate` parameter

    ...
    modparam("tls", "require_certificate", 1)
    ...

## `cipher_list` (string)

Sets the list of accepted ciphers. The list consists of cipher strings separated by colons. For more information on the cipher list format see the cipher(1) openssl man page.

The default value is not set (all the openssl supported ciphers are enabled).

### Set `cipher_list` parameter

    ...
    modparam("tls", "cipher_list", "HIGH")
    ...

## `send_timeout` (int)

Sets the maximum interval of time after which ser will give up trying to send a message over tls (time after a tls send will be aborted and the corresponding tls connection closed). The value is in seconds.

The default value is 120 s.

### Set `send_timeout` parameter

    ...
    modparam("tls", "send_timeout", 1)
    ...

## `handshake_timeout` (int)

Sets the maximum interval of time after which ser will give up trying to accept a tls connection or connect to a tls peer. The value is in seconds.

The default value is 120 s.

### Set `handshake_timeout` parameter

    ...
    modparam("tls", "handshake_timeout", 1)
    ...

## `connection_timeout` (int)

Sets the amount of time after which an idle tls connection will be closed. This is similar to tcp_connection_lifetime. The value is expressed in seconds.

The default value is 10 min.

If the value set is -1, the connection will never be close on idle.

### Set `connection_timeout` parameter

    ...
    modparam("tls", "connection_timeout", 60)
    ...

## `tls_disable_compression` (boolean)

If set compression over SSL/TLS will be disabled.

By default compression is enabled.

### Set `tls_disable_compression` parameter

    ...
    modparam("tls", "tls_disable_compression", 1)
    ...

## `tls_log` (int)

Sets the log level at which tls related messages will be logged.

The default value is 3.

### Set `tls_log` parameter

    ...
    # ignore tls messages if ser is started with debug less than 10
    modparam("tls", "tls_log", 10)
    ...

## `low_mem_threshold1` (integer)

Sets the minimal free memory from which new tls connection will start to fail. The value is expressed in KB.

The default value depends on whether the openssl library used handles well low memory situations (openssl bug #1491). As of this writing this is not true for any openssl version (including 0.9.8e).

If an ill-behaved openssl version is detected, a very conservative value is choosed, which depends on the maximum possible number of simultaneously created tls connections (and hence on the process number).

The following values have a special meaning:

- -1 - use the default value

- 0 - disable (tls connections will not fail preemptively)

See also `low_mem_threshold2`.

### Set `low_memory_threshold1` parameter

    ...
    modparam("tls", "low_memory_threshold1", -1)
    ...

## `low_mem_threshold2` (integer)

Sets the minimal free memory from which tls operations on already established tls connections will start to fail preemptively. The value is expressed in KB.

The default value depends on whether the openssl library used handles well low memory situations (openssl bug #1491). As of this writing this is not true for any openssl version (including 0.9.8e).

If an ill-behaved openssl version is detected, a very conservative value is choosed, which depends on the maximum possible number of simultaneously created tls connections (and hence on the process number).

The following values have a special meaning:

- -1 - use the default value

- 0 - disable (tls operations will not fail preemptively)

See also `low_mem_threshold1`.

### Set `low_memory_threshold2` parameter

    ...
    modparam("tls", "low_memory_threshold2", -1)
    ...

## `tls_force_run` (boolean)

If enabled ser will start even if some of the openssl sanity checks fail (turn it on at your own risk).

Currently failing any of the following sanity checks will not allow ser to start:

- the version of the library the tls module was compiled with is "too different" from the library used at runtime. The versions should have the same major, minor and fix level (e.g.: 0.9.8a and 0.9.8c are ok, but 0.9.8 and 0.9.9 are not)

- the openssl library used at compile time and the one used at runtime have different kerberos options

By default tls_force_run is disabled.

### Set `tls_force_run` parameter

    ...
    modparam("tls", "tls_force_run", 11)
    ...

## `config` (string)

Sets the name of the TLS specific config file.

If set the tls module will load a special config file, in which different tls parameters can be specified on a per role (server or client) and domain basis (for now only IPs). The corresponding module parameters will be ignored.

By default no config file is specified.

The following parameters can be set in the config file, for each domain:

- tls_method

- verify_certificate

- require_certificate

- private_key

- certificate

- verify_depth

- ca_list

- cipher_list

ser acts as a server when it accepts a connection and as a client when it initiates a new connection by itself (it connects to something).

### Short config file

    [server:default]
    method = TLSv1
    verify_certificate = no
    require_certificate = no
    private_key = default_key.pem
    certificate = default_cert.pem
    ca_list = default_ca.pem

    [client:default]
    verify_certificate = yes
    require_certificate = yes

    #more relaxed for connection on the loopback interface
    [server:127.0.0.1:5061]
    method = SSLv23
    verify_certificate = yes
    require_certificate = no
    private_key = local_key.pem
    certificate = local_cert.pem
    verify_depth = 3
    ca_list = local_ca.pem

For a more complete example check the tls.cfg distributed with the ser source (sip_router/modules/tls/tls.cfg).

### Set `config` parameter

    ...
    modparam("tls", "config", "/usr/local/etc/ser/tls.cfg")
    ...