33968 Commits

Author SHA1 Message Date
George Joseph
eafcd7a451 pjproject: Update bundled to 2.15.1.
This resolves a security issue where RTP ports weren't being released
causing possible resource exhaustion issues.

Resolves: #GHSA-557q-795j-wfx2
2025-08-28 13:38:40 +00:00
George Joseph
145cce5d93 .github: Update Releaser to use SES email 2025-08-20 12:05:00 -06:00
George Joseph
f538370365 res_stir_shaken: Test for missing semicolon in Identity header.
ast_stir_shaken_vs_verify() now makes sure there's a semicolon in
the Identity header to prevent a possible segfault.

Resolves: #GHSA-mrq5-74j5-f5cr
2025-07-31 08:36:27 -06:00
ThatTotallyRealMyth
fefb2aa2a7 safe_asterisk: Add ownership checks for /etc/asterisk/startup.d and its files.
UpgradeNote: The safe_asterisk script now checks that, if it was run by the
root user, the /etc/asterisk/startup.d directory and all the files it contains
are owned by root.  If the checks fail, safe_asterisk will exit with an error
and Asterisk will not be started.  Additionally, the default logging
destination is now stderr instead of tty "9" which probably won't exist
in modern systems.

Resolves: #GHSA-v9q8-9j8m-5xwp
2025-07-31 14:06:20 +00:00
George Joseph
e71c1dbd78 .github: Reduce number of inputs to Releaser to 10.
The max number of inputs supported by GitHub is 10 so
is_security and is_hotfix were factored into a single choice
entry.
2025-07-18 11:29:23 -06:00
George Joseph
67cc9e126b .github: Add skip-cherry-pick and skip-test-builds to Releaser. 2025-07-18 11:07:30 -06:00
George Joseph
e5f0a1467a asterisk.c: Add option to restrict shell access from remote consoles.
UserNote: A new asterisk.conf option 'disable_remote_console_shell' has
been added that, when set, will prevent remote consoles from executing
shell commands using the '!' prefix.

Resolves: #GHSA-c7p6-7mvq-8jq2
2025-05-22 14:57:34 +00:00
George Joseph
f60500e49a res_pjsip_messaging.c: Mask control characters in received From display name
Incoming SIP MESSAGEs will now have their From header's display name
sanitized by replacing any characters < 32 (space) with a space.

Resolves: #GHSA-2grh-7mhv-fcfw
2025-05-22 14:24:24 +00:00
George Joseph
aa8da54cac README.md: Updates and Fixes
* Outdated information has been removed.
* New links added.
* Placeholder added for link to change logs.

Going forward, the release process will create HTML versions of the README
and change log and will update the link in the README to the current
change log for the branch...

* In the development branches, the link will always point to the current
  release on GitHub.
* In the "releases/*" branches and the tarballs, the link will point to the
  ChangeLogs/ChangeLog-<version>.html file in the source directory.
* On the downloads website, the link will point to the
  ChangeLog-<version>.html file in the same directory.

Resolves: #1131
2025-03-13 13:15:00 +00:00
George Joseph
b1afe429d2 .github: Change concurrency group ids so they're unique.
GitHub strikes again.  Apparently the github.ref context variable only
contains the PR number if the workflow is triggered by "pull_request" so
since we just changed the trigger to "pull_request_target" the variable
no longer contains the PR number and is therefore not unique and can't be
used as a concurrency group id.  We now use
`github.triggering_actor-github.head_ref`.
2025-02-20 10:45:04 -07:00
George Joseph
ed42a21696 .github: Refactor Releaser to use reusable workflow 2025-02-16 16:30:27 -07:00
George Joseph
9daf04051d .github: Change branch of reusable workflows to main. 2025-02-16 16:25:03 -07:00
George Joseph
a5259097cb .github: Refactor to use pull_request_target trigger.
After careful review, we believe we can now use the "pull_request_target"
workflow trigger instead of "pull_request" which required a separate
privliged workflow to add labels and comments to PRs when they are submitted
or updated.  This allows us to greatly streamline our workflows and remove
unneeded ones.

* The OnPRChanged workflow was...
  * Renamed to OnPRCheck
  * Changed to trigger on pull_request_target and the "recheckpr" label.
  * Changed to simply call reusable workflows in asterisk-ci-actions.
  * Changed to use better concurrency groups.
* The OnPRCPCheck and OnPRMergeApproved workflows were also...
  * Changed to simply call reusable workflows in asterisk-ci-actions.
  * Changed to use better concurrency groups.
* The NightlyTest and CreateDocs were also tweaked
2025-02-16 12:19:43 -07:00
George Joseph
0ea1740232 .github: Remove concurrency check in on-labelled workflows.
Apparently you can't use `${{ github.event.number }}` in a concurrency
block in a job that calls a reusable workflow. :(
2025-02-11 14:01:41 -07:00
George Joseph
7be3bd7cbf .github: Move PRChanged,PRChangedPriv,PRCPCheck,PRReCheck,PRMerge logic.
Moved to asterisk-ci-actions reusable workflows.
2025-02-11 11:27:55 -07:00
George Joseph
318f885458 .github: OnPRCherryPickTest,OnPRStateChanged,OnPRRecheck: Add job summaries.
...and refactor environment variables.
2025-02-11 10:04:51 -07:00
George Joseph
ff2d916d01 .github: Clean up CreateDocs 2025-02-11 10:04:33 -07:00
Joshua C. Colp
9c1f92a962 LICENSE: Update company name, email, and address. 2025-01-23 15:43:28 +00:00
George Joseph
88f34cbd74 README.md, asterisk.c: Update Copyright Dates 2025-01-23 13:36:22 +00:00
Sean Bright
33657339d7 manager.c: Rename restrictedFile to is_restricted_file.
Also correct the spelling of 'privileges.'
2025-01-10 18:09:20 +00:00
Ben Ford
df1ed0edc8 manager.c: Restrict ListCategories to the configuration directory.
When using the ListCategories AMI action, it was possible to traverse
upwards through the directories to files outside of the configured
configuration directory. This action is now restricted to the configured
directory and an error will now be returned if the specified file is
outside of this limitation.

Resolves: #GHSA-33x6-fj46-6rfh

UserNote: The ListCategories AMI action now restricts files to the
configured configuration directory.
2025-01-09 19:05:06 +00:00
George Joseph
ef9dafd099 .github: Set exit 0 in CherryPick and Recheck workflow Cleanup steps 2025-01-05 10:37:53 -07:00
George Joseph
0f9ebc55f7 gcc14: Fix issues caught by gcc 14
* reqresp_parser.c: Fix misuse of "static" with linked list definitions
* test_message.c: Fix segfaults caused by passing NULL as an sprintf fmt
2025-01-03 23:27:48 +00:00
George Joseph
47bc60d742 .github: Change the run name for OnPRStateChangedPriv 2024-12-18 08:19:36 -07:00
George Joseph
38a18f9fbb .github: Redirect NightlyAdmin to AsteriskNightlyAdmin 2024-11-01 07:55:32 -06:00
George Joseph
678646f7d3 .github: NightlyAdmin now calls external CloseStaleIssuesAndPRs 2024-11-01 07:53:36 -06:00
Naveen Albert
485ccb7429 app_dial: Fix progress timeout calculation with no answer timeout.
If to_answer is -1, simply comparing to see if the progress timeout
is smaller than the answer timeout to prefer it will fail. Add
an additional check that chooses the progress timeout if there is
no answer timeout (or as before, if the progress timeout is smaller).

Resolves: #821
2024-10-24 13:38:29 +00:00
George Joseph
f9e8c3488b pjproject_bundled: Tweaks to support out-of-tree development
* pjproject is now configured with --disable-libsrtp so it will
  build correctly when doing "out-of-tree" development.  Asterisk
  doesn't use pjproject for handling media so pjproject doesn't
  need libsrtp itself.

* The pjsua app (which we used to use for the testsuite) no longer
  builds in pjproject's master branch so we just skip it.  The
  testsuite no longer needs it anyway.

See third-party/pjproject/README-hacking.md for more info on building
pjproject "out-of-tree".
2024-10-23 13:36:20 +00:00
Sean Bright
909b93608a chan_sip.c: Fix __sip_reliable_xmit build error
Fixes #954
2024-10-18 15:08:03 +00:00
Sean Bright
e3a0ca20b5 Revert "res_rtp_asterisk: Count a roll-over of the sequence number even on lost packets."
This reverts commit cb5e3445be.

The original change from 16 to 15 bit sequence numbers was predicated
on the following from the now-defunct libSRTP FAQ on sourceforge.net:

> *Q6. The use of implicit synchronization via ROC seems
> dangerous. Can senders and receivers lose ROC synchronization?*
>
> **A.** It is possible to lose ROC synchronization between sender and
> receiver(s), though it is not likely in practice, and practical
> steps can be taken to avoid it. A burst loss of 2^16 packets or more
> will always break synchronization. For example, a conversational
> voice codec that sends 50 packets per second will have its ROC
> increment about every 22 minutes. A network with a burst of packet
> loss that long has problems other than ROC synchronization.
>
> There is a higher sensitivity to loss at the very outset of an SRTP
> stream. If the sender's initial sequence number is close to the
> maximum value of 2^16-1, and all packets are lost from the initial
> packet until the sequence number cycles back to zero, the sender
> will increment its ROC, but the receiver will not. The receiver
> cannot determine that the initial packets were lost and that
> sequence-number rollover has occurred. In this case, the receiver's
> ROC would be zero whereas the sender's ROC would be one, while their
> sequence numbers would be so close that the ROC-guessing algorithm
> could not detect this fact.
>
> There is a simple solution to this problem: the SRTP sender should
> randomly select an initial sequence number that is always less than
> 2^15. This ensures correct SRTP operation so long as fewer than 2^15
> initial packets are lost in succession, which is within the maximum
> tolerance of SRTP packet-index determination (see Appendix A and
> page 14, first paragraph of RFC 3711). An SRTP receiver should
> carefully implement the index-guessing algorithm. A naive
> implementation can unintentionally guess the value of
> 0xffffffffffffLL whenever the SEQ in the packet is greater than 2^15
> and the locally stored SEQ and ROC are zero. (This can happen when
> the implementation fails to treat those zero values as a special
> case.)
>
> When ROC synchronization is lost, the receiver will not be able to
> properly process the packets. If anti-replay protection is turned
> on, then the desynchronization will appear as a burst of replay
> check failures. Otherwise, if authentication is being checked, then
> it will appear as a burst of authentication failures. Otherwise, if
> encryption is being used, the desynchronization may not be detected
> by the SRTP layer, and the packets may be improperly decrypted.

However, modern libSRTP (as of 1.0.1[1]) now mentions the following in
their README.md[2]:

> The sequence number in the rtp packet is used as the low 16 bits of
> the sender's local packet index. Note that RTP will start its
> sequence number in a random place, and the SRTP layer just jumps
> forward to that number at its first invocation. An earlier version
> of this library used initial sequence numbers that are less than
> 32,768; this trick is no longer required as the
> rdbx_estimate_index(...) function has been made smarter.

So truncating our initial sequence number to 15 bit is no longer
necessary.

1. 0eb007f0dc/CHANGES (L271-L289)
2. 2de20dd9e9/README.md (implementation-notes)
2024-10-17 16:29:55 +00:00
George Joseph
d6ffbff333 core_unreal.c: Fix memory leak in ast_unreal_new_channels()
When the channel tech is multistream capable, the reference to
chan_topology was passed to the new channel.  When the channel tech
isn't multistream capable, the reference to chan_topology was never
released.  "Local" channels are multistream capable so it didn't
affect them but the confbridge "CBAnn" and the bridge_media
"Recorder" channels are not so they caused a leak every time one
of them was created.

Also added tracing to ast_stream_topology_alloc() and
stream_topology_destroy() to assist with debugging.

Resolves: #938
2024-10-17 15:20:34 +00:00
Allan Nathanson
99221c81ed dnsmgr.c: dnsmgr_refresh() incorrectly flags change with DNS round-robin
The dnsmgr_refresh() function checks to see if the IP address associated
with a name/service has changed. The gotcha is that the ast_get_ip_or_srv()
function only returns the first IP address returned by the DNS query. If
there are multiple IPs associated with the name and the returned order is
not consistent (e.g. with DNS round-robin) then the other IP addresses are
not included in the comparison and the entry is flagged as changed even
though the IP is still valid.

Updated the code to check all IP addresses and flag a change only if the
original IP is no longer valid.

Resolves: #924
2024-10-10 15:34:22 +00:00
George Joseph
f9d5d659c6 geolocation.sample.conf: Fix comment marker at end of file
Resolves: #937
2024-10-10 13:05:50 +00:00
Sean Bright
fae5d21b6a func_base64.c: Ensure we set aside enough room for base64 encoded data.
Reported by SingularTricycle on IRC.

Fixes #940
2024-10-10 13:05:45 +00:00
Naveen Albert
62b6ea3202 app_dial: Fix progress timeout.
Under some circumstances, the progress timeout feature added in commit
320c98eec8 does not work as expected,
such as if there is no media flowing. Adjust the waitfor call to
explicitly use the progress timeout if it would be reached sooner than
the answer timeout to ensure we handle the timers properly.

Resolves: #821
2024-10-08 14:17:48 +00:00
Naveen Albert
fa614f755d chan_dahdi: Never send MWI while off-hook.
In some circumstances, it is possible for the do_monitor thread to
erroneously think that a line is on-hook and send an MWI FSK spill
to it when the line is really off-hook and no MWI should be sent.
Commit 0a8b3d3467 previously fixed this
issue in a more readily encountered scenario, but it has still been
possible for MWI to be sent when it shouldn't be. To robustly fix
this issue, query DAHDI for the hook status to ensure we don't send
MWI on a line that is actually still off hook.

Resolves: #928
2024-10-08 14:17:43 +00:00
George Joseph
29e0d77765 manager.c: Add unit test for Originate app and appdata permissions
This unit test checks that dialplan apps and app data specified
as parameters for the Originate action are allowed with the
permissions the user has.
2024-10-08 13:40:15 +00:00
Sean Bright
776bb8c56b alembic: Drop redundant voicemail_messages index.
The `voicemail_messages_dir` index is a left prefix of the table's
primary key and therefore unnecessary.
2024-10-01 15:44:44 +00:00
Sean Bright
c80ce750bb res_agi.c: Ensure SIGCHLD handler functions are properly balanced.
Calls to `ast_replace_sigchld()` and `ast_unreplace_sigchld()` must be
balanced to ensure that we can capture the exit status of child
processes when we need to. This extends to functions that call
`ast_replace_sigchld()` and `ast_unreplace_sigchld()` such as
`ast_safe_fork()` and `ast_safe_fork_cleanup()`.

The primary change here is ensuring that we do not call
`ast_safe_fork_cleanup()` in `res_agi.c` if we have not previously
called `ast_safe_fork()`.

Additionally we reinforce some of the documentation and add an
assertion to, ideally, catch this sooner were this to happen again.

Fixes #922
2024-10-01 15:01:28 +00:00
Naveen Albert
f415e313b4 main, res, tests: Fix compilation errors on FreeBSD.
asterisk.c, manager.c: Increase buffer sizes to avoid truncation warnings.
config.c: Include header file for WIFEXITED/WEXITSTATUS macros.
res_timing_kqueue: Use more portable format specifier.
test_crypto: Use non-linux limits.h header file.

Resolves: #916
2024-10-01 14:22:46 +00:00
George Joseph
ec2e26cfe7 res_rtp_asterisk: Fix dtls timer issues causing FRACKs and SEGVs
In dtls_srtp_handle_timeout(), when DTLSv1_get_timeout() returned
success but with a timeout of 0, we were stopping the timer and
decrementing the refcount on instance but not resetting the
timeout_timer to -1.  When dtls_srtp_stop_timeout_timer()
was later called, it was atempting to stop a stale timer and could
decrement the refcount on instance again which would then cause
the instance destructor to run early.  This would result in either
a FRACK or a SEGV when ast_rtp_stop(0 was called.

According to the OpenSSL docs, we shouldn't have been stopping the
timer when DTLSv1_get_timeout() returned success and the new timeout
was 0 anyway.  We should have been calling DTLSv1_handle_timeout()
again immediately so we now reschedule the timer callback for
1ms (almost immediately).

Additionally, instead of scheduling the timer callback at a fixed
interval returned by the initial call to DTLSv1_get_timeout()
(usually 999 ms), we now reschedule the next callback based on
the last call to DTLSv1_get_timeout().

Resolves: #487
2024-10-01 14:22:40 +00:00
Ben Ford
5a237235c0 manager.c: Restrict ModuleLoad to the configured modules directory.
When using the ModuleLoad AMI action, it was possible to traverse
upwards through the directories to files outside of the configured
modules directory. We decided it would be best to restrict access to
modules exclusively in the configured directory. You will now get an
error when the specified module is outside of this limitation.

Fixes: #897

UserNote: The ModuleLoad AMI action now restricts modules to the
configured modules directory.
2024-09-30 16:28:38 +00:00
jiangxc
e1da2fec42 res_agi.c: Prevent possible double free during SPEECH RECOGNIZE
When using the speech recognition module, crashes can occur
sporadically due to a "double free or corruption (out)" error. Now, in
the section where the audio stream is being captured in a loop, each
time after releasing fr, it is set to NULL to prevent repeated
deallocation.

Fixes #772
2024-09-30 16:23:38 +00:00
Sean Bright
9da3bdefef cdr_custom: Allow absolute filenames.
A follow up to #893 that brings the same functionality to
cdr_custom. Also update the sample configuration files to note support
for absolute paths.
2024-09-30 15:32:36 +00:00
Naveen Albert
b29776a5b0 astfd.c: Avoid calling fclose with NULL argument.
Don't pass through a NULL argument to fclose, which is undefined
behavior, and instead return -1 and set errno appropriately. This
also avoids a compiler warning with glibc 2.38 and newer, as glibc
commit 71d9e0fe766a3c22a730995b9d024960970670af
added the nonnull attribute to this argument.

Resolves: #900
2024-09-25 18:27:14 +00:00
Peter Jannesen
e522eb6357 channel: Preserve CHANNEL(userfield) on masquerade.
In certain circumstances a channel may undergo an operation
referred to as a masquerade. If this occurs the CHANNEL(userfield)
value was not preserved causing it to get lost. This change makes
it so that this field is now preserved.

Fixes: #882
2024-09-25 17:03:25 +00:00
Peter Jannesen
9e76533f90 cel_custom: Allow absolute filenames.
If a filename starts with a '/' in cel_custom [mappings] assume it is
a absolute file path and not relative filename/path to
AST_LOG_DIR/cel_custom/
2024-09-25 17:02:32 +00:00
Naveen Albert
44a6349b69 app_voicemail: Fix ill-formatted pager emails with custom subject.
Add missing end-of-headers newline to pager emails with custom
subjects, since this was missing from this code path.

Resolves: #902
2024-09-25 17:00:55 +00:00
Sean Bright
a6db5455ac res_pjsip_pubsub: Persist subscription 'generator_data' in sorcery
Fixes #895
2024-09-25 16:51:13 +00:00
George Joseph
e0ca3a634c stir_shaken: Fix propagation of attest_level and a few other values
attest_level, send_mky and check_tn_cert_public_url weren't
propagating correctly from the attestation object to the profile
and tn.

* In the case of attest_level, the enum needed to be changed
so the "0" value (the default) was "NOT_SET" instead of "A".  This
now allows the merging of the attestation object, profile and tn
to detect when a value isn't set and use the higher level value.

* For send_mky and check_tn_cert_public_url, the tn default was
forced to "NO" which always overrode the profile and attestation
objects.  Their defaults are now "NOT_SET" so the propagation
happens correctly.

* Just to remove some redundant code in tn_config.c, a bunch of calls to
generate_sorcery_enum_from_str() and generate_sorcery_enum_to_str() were
replaced with a single call to generate_acfg_common_sorcery_handlers().

Resolves: #904
2024-09-25 16:35:26 +00:00