Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/bncert] Add support for IPv6 #17

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LEGO_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.9.1
4.15.0
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.1
2.0.0
3 changes: 2 additions & 1 deletion project/base-functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ Copyrighted by BitRock
<variable>timestamp</variable>
</createTimeStamp>
<setInstallerVariable name="installer_http_code" value="0"/>
<httpGet url="${url}" filename="${system_temp_directory}/http_get_${timestamp}.txt" abortOnError="0" showMessageOnError="0"/>
<!-- httpGet can't handle IPv6 connections -->
<runProgram program="curl" programArguments="-L '${url}' -o '${system_temp_directory}/http_get_${timestamp}.txt'" abortOnError="0" showMessageOnError="0"/>
<setInstallerVariable name="valid_url" value="0">
<ruleList>
<compareText text="${installer_http_code}" logic="does_not_equal" value="200"/>
Expand Down
49 changes: 0 additions & 49 deletions project/bncert-functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,55 +84,6 @@
</actionGroup>
</actionList>
</actionDefinition>
<actionDefinition name="bncertValidateDomain">
<parameterList>
<stringParameter name="domain"/>
</parameterList>
<actionList>
<setInstallerVariable name="ignore_public_ip_warning" value="no"/>
<!-- Obtain public IP address, but only once -->
<actionGroup>
<actionList>
<getPublicIpAddress variable="machine_public_ipaddr" progressText="Determining machine public IP address"/>
<actionGroup>
<actionList>
<showQuestion title="Could not detect public IP address" text="&#xA;The public IP address for this machine could not be detected. A public IP address will be required for Let's Encrypt to verify that your domains point to this machine. Do you want to proceed anyways?" variable="ignore_public_ip_warning" default="no"/>
<throwError text="Please check public IP configuration for this machine. For more info see: https://docs.bitnami.com/general/faq/configuration/configure-static-address/">
<ruleList>
<isFalse value="${ignore_public_ip_warning}"/>
</ruleList>
</throwError>
</actionList>
<ruleList>
<stringTest text="${machine_public_ipaddr}" type="empty"/>
</ruleList>
</actionGroup>
</actionList>
<ruleList>
<isTrue value="${perform_public_ip_validation}"/>
<stringTest text="${machine_public_ipaddr}" type="empty"/>
<isFalse value="${ignore_public_ip_warning}"/>
</ruleList>
</actionGroup>
<!-- Now validate the domain DNS and ensure the IP matches -->
<if>
<conditionRuleList>
<hostValidation host="${domain}" type="hostname" condition="is_not_valid"/>
</conditionRuleList>
<actionList>
<throwError text="The domain '${domain}' does not resolve, please fix its DNS entries or remove it."/>
</actionList>
<elseActionList>
<throwError text="The domain '${domain}' resolves to a different IP address than the one detected for this machine, which is '${machine_public_ipaddr}'. Please fix its DNS entries or remove it. For more info see: https://docs.bitnami.com/general/faq/configuration/configure-custom-domain/">
<ruleList>
<validateDomainIpAddressResolution domain="${domain}" ipAddress="${machine_public_ipaddr}" negate="1"/>
<isTrue value="${perform_public_ip_validation}"/>
</ruleList>
</throwError>
</elseActionList>
</if>
</actionList>
</actionDefinition>
<!-- Parameters for updating metadata -->
<actionDefinition name="bncertDetectMissingDomains">
<parameterList>
Expand Down
3 changes: 2 additions & 1 deletion project/bncert-letsencrypt-functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ Please check our documentation and support forums, we'll be happy to help!
<writeFile path="${lego_app_dir}/.well-known/${tmpFile}" text="${randomString}"/>
<foreach variables="domain" values="${domains}">
<actionList>
<httpGet abortOnError="0" showMessageOnError="0" url="https://${domain}/.well-known/${tmpFile}" filename="${system_temp_directory}/${tmpFile}"/>
<!-- httpGet can't handle IPv6 connections -->
<runProgram abortOnError="0" showMessageOnError="1" program="curl" programArguments="-L 'https://${domain}/.well-known/${tmpFile}' -o '${system_temp_directory}/${tmpFile}'"/>
<readFile abortOnError="0" showMessageOnError="0" path="${system_temp_directory}/${tmpFile}" name="result"/>
<actionGroup>
<actionList>
Expand Down
23 changes: 0 additions & 23 deletions project/bncert.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,6 @@
<regExMatch pattern="[a-z0-9.-]{64}" logic="matches" text="${domains}"/>
</ruleList>
</throwError>
<showProgressDialog title="Validating domains">
<actionList>
<!-- Validate domain DNS entries -->
<foreach variables="domain" values="${domains}">
<actionList>
<bncertValidateDomain domain="${domain}" progressText="Validating domain '${domain}'"/>
</actionList>
<ruleList>
<isTrue value="${perform_dns_validation}"/>
</ruleList>
</foreach>
</actionList>
</showProgressDialog>
</validationActionList>
</parameterGroup>
<!-- The below parameter is skipped, but we will return to it if the user rejects the list of proposed changes -->
Expand Down Expand Up @@ -306,16 +293,6 @@
<validationActionList>
<showProgressDialog title="Performing validations">
<actionList>
<!-- Validate domain DNS entries -->
<!-- This time we also validate automatically added domains (e.g. www.example.com if only example.com was added) -->
<foreach variables="domain" values="${domains}">
<actionList>
<bncertValidateDomain domain="${domain}" progressText="Validating domain '${domain}'"/>
</actionList>
<ruleList>
<isTrue value="${perform_dns_validation}"/>
</ruleList>
</foreach>
<!-- We stop the web server at this point, in order to verify we can proceed with the setup -->
<bncertStopWebServer webServerName="${web_server_name}" progressText="Stopping web server">
<ruleList>
Expand Down
34 changes: 0 additions & 34 deletions project/vmtools-functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -561,40 +561,6 @@ ${targetDir}/${project.shortName}-tool ${installer_command_line_arguments}
<isServiceRunning service="varnish"/>
</ruleList>
</ruleDefinition>
<ruleDefinition name="validateDomainIpAddressResolution">
<parameterList>
<stringParameter name="domain"/>
<stringParameter name="ipAddress"/>
</parameterList>
<actionList>
<setInstallerVariable name="detected_ip_address" value=""/>
<runProgram program="getent" programArguments="hosts ${domain}" abortOnError="0" showMessageOnError="0"/>
<setInstallerVariableFromRegEx name="detected_ip_address" pattern="^([0-9.]+)\s.*$" substitution="\1" text="${program_stdout}">
<ruleList>
<regExMatch text="${program_stdout}" logic="matches" pattern="^([0-9.]+)\s.*$"/>
<compareText text="${program_exit_code}" logic="equals" value="0"/>
</ruleList>
</setInstallerVariableFromRegEx>
</actionList>
<ruleList>
<compareText text="${detected_ip_address}" logic="equals" value="${ipAddress}"/>
</ruleList>
</ruleDefinition>
<actionDefinition name="getPublicIpAddress">
<parameterList>
<stringParameter name="variable"/>
</parameterList>
<actionList>
<!-- Get the public IP from myip.bitnami.com -->
<globalVariables names="${variable}"/>
<generateRandomValue length="10" variable="suffix"/>
<setInstallerVariable name="filename" value="${system_temp_directory}/myip${suffix}.tmp"/>
<httpGet url="http://myip.bitnami.com" filename="${filename}" abortOnError="0" showMessageOnError="0"/>
<readFile path="${filename}" name="${variable}"/>
<deleteFile path="${filename}"/>
<logMessage text="Detected public IP address: '${${variable}}'"/>
</actionList>
</actionDefinition>
<actionDefinition name="grepText">
<parameterList>
<stringParameter name="text"/>
Expand Down
Loading