mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-08-19 09:40:21 +00:00
* [core] Add interface allowlist to gate module app/api registration Adds an optional, presence-activated allowlist in switch.conf.xml that controls which modules may register application / api / json_api / chat-application interfaces. With no <interface-allowlist> configured nothing is enforced; when at least one <allow> entry is present, only listed interfaces register at load time and all others are refused (the module still loads and switch_loadable_module_process still returns SUCCESS -- the blocked interface is simply never exposed). Entries match at three levels of precision: mod_commands - whole module mod_commands.system - any interface named "system" mod_commands.system.api - a specific type (app|api|json_api|chat_app) Enforcement lives in switch_loadable_module_process() so every module, at boot and at runtime `load`, is subject to the same policy. This gives operators a way to disable the "system"/"spawn" shell-exec API commands (and equivalents) system-wide. Also adds the `interface_allowlist_dump [modules] [plain]` API, which walks the loaded modules and prints their interfaces in the allowlist key format so the current state can be captured and pruned offline into config. * [mod_commands] Add tests for the interface allowlist New test_interface_allowlist boots the core with an active <interface-allowlist> (conf_interface_allowlist/) that permits only a couple of mod_commands interfaces, then loads mod_commands and verifies: - listed commands register and run (status, version) while unlisted and shell-exec commands are refused (system, spawn, uptime) -- refusal surfaces as switch_api_execute returning FALSE / command-not-found, with the command function never invoked; - a "module.name.type" entry gates by type: the API "status" loads while the JSON API of the same name stays blocked; - interface_allowlist_dump prints the config format in its xml, modules and plain variants, and reflects module capabilities (system appears in the dump even though it was blocked from registering). * [config] Fix interior -- in interface-allowlist comment breaking XML parse The explanatory comment used -- as em-dash pairs. The XML parser treats -- inside a comment as the comment close, causing an "unclosed <!--" error that prevents the whole freeswitch.xml from parsing (boot and reloadxml both fail). Replace the -- pairs with ordinary punctuation. * update .gitignore * [core] Warn when interface-allowlist section is present but parses no entries Co-authored-by: Chris Rienzo <chris@signalwire.com>
247 lines
11 KiB
XML
247 lines
11 KiB
XML
<configuration name="switch.conf" description="Core Configuration">
|
|
|
|
<cli-keybindings>
|
|
<key name="1" value="help"/>
|
|
<key name="2" value="status"/>
|
|
<key name="3" value="show channels"/>
|
|
<key name="4" value="show calls"/>
|
|
<key name="5" value="sofia status"/>
|
|
<key name="6" value="reloadxml"/>
|
|
<key name="7" value="console loglevel 0"/>
|
|
<key name="8" value="console loglevel 7"/>
|
|
<key name="9" value="sofia status profile internal"/>
|
|
<key name="10" value="sofia profile internal siptrace on"/>
|
|
<key name="11" value="sofia profile internal siptrace off"/>
|
|
<key name="12" value="version"/>
|
|
</cli-keybindings>
|
|
|
|
<default-ptimes>
|
|
<!-- Set this to override the 20ms assumption of various codecs in the sdp with no ptime defined -->
|
|
<!-- <codec name="G729" ptime="40"/> -->
|
|
</default-ptimes>
|
|
|
|
<settings>
|
|
<!-- Colorize the Console -->
|
|
<param name="colorize-console" value="true"/>
|
|
|
|
<!--Include full timestamps in dialplan logs -->
|
|
<param name="dialplan-timestamps" value="false"/>
|
|
|
|
<!-- Run the timer at 20ms by default and drop down as needed unless you set 1m-timer=true which was previous default -->
|
|
<!-- <param name="1ms-timer" value="true"/> -->
|
|
|
|
<!--
|
|
Set the Switch Name for HA environments.
|
|
When setting the switch name, it will override the system hostname for all DB and CURL requests
|
|
allowing cluster environments such as RHCS to have identical FreeSWITCH configurations but run
|
|
as different hostnames.
|
|
-->
|
|
<!-- <param name="switchname" value="freeswitch"/> -->
|
|
<!-- <param name="cpu-idle-smoothing-depth" value="30"/> -->
|
|
|
|
|
|
<!-- Maximum number of simultaneous DB handles open -->
|
|
<param name="max-db-handles" value="50"/>
|
|
<!-- Maximum number of seconds to wait for a new DB handle before failing -->
|
|
<param name="db-handle-timeout" value="10"/>
|
|
|
|
<!-- Minimum idle CPU before refusing calls -->
|
|
<!-- <param name="min-idle-cpu" value="25"/> -->
|
|
|
|
<!-- Interval between heartbeat events -->
|
|
<!-- <param name="event-heartbeat-interval" value="20"/> -->
|
|
|
|
<!--
|
|
Max number of sessions to allow at any given time.
|
|
|
|
NOTICE: If you're driving 28 T1's in a single box you should set this to 644*2 or 1288
|
|
this will ensure you're able to use the entire DS3 without a problem. Otherwise you'll
|
|
be 144 channels short of always filling that DS3 up which can translate into waste.
|
|
-->
|
|
<param name="max-sessions" value="1000"/>
|
|
<!--Most channels to create per second -->
|
|
<param name="sessions-per-second" value="30"/>
|
|
<!-- Default Global Log Level - value is one of debug,info,notice,warning,err,crit,alert -->
|
|
<param name="loglevel" value="debug"/>
|
|
|
|
<!-- UUID version to use, 4 or 7 -->
|
|
<!-- <param name="uuid-version" value="7"/> -->
|
|
|
|
<!-- Set the core DEBUG level (0-10) -->
|
|
<!-- <param name="debug-level" value="10"/> -->
|
|
|
|
<!-- SQL Buffer length within rage of 32k to 10m -->
|
|
<!-- <param name="sql-buffer-len" value="1m"/> -->
|
|
<!-- Maximum SQL Buffer length must be greater than sql-buffer-len -->
|
|
<!-- <param name="max-sql-buffer-len" value="2m"/> -->
|
|
|
|
<!--
|
|
The min-dtmf-duration specifies the minimum DTMF duration to use on
|
|
outgoing events. Events shorter than this will be increased in duration
|
|
to match min_dtmf_duration. You cannot configure a dtmf duration on a
|
|
profile that is less than this setting. You may increase this value,
|
|
but cannot set it lower than 400. This value cannot exceed
|
|
max-dtmf-duration. -->
|
|
<!-- <param name="min-dtmf-duration" value="400"/> -->
|
|
|
|
<!--
|
|
The max-dtmf-duration caps the playout of a DTMF event at the specified
|
|
duration. Events exceeding this duration will be truncated to this
|
|
duration. You cannot configure a duration on a profile that exceeds
|
|
this setting. This setting can be lowered, but cannot exceed 192000.
|
|
This setting cannot be set lower than min_dtmf_duration. -->
|
|
<!-- <param name="max-dtmf-duration" value="192000"/> -->
|
|
|
|
<!--
|
|
The default_dtmf_duration specifies the DTMF duration to use on
|
|
originated DTMF events or on events that are received without a
|
|
duration specified. This value can be increased or lowered. This
|
|
value is lower-bounded by min_dtmf_duration and upper-bounded by
|
|
max-dtmf-duration\. -->
|
|
<!-- <param name="default-dtmf-duration" value="2000"/> -->
|
|
|
|
<!--
|
|
If you want to send out voicemail notifications via Windows you'll need to change the mailer-app
|
|
variable to the setting below:
|
|
|
|
<param name="mailer-app" value="msmtp"/>
|
|
|
|
Do not change mailer-app-args.
|
|
You will also need to download a sendmail clone for Windows (msmtp). This version works without issue:
|
|
http://msmtp.sourceforge.net/index.html. Download and copy the .exe to %winddir%\system32.
|
|
You'll need to create a small config file for smtp credentials (host name, authentication, tls, etc.) in
|
|
%USERPROFILE%\Application Data\ called "msmtprc.txt". Below is a sample copy of this file:
|
|
|
|
###################################
|
|
# The SMTP server of the provider.
|
|
account provider
|
|
host smtp.myisp.com
|
|
from john@myisp.com
|
|
auth login
|
|
user johndoe
|
|
password mypassword
|
|
|
|
# Set a default account
|
|
account default : provider
|
|
###################################
|
|
|
|
-->
|
|
|
|
<param name="mailer-app" value="sendmail"/>
|
|
<param name="mailer-app-args" value="-t"/>
|
|
<param name="dump-cores" value="yes"/>
|
|
|
|
<!-- Enable verbose channel events to include every detail about a channel on every event -->
|
|
<!-- <param name="verbose-channel-events" value="no"/> -->
|
|
|
|
<!-- Enable clock nanosleep -->
|
|
<!-- <param name="enable-clock-nanosleep" value="true"/> -->
|
|
|
|
<!-- Enable monotonic timing -->
|
|
<!-- <param name="enable-monotonic-timing" value="true"/> -->
|
|
|
|
<!-- NEEDS DOCUMENTATION -->
|
|
<!-- <param name="enable-softtimer-timerfd" value="true"/> -->
|
|
<!-- <param name="enable-cond-yield" value="true"/> -->
|
|
<!-- <param name="enable-timer-matrix" value="true"/> -->
|
|
<!-- <param name="threaded-system-exec" value="true"/> -->
|
|
<!-- <param name="tipping-point" value="0"/> -->
|
|
<!-- <param name="timer-affinity" value="disabled"/> -->
|
|
<!-- NEEDS DOCUMENTATION -->
|
|
|
|
<!-- RTP port range -->
|
|
<!-- <param name="rtp-start-port" value="16384"/> -->
|
|
<!-- <param name="rtp-end-port" value="32768"/> -->
|
|
|
|
<!-- Test each port to make sure it is not in use by some other process before allocating it to RTP -->
|
|
<!-- <param name="rtp-port-usage-robustness" value="true"/> -->
|
|
|
|
<!--
|
|
Store encryption keys for secure media in channel variables and call CDRs. Default: false.
|
|
WARNING: If true, anyone with CDR access can decrypt secure media!
|
|
-->
|
|
<!-- <param name="rtp-retain-crypto-keys" value="true"/> -->
|
|
|
|
<!--
|
|
Native PostgreSQL support was removed from the FreeSWITCH Core!
|
|
=================================
|
|
NOTICE: You MUST enable mod_pgsql
|
|
=================================
|
|
According to https://www.postgresql.org/docs/9.6/libpq-connect.html#LIBPQ-CONNSTRING
|
|
There are two accepted formats for connection strings supported by the libpq library:
|
|
* For plain keyword = value strings use pgsql://
|
|
pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'
|
|
* For RFC 3986 URIs use postgresql:// or postgres://
|
|
postgresql://
|
|
postgresql://localhost
|
|
postgresql://localhost:5433
|
|
postgresql://localhost/mydb
|
|
postgresql://user@localhost
|
|
postgresql://user:secret@localhost
|
|
postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
|
|
postgresql:///mydb?host=localhost&port=5433
|
|
-->
|
|
<!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'" /> -->
|
|
<!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE" /> -->
|
|
<!-- <param name="core-db-dsn" value="mariadb://Server=localhost;Database=freeswitch;Uid=freeswitch;Pwd=pass;" /> -->
|
|
<!-- <param name="core-db-dsn" value="dsn:username:password" /> -->
|
|
|
|
<!-- <param name="odbc-skip-autocommit-flip" value="true" /> -->
|
|
|
|
<!--
|
|
Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for
|
|
better performance on most linux distro (note, you loose the data if you reboot))
|
|
-->
|
|
<!-- <param name="core-db-name" value="/dev/shm/core.db" /> -->
|
|
|
|
<!-- The system will create all the db schemas automatically, set this to false to avoid this behaviour -->
|
|
<!-- <param name="auto-create-schemas" value="true"/> -->
|
|
<!-- <param name="auto-clear-sql" value="true"/> -->
|
|
<!-- <param name="enable-early-hangup" value="true"/> -->
|
|
|
|
<!-- <param name="core-dbtype" value="MSSQL"/> -->
|
|
|
|
<!-- Allow multiple registrations to the same account in the central registration table -->
|
|
<!-- <param name="multiple-registrations" value="true"/> -->
|
|
|
|
<!-- <param name="max-audio-channels" value="2"/> -->
|
|
|
|
</settings>
|
|
|
|
<!--
|
|
Interface allowlist (optional security hardening).
|
|
|
|
When this section contains at least one <allow> entry, ONLY the interfaces listed here
|
|
are permitted to register; every other application / api / json_api / chat-application
|
|
from ANY module is refused at load time (the module still loads, it just does not expose
|
|
the blocked interface). With this section absent or empty, nothing is enforced and all
|
|
interfaces load normally.
|
|
|
|
An interface is permitted if it matches ANY entry. Entries may be written at three
|
|
levels of precision:
|
|
|
|
<allow name="mod_commands"/> - permit every interface in mod_commands
|
|
<allow name="mod_commands.status"/> - permit any interface named "status" (all types)
|
|
<allow name="mod_commands.status.api"/> - permit ONLY the api named "status"
|
|
|
|
The optional trailing type token is one of: app, api, json_api, chat_app. This is how
|
|
you permit, e.g., the APP named "system" while still blocking an API/JSON-API of the
|
|
same name.
|
|
|
|
WARNING: this is an aggressive, system-wide allowlist. Once enabled you must list every
|
|
module (or interface) whose apps/APIs you rely on, including management commands from
|
|
mod_commands (load, unload, reload, status, ...) and your dialplan apps; otherwise the
|
|
system will not function. It only affects app/api/json_api/chat-app registration; codecs,
|
|
endpoints, timers, formats, etc. are never gated.
|
|
-->
|
|
<!--
|
|
<interface-allowlist>
|
|
<allow name="mod_commands"/>
|
|
<allow name="mod_dptools"/>
|
|
<allow name="mod_dialplan_xml"/>
|
|
<allow name="mod_sofia"/>
|
|
</interface-allowlist>
|
|
-->
|
|
|
|
</configuration>
|