Commit Graph
35 Commits
Author SHA1 Message Date
ea74c0acb8 Merge commit from fork
* [Core, mod_commands] Interface allowlist (#3086)

* [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>

* Merge commit from fork

Add `switch_stun_packet_verify_integrity()`, an HMAC-SHA1
MESSAGE-INTEGRITY verifier that is const and non-mutating: it runs
over a private copy of the pristine network-order packet, so the
caller's buffer and byte order stay untouched, and walks attributes
with its own unsigned bounded helper `stun_wire_attr_bounds()`
instead of the host-order iterator macros. A trailing
MESSAGE-INTEGRITY-SHA256 or FINGERPRINT after MESSAGE-INTEGRITY is
tolerated; any other trailing attribute is rejected.

Gate it in `handle_ice()` behind `ice->verify_integrity`: verify
before any ICE state is touched, keyed by message type (local
`ice->pass` for a request, remote `ice->rpass` for a response or
error response), and drop on failure. Keepalive indications carry no
MESSAGE-INTEGRITY and are ignored.

`ice->verify_integrity` is read from the `ice_verify_message_integrity`
channel variable in `switch_rtp_activate_ice()` and defaults off, so
receive-path behavior is unchanged unless it is enabled. Adds unit
tests in `tests/unit/switch_stun.c`.

* Merge commit from fork

* [core] Verify DTLS client cert against SDP fingerprint (server role)

Add opt-in verification of the client certificate when FreeSWITCH is
the DTLS server, mirroring the binding the client role already performs
on the server certificate: match the peer certificate against the SDP
`a=fingerprint` in `dtls_state_setup()`.

Selected per call by the `rtp_dtls_client_cert_verify_mode` channel
variable (`dtls_client_cert_verify_t`). An unset variable keeps the
default `DTLS_CLIENT_CERT_VERIFY_NONE`, so existing behavior is
unchanged:

- `none`: the server does not request a client certificate.
- `fingerprint`: request it (`SSL_VERIFY_PEER` + `dtls_accept_any_cert`)
  and require its fingerprint to match the SDP value; a self-signed
  certificate is accepted at the TLS layer and the match provides
  authenticity.
- `full`: additionally let OpenSSL enforce the certificate chain.

An unrecognized mode string falls back to `fingerprint` (fail closed)
with a warning.

The mode is set per `SSL` object in `switch_rtp_add_dtls()`. Verification
fails (`DS_FAIL`, no SRTP keys derived) when the client presents no
certificate, its fingerprint does not match, or the peer advertised no
usable `a=fingerprint`: `get_evp_by_name()` returns `NULL` for a missing
or empty hash type and `switch_core_cert_extract_fingerprint()` rejects a
`NULL` algorithm rather than passing it to `X509_digest()`.

`conf/vanilla/vars.xml` documents the knob as a disabled example. Tests
in `tests/unit/switch_rtp.c` cover matching, mismatched, absent-cert,
absent-fingerprint, `none`, and unrecognized-mode cases.

---------

Co-authored-by: Andrey Volk <andywolk@gmail.com>
Co-authored-by: Chris Rienzo <chris@signalwire.com>
2026-08-08 18:14:08 +03:00
Dmitry Verenitsin 68ec688eb6 Merge commit from fork
Add `switch_stun_packet_verify_integrity()`, an HMAC-SHA1
MESSAGE-INTEGRITY verifier that is const and non-mutating: it runs
over a private copy of the pristine network-order packet, so the
caller's buffer and byte order stay untouched, and walks attributes
with its own unsigned bounded helper `stun_wire_attr_bounds()`
instead of the host-order iterator macros. A trailing
MESSAGE-INTEGRITY-SHA256 or FINGERPRINT after MESSAGE-INTEGRITY is
tolerated; any other trailing attribute is rejected.

Gate it in `handle_ice()` behind `ice->verify_integrity`: verify
before any ICE state is touched, keyed by message type (local
`ice->pass` for a request, remote `ice->rpass` for a response or
error response), and drop on failure. Keepalive indications carry no
MESSAGE-INTEGRITY and are ignored.

`ice->verify_integrity` is read from the `ice_verify_message_integrity`
channel variable in `switch_rtp_activate_ice()` and defaults off, so
receive-path behavior is unchanged unless it is enabled. Adds unit
tests in `tests/unit/switch_stun.c`.
2026-08-08 17:03:47 +03:00
Dmitry Verenitsin 9da537a19f [mod_sofia] Add SIP 603+ detection and passthrough control. Add unit-tests. (#3035)
Implement SIP 603+ (ATIS-1000099) support for FCC analytics-based call blocking compliance.

Detection:
- Detect incoming 603+ responses by checking "Network Blocked" phrase
and "v=analytics1;" in the `Reason` header text
- Set `sip_603plus_reason` channel variable on both legs for CDR visibility

Passthrough control:
- `sip_603plus_passthrough=true`: forward 603+ phrase and Reason header
- `sip_603plus_passthrough=false`: strip `Reason` header, send clean `603 Decline`
- Not set: existing behavior preserved
- Works independently of `disable_q850_reason` for selective forwarding
2026-05-26 17:33:23 +03:00
Andrey Volk d4fd3cc054 [mod_h26x] Remove from tree 2025-01-13 23:24:50 +03:00
Len c013a7dc64 [Configuration] Use : not , in rtp_secure_media 2023-01-24 02:04:56 +03:00
Dragos Oancea 8e59603d98 [core][mod_sofia] remove ZRTP (deemed obsolete).
[unit-tests][build-system][docs] remove references to ZRTP.
2022-10-28 20:19:42 +03:00
Andrey Volk a5cecbfc2a FS-11604: [Configuration] Improve Vanilla config. 2019-05-21 00:03:14 +04:00
sean f 4cb44e6c60 FS-10593: clean up whitespaces from several xml files. 2017-08-16 14:58:01 -07:00
Mike Jerris 41130001b0 FS-10540: change conf to use sound_prefix var to allow changing to sounds set in one change 2017-07-25 18:31:42 -05:00
Anthony Minessale 5efc9714ee FS-7703 remove answer delay from default dp 2015-06-25 12:42:14 -05:00
Alexander Traud 022fddbe6a Add Perfect Forward Secrecy (DHE PFS) to mod_sofia
Ephemeral ECDH (ECDHE) was supported already. This patch adds Ephemeral
DH (DHE). To enable it, add DH parameters into the private-key file of
your server (agent.pem). For example via:
openssl dhparam -out dh.pem 2048

FS-7561 #resolve
2015-06-01 12:45:19 -05:00
Brian West 9c459f881e FS-7494: default avatar and mute images for video MCU 2015-05-28 12:47:26 -05:00
Brian d3a5605ab6 FS-7471 improve configs for video 2015-05-28 12:47:25 -05:00
Brian West 9872c52c57 FS-7368 --resolve 2015-03-13 16:50:13 -05:00
Brian West cf332d7cdc minor docs tweak to show how to enable the filter 2014-10-23 13:36:33 -05:00
Brian West 711b0c7696 FS-6940 docs and examples 2014-10-23 13:31:58 -05:00
Brian West d06ac756eb clarify tls ciphers and update num to allow for ipv6 and tls options 2014-09-10 14:49:59 -05:00
Travis Cross 27e3b5b705 Name variable storage_dir
...rather than `storage`.

ref: commit ce96d95c5e
2014-09-04 20:57:28 +00:00
Russell Treleaven ce96d95c5e add support for cache directory
make configs use specific directory variables instead of just base_dir
so that one configuration can be used for fhs and legacy installations
2014-08-31 20:22:08 -04:00
Brian West 757b744010 Since we're all about WebRTC, We should compile and enable OPUS by default to lower the number of steps to complete a WebRTC setup 2014-05-23 08:11:03 -05:00
Brian West 1e7d8e9733 Give warning in the vars.xml docs about SRTP + VBR codecs 2014-03-28 09:37:56 -05:00
Brian West ea313038f2 React to all suites in the defaults and set true to accept the strongest offer received 2014-03-05 21:34:05 -06:00
Brian West 8807e8fa02 Spacing 2014-03-05 21:21:59 -06:00
Brian West 8450641332 THIS JUST IN rtp_secure_media_suites option 2014-03-05 21:21:05 -06:00
Brian West 9611390244 spacing 2014-03-05 21:16:26 -06:00
Brian West 1f0966336a default if not set is 2014-03-05 21:08:39 -06:00
Brian West 4420bf4b91 Documentation for recent SRTP changes 2014-03-05 21:04:42 -06:00
Brian West 3fae719589 Update in-config docs 2014-02-06 08:58:48 -06:00
Brian West 395b3b6112 sigh spelling 2013-08-21 11:47:58 -05:00
Brian West f592ce264b FS-5718 --resolve 2013-08-21 11:33:29 -05:00
Anthony Minessale 68055eab2b support tls dir options properly 2013-03-31 21:27:26 -05:00
Michael S Collins f5f8e90f01 Add global var so you don't have to remember 640hz 2013-01-31 17:38:05 -08:00
Brian West 1215ee4fe1 FS-4699 --resolve 2012-10-08 17:19:17 -05:00
Travis Cross 226851e8b0 don't use Siren or iLBC by default in example configs
These codecs are non-free which creates issues for distributions, so
let's not require these by default to run our example configs.  We can
add back in iLBC once we resolve the licensing situation with our
in-tree implementation.
2012-05-29 18:41:17 +00:00
Ken Rice ee71daa1f6 conf: mv conf/* -> conf/vanilla/* 2012-03-24 03:19:32 +00:00