Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ee2cdd9
Fix time drift for private operator
caroline-ttd Jan 15, 2026
17f0487
[CI Pipeline] Released Snapshot version: 5.63.23-alpha-203-SNAPSHOT
Jan 15, 2026
1e53d3a
Add more timestamps in log
caroline-ttd Jan 15, 2026
29ffb43
Merge branch 'ccm-UID2-6489-add-sync-fix-time-drift' of github.com:IA…
caroline-ttd Jan 15, 2026
9683f2d
Test, add a drift on boot
caroline-ttd Jan 15, 2026
84bab6b
[CI Pipeline] Released Snapshot version: 5.63.24-alpha-205-SNAPSHOT
Jan 15, 2026
4500752
Update the test case
caroline-ttd Jan 15, 2026
ea7e12b
Merge branch 'ccm-UID2-6489-drift' of github.com:IABTechLab/uid2-oper…
caroline-ttd Jan 15, 2026
c15a42f
[CI Pipeline] Released Snapshot version: 5.63.25-alpha-206-SNAPSHOT
Jan 15, 2026
f9a080c
Update to drift correction once a day
caroline-ttd Jan 16, 2026
7637e3d
Merge branch 'ccm-UID2-6489-drift' of github.com:IABTechLab/uid2-oper…
caroline-ttd Jan 16, 2026
a1517b6
[CI Pipeline] Released Snapshot version: 5.63.26-alpha-207-SNAPSHOT
Jan 16, 2026
338fc46
Remove unused parameters
caroline-ttd Jan 16, 2026
3dd3f84
Merge branch 'ccm-UID2-6489-drift' of github.com:IABTechLab/uid2-oper…
caroline-ttd Jan 16, 2026
aa92c63
Address comments
caroline-ttd Jan 28, 2026
63ea32c
[CI Pipeline] Released Snapshot version: 5.63.27-alpha-208-SNAPSHOT
Jan 28, 2026
6aecf6c
Add echo update the time
caroline-ttd Jan 28, 2026
3de24ae
Merge branch 'ccm-UID2-6489-drift' of github.com:IABTechLab/uid2-oper…
caroline-ttd Jan 28, 2026
550f0de
Add test
caroline-ttd Jan 28, 2026
97c6e98
[CI Pipeline] Released Snapshot version: 5.63.28-alpha-209-SNAPSHOT
Jan 28, 2026
1f7dad7
Switch to cronjob on host as no systemd running in enclave
caroline-ttd Jan 29, 2026
b7533c2
[CI Pipeline] Released Snapshot version: 5.63.29-alpha-210-SNAPSHOT
Jan 29, 2026
cdf4a81
Update
caroline-ttd Jan 29, 2026
69506d1
Merge branch 'ccm-UID2-6489-drift' of github.com:IABTechLab/uid2-oper…
caroline-ttd Jan 29, 2026
df51544
[CI Pipeline] Released Snapshot version: 5.63.30-alpha-211-SNAPSHOT
Jan 29, 2026
3bc3188
Update log printout
caroline-ttd Jan 29, 2026
cb04ca4
[CI Pipeline] Released Snapshot version: 5.63.31-alpha-212-SNAPSHOT
Jan 29, 2026
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 pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.uid2</groupId>
<artifactId>uid2-operator</artifactId>
<version>5.63.22</version>
<version>5.63.31-alpha-212-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
8 changes: 8 additions & 0 deletions scripts/aws/config-server/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from flask import Flask
from datetime import datetime, timezone
import json
import os

Expand All @@ -11,8 +12,15 @@
secret_value = secret_file.read().strip()
secret_value_json = json.loads(secret_value)
return json.dumps(secret_value_json)
except Exception as e:

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
return str(e), 500

@app.route('/getCurrentTime', methods=['GET'])
def get_time():
try:
return datetime.now(timezone.utc).isoformat(timespec="seconds")
except Exception as e:
return str(e), 500

if __name__ == '__main__':
app.run(processes=8)
77 changes: 77 additions & 0 deletions scripts/aws/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,83 @@ ifconfig lo 127.0.0.1
echo "Starting vsock proxy..."
/app/vsockpx --config /app/proxies.nitro.yaml --daemon --workers $(( ( $(nproc) + 3 ) / 4 )) --log-level 3

TIME_SYNC_URL="http://127.0.0.1:27015/getCurrentTime"
TIME_SYNC_PROXY="socks5h://127.0.0.1:3305"
TIME_SYNC_TRIGGER_PORT="${TIME_SYNC_TRIGGER_PORT:-27100}"
TIME_SYNC_OFFSET_SECONDS="${TIME_SYNC_OFFSET_SECONDS:-30}"

sync_enclave_time_with_offset_once() {
local current_time
local parent_epoch
if current_time=$(curl -s -f -x socks5h://127.0.0.1:3305 "${TIME_SYNC_URL}"); then
parent_epoch=$(date -u -d "${current_time}" +%s 2>/dev/null || true)
if [[ -n "${parent_epoch}" ]]; then
parent_epoch=$((parent_epoch + TIME_SYNC_OFFSET_SECONDS))
if ! date -u -s "@${parent_epoch}"; then
echo "Time sync: failed to set enclave time from '${current_time}' with offset ${TIME_SYNC_OFFSET_SECONDS}s"
return 1
fi
echo "Time sync: updated enclave time to ${current_time} + ${TIME_SYNC_OFFSET_SECONDS}s"
fi
else
echo "Time sync: failed to fetch time from parent instance"
return 1
fi
}

sync_enclave_time_with_offset_once || true



start_time_sync_server() {
python3 -u - <<'PY' &
import sys
import os
import subprocess
from http.server import BaseHTTPRequestHandler, HTTPServer

sys.stdout.reconfigure(line_buffering=True)

TIME_SYNC_URL = os.environ.get("TIME_SYNC_URL", "http://127.0.0.1:27015/getCurrentTime")
TIME_SYNC_PROXY = os.environ.get("TIME_SYNC_PROXY", "socks5h://127.0.0.1:3305")
TIME_SYNC_TRIGGER_PORT = int(os.environ.get("TIME_SYNC_TRIGGER_PORT", "27100"))

def sync_time() -> str:
current_time = subprocess.check_output(
["curl", "-sSf", "-x", TIME_SYNC_PROXY, TIME_SYNC_URL],
text=True,
).strip()
subprocess.check_call(["date", "-u", "-s", current_time])
return current_time

class Handler(BaseHTTPRequestHandler):
def do_GET(self) -> None:
if self.path not in ("/", "/sync"):
self.send_response(404)
self.end_headers()
return
try:
result = sync_time()
print(f"Time sync: updated enclave time to {result}", flush=True)
self.send_response(200)
self.end_headers()
self.wfile.write(f"OK {result}\n".encode())
except Exception as exc: # pragma: no cover - best effort logging
print(f"Time sync error: {exc}", flush=True)
self.send_response(500)
self.end_headers()
self.wfile.write(f"ERROR {exc}\n".encode())

def log_message(self, format, *args): # noqa: N802 - match base class
return

server = HTTPServer(("127.0.0.1", TIME_SYNC_TRIGGER_PORT), Handler)
server.serve_forever()
PY
}

start_time_sync_server

build_parameterized_config() {
curl -s -f -o "${PARAMETERIZED_CONFIG}" -x socks5h://127.0.0.1:3305 http://127.0.0.1:27015/getConfig
REQUIRED_KEYS=("optout_base_url" "core_base_url" "core_api_token" "optout_api_token" "environment" "uid_instance_id_prefix")
Expand Down
5 changes: 5 additions & 0 deletions scripts/aws/proxies.host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ syslogng:
service: direct
listen: vsock://-1:2011
connect: tcp://127.0.0.1:2011
time-sync:
service: direct
listen: tcp://127.0.0.1:27100
connect: vsock://42:27100

5 changes: 5 additions & 0 deletions scripts/aws/proxies.nitro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ syslogng:
service: direct
listen: tcp://127.0.0.1:2011
connect: vsock://3:2011
time-sync:
service: direct
listen: vsock://-1:27100
connect: tcp://127.0.0.1:27100

27 changes: 27 additions & 0 deletions scripts/aws/uid2-operator-ami/ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
name: nmap-ncat
state: latest

- name: Install cron
ansible.builtin.dnf:
name: cronie
state: latest

- name: Install python
ansible.builtin.dnf:
name:
Expand Down Expand Up @@ -167,6 +172,15 @@
dest: /etc/systemd/system/uid2operator.service
remote_src: yes

- name: Install time sync trigger script
ansible.builtin.copy:
dest: /usr/local/bin/uid2-time-sync
mode: "0755"
content: |
#!/usr/bin/env bash
set -euo pipefail
curl -sSf http://127.0.0.1:27100/sync > /dev/null

- name: Install AWS Nitro Enclaves CLI
ansible.builtin.dnf:
name: aws-nitro-enclaves-cli
Expand Down Expand Up @@ -240,6 +254,19 @@
ansible.builtin.systemd:
name: uid2operator.service
enabled: yes

- name: Ensure cron is enabled at boot
ansible.builtin.systemd:
name: crond
state: started
enabled: yes

- name: Install time sync cron job
ansible.builtin.copy:
dest: /etc/cron.d/uid2-time-sync
mode: "0644"
content: |
*/5 * * * * root /usr/local/bin/uid2-time-sync

- name: Clean up tmp files
file:
Expand Down
Loading