phreakscript icon indicating copy to clipboard operation
phreakscript copied to clipboard

IAX configuration duplicated by res_phreaknet

Open ssterling opened this issue 4 months ago • 7 comments

iax.conf, as well as every file included by iax.conf (for me, in iax.d/), is duplicated when res_phreaknet tries to fetch new RSA keys on Asterisk restart. This only started today, and I haven’t updated anything. The following is a log from after I deleted all the duplicate contexts:

[Sep 10 17:00:47] Asterisk Ready.
[Sep 10 17:00:47] WARNING[185439]: res_phreaknet.c:1452 find_bindport: Invalid IAX2 bindport 4569
[Sep 10 17:00:47]     -- Reloading module 'res_crypto.so' (Cryptographic Digital Signatures)
[Sep 10 17:00:47] WARNING[185439]: res_crypto.c:322 try_load_key: Key load PUBLIC 'phreaknet-rsa-roadriverrail.mdns.org' failed
[Sep 10 17:00:47]   == Saving tryinclude '/etc/asterisk/iax.d/*.conf'
[Sep 10 17:00:47]   == Saving tryinclude '/etc/asterisk/iax-phreaknet-rsa-in.conf'
[Sep 10 17:00:47]   == Saving '/etc/asterisk/iax.conf'
[Sep 10 17:00:47]   == Saving '/etc/asterisk/iax.conf': saved
[Sep 10 17:00:47]     -- Reloading module 'res_crypto.so' (Cryptographic Digital Signatures)
[Sep 10 17:00:47] WARNING[185439]: res_crypto.c:322 try_load_key: Key load PUBLIC 'phreaknet-rsa-roadriverrail.mdns.org' failed
[Sep 10 17:00:47]     -- Reloading module 'chan_iax2.so' (Inter Asterisk eXchange (Ver 2))
[Sep 10 17:00:47] WARNING[185439]: config.c:380 ast_include_new: '/etc/asterisk/iax.d/phreaknet.conf', line 89:  Same File included more than once! This data will be sa
ved in iax-phreaknet-rsa-in.conf~~1 if saved back to disk.
[Sep 10 17:00:47] NOTICE[185439]: chan_iax2.c:13798 set_config: Ignoring bindport on reload
[Sep 10 17:00:47] ERROR[185439]: iax2/netsock.c:128 ast_netsock_bindaddr: Unable to bind to 0.0.0.0:4569: Address already in use
[Sep 10 17:00:47] ERROR[185439]: chan_iax2.c:14105 set_config: Unable to create network socket: Address already in use
[Sep 10 17:00:47] WARNING[185439]: chan_iax2.c:13442 build_user: Auth method for user 'cnet' is set to deprecated 'plaintext' at line 16 of iax.conf
[Sep 10 17:00:47] WARNING[185439]: chan_iax2.c:13116 build_peer: Auth method for peer 'cnet' is set to deprecated 'plaintext' at line 16 of iax.conf
[Sep 10 17:00:47] WARNING[185439]: chan_iax2.c:13442 build_user: Auth method for user 'cnet' is set to deprecated 'plaintext' at line 28 of iax.conf
[Sep 10 17:00:47] WARNING[185439]: chan_iax2.c:13116 build_peer: Auth method for peer 'cnet' is set to deprecated 'plaintext' at line 28 of iax.conf
[Sep 10 17:00:47] WARNING[185439]: chan_iax2.c:13442 build_user: Auth method for user 'hylafax' is set to deprecated 'plaintext' at line 41 of iax.conf
[Sep 10 17:00:47] WARNING[185439]: chan_iax2.c:13116 build_peer: Auth method for peer 'hylafax' is set to deprecated 'plaintext' at line 41 of iax.conf
[Sep 10 17:00:47] WARNING[185439]: chan_iax2.c:13442 build_user: Auth method for user 'hylafax' is set to deprecated 'plaintext' at line 56 of iax.conf
[Sep 10 17:00:47] WARNING[185439]: chan_iax2.c:13116 build_peer: Auth method for peer 'hylafax' is set to deprecated 'plaintext' at line 56 of iax.conf

Frankly, I’m having trouble wrapping my head around res_phreaknet.c, and I thought y’all might know what’s going on.

ssterling avatar Sep 10 '25 23:09 ssterling

The use of a separate iax.d directory is new to me in this context... if you have them all in the same directory, does this still happen?

InterLinked1 avatar Sep 11 '25 00:09 InterLinked1

Yes, it still happens. I’m thinking it has something to do with wildcards, because, with there now being an #include "iax-*.conf, there’s now a file called iax-*.conf being made. Including the files one-by-one, however, solves the problem, although maintaining that list will be tedious. Logs are now as such:

[Sep 11 08:38:26] Asterisk Ready.
[Sep 11 08:38:27] WARNING[207423]: res_phreaknet.c:1452 find_bindport: Invalid IAX
2 bindport 4569
[Sep 11 08:38:27]     -- Reloading module 'res_crypto.so' (Cryptographic Digital S
ignatures)
[Sep 11 08:38:27] WARNING[207423]: res_crypto.c:322 try_load_key: Key load PUBLIC
'phreaknet-rsa-roadriverrail.mdns.org' failed
[Sep 11 08:38:27]   == Saving tryinclude '/etc/asterisk/iax.d/cnet.conf'
[Sep 11 08:38:27]   == Saving tryinclude '/etc/asterisk/iax.d/hylafax.conf'
[Sep 11 08:38:27]   == Saving tryinclude '/etc/asterisk/iax.d/phreaknet.conf'
[Sep 11 08:38:27]   == Saving tryinclude '/etc/asterisk/iax-phreaknet-rsa-in.conf'
[Sep 11 08:38:27]   == Saving tryinclude '/etc/asterisk/iax.d/shadytel.conf'
[Sep 11 08:38:27]   == Saving tryinclude '/etc/asterisk/iax.d/tandmx.conf'
[Sep 11 08:38:27]   == Saving tryinclude '/etc/asterisk/iax.d/uwutel.conf'
[Sep 11 08:38:27]   == Saving tryinclude '/etc/asterisk/iax.d/voipms.conf'
[Sep 11 08:38:27]   == Saving tryinclude '/etc/asterisk/iax.d/yorkstream.conf'
[Sep 11 08:38:27]   == Saving '/etc/asterisk/iax.conf'
[Sep 11 08:38:27]   == Saving '/etc/asterisk/iax.conf': saved
[Sep 11 08:38:27]     -- Reloading module 'res_crypto.so' (Cryptographic Digital Signatures)
[Sep 11 08:38:27] WARNING[207423]: res_crypto.c:322 try_load_key: Key load PUBLIC 'phreaknet-rsa-roadriverrail.mdns.org' failed
[Sep 11 08:38:27]     -- Reloading module 'chan_iax2.so' (Inter Asterisk eXchange (Ver 2))
[Sep 11 08:38:27] NOTICE[207423]: chan_iax2.c:13798 set_config: Ignoring bindport on reload
[Sep 11 08:38:27] ERROR[207423]: iax2/netsock.c:128 ast_netsock_bindaddr: Unable to bind to 0.0.0.0:4569: Address already in use
[Sep 11 08:38:27] ERROR[207423]: chan_iax2.c:14105 set_config: Unable to create network socket: Address already in use
[Sep 11 08:38:27] WARNING[207423]: chan_iax2.c:13442 build_user: Auth method for user 'cnet' is set to deprecated 'plaintext' at line 15 of iax.conf
[Sep 11 08:38:27] WARNING[207423]: chan_iax2.c:13116 build_peer: Auth method for peer 'cnet' is set to deprecated 'plaintext' at line 15 of iax.conf
[Sep 11 08:38:27] WARNING[207423]: chan_iax2.c:13442 build_user: Auth method for user 'hylafax' is set to deprecated 'plaintext' at line 15 of iax.conf
[Sep 11 08:38:27] WARNING[207423]: chan_iax2.c:13116 build_peer: Auth method for peer 'hylafax' is set to deprecated 'plaintext' at line 15 of iax.conf

There’s now this annoying header in each IAX-related file, though:

;!
;! Automatically generated configuration file
;! Filename: iax.conf (/etc/asterisk/iax.d/cnet.conf)
;! Generator: res_phreaknet
;! Creation Date: Thu Sep 11 08:38:27 2025
;!

ssterling avatar Sep 11 '25 12:09 ssterling

I think this is very possibly a bug in Asterisk's config APIs, not in res_phreaknet. At least, I'm not seeing anything that could have to do with wildcards, and the config APIs have been known to be buggy in different ways.

(I've asked someone to give his opinion on this)

InterLinked1 avatar Sep 11 '25 13:09 InterLinked1

@ssterling You don't mention what version of Asterisk you are running. There were issues with Asterisk's config APIs with #include / #tryinclude statements. If you are running a recent -20, -21, -22 build you should be OK (you'd need the changes from https://github.com/asterisk/asterisk/pull/918).

@InterLinked1 Looks like res_phreaknet includes a few calls to ast_config_text_file_save2() ... and it's that API call that triggers all of the updates.

As for the "Automatically generated" header updates, I agree that they are annoying. Seems like the config APIs should be smart enough to leave a file alone if there were no changes.

Allan-N avatar Sep 11 '25 14:09 Allan-N

@ssterling Please confirm if you have the latest version and the patches Allan mentioned.

Seems like the config APIs should be smart enough to leave a file alone if there were no changes.

I would agree on that too.

InterLinked1 avatar Sep 12 '25 18:09 InterLinked1

@ssterling Please confirm if you have the latest version and the patches Allan mentioned.

I regularly forget to check GitHub; sorry. Anyway, I’m running Asterisk 22.5.1, and the patches are in the source I used to build this.

ssterling avatar Sep 28 '25 21:09 ssterling

iax.conf, as well as every file included by iax.conf (for me, in iax.d/), is duplicated

Can you explain this in more detail? What exactly is "duplicated"? Where does the duplication show up? Can you share a "before" and "after" example?

Allan-N avatar Sep 29 '25 01:09 Allan-N