Skip to content

Commit

Permalink
Make the update server url use the Marti API port so it works whether…
Browse files Browse the repository at this point in the history
… the server uses Let's Encrypt or not
  • Loading branch information
brian7704 committed Sep 20, 2024
1 parent c729d57 commit e2f1b0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion opentakserver/blueprints/device_profile_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create_profile_zip(enrollment=True, syncSecago=-1):
enable_update_server.text = "true"

update_server_address = SubElement(pref, "entry", {"key": "atakUpdateServerUrl", "class": "class java.lang.String"})
update_server_address.text = f"https://{urlparse(request.url_root).hostname}/api/packages"
update_server_address.text = f"https://{urlparse(request.url_root).hostname}:{app.config.get('OTS_MARTI_HTTPS_PORT')}/api/packages"

startup_sync = SubElement(pref, "entry", {"key": "repoStartupSync", "class": "class java.lang.Boolean"})
startup_sync.text = "true"
Expand Down
3 changes: 2 additions & 1 deletion opentakserver/certificate_authority.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def generate_zip(self, common_name):
<entry key="clientPassword" class="class java.lang.String">{{ cert_password }}</entry>
<entry key="certificateLocation" class="class java.lang.String">/storage/emulated/0/atak/cert/{{ user_filename }}</entry>
<entry key="appMgmtEnableUpdateServer" class="class java.lang.Boolean">true</entry>
<entry key="atakUpdateServerUrl" class="class java.lang.String">https://{{ server }}/api/packages</entry>
<entry key="atakUpdateServerUrl" class="class java.lang.String">https://{{ server }}:{{ marti_port }}/api/packages</entry>
<entry key="repoStartupSync" class="class java.lang.Boolean">true</entry>
<entry key="updateServerCaLocation" class="class java.lang.String">/storage/emulated/0/atak/cert/{{ server_filename }}</entry>
<entry key="updateServerCaPassword" class="class java.lang.String">{{ cert_password }}</entry>
Expand Down Expand Up @@ -299,6 +299,7 @@ def generate_zip(self, common_name):
""")

pref = pref_file_template.render(server=urlparse(request.url_root).hostname,
marti_port=self.app.config.get('OTS_MARTI_HTTPS_PORT'),
server_filename="truststore-root.p12",
user_filename=f"{common_name}.p12",
cert_password=self.app.config.get("OTS_CA_PASSWORD"),
Expand Down

0 comments on commit e2f1b0e

Please sign in to comment.