Repository navigation
Reject non-numeric Sysadmin ports before comparing them to 80 - #38
Open
BradKollmyer wants to merge 1 commit into
Open
BradKollmyer wants to merge 1 commit into
BradKollmyer wants to merge 1 commit into
Conversation
On PHP 8, "disabled" >= 80 is true, so HTTP, HTTPS, and LetsEncrypt service discovery handed iptables the port string "disabled". Responsive LetsEncrypt rules then never opened TCP 80. Refs FreePBX/issue-tracker#1335
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the PHP 8 port comparison reported in FreePBX/issue-tracker#1335.
Services.class.phponrelease/17.0(17.0.2.1) still accepts Sysadmin's"disabled"as a port in three places:acp(HTTP)sslacp(HTTPS)leport(Let's Encrypt)On PHP 8 a non-numeric string compared with
>= 80is compared as a string, so"disabled" >= 80is true. PHP 7 cast that string to0and the check failed closed. The other Sysadmin port lookups in this file already skip"disabled".restapi/sslrestapicast with(int)first, which is also safe.When
leportis disabled, responsive Let's Encrypt rules callenableLeRules()with port"disabled". iptables rejects it (invalid port/service 'disabled'), and the temporary port-80 opening never happens. HTTP-01 renewal then cannot be reached from the internet. The same bad port is what fillsfirewall.errin issue 1335.is_numeric()rejects"disabled"and any other non-port string. A!== 'disabled'guard, as the issue suggests and as UCP already uses, fixes this sentinel.is_numeric()also covers other non-numeric Sysadmin values.Checked on a FreePBX 17 / PHP 8.2 host with
leportdisabled: after this guard,enableLeRules()adds real port 80 (from the HTTP service'sleportflag) instead of the stringdisabled.