Skip to content

Commit 8a39bce

Browse files
Abu UID2 4880 fix e2e (#1412)
* Change URL update to entire URL
1 parent 25f07da commit 8a39bce

File tree

13 files changed

+76
-103
lines changed

13 files changed

+76
-103
lines changed

Makefile.eif

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ euidoperator.eif: build_artifacts build_configs build/proxies.nitro.yaml build/s
2828

2929
.PHONY: build_configs
3030

31-
build_configs: build/conf/default-config.json build/conf/euid-integ-config.json build/conf/euid-prod-config.json build/conf/uid2-integ-config.json build/conf/uid2-prod-config.json build/conf/logback.xml build/conf/logback-debug.xml
31+
build_configs: build/conf/default-config.json build/conf/feat-flag.json build/conf/euid-integ-config.json build/conf/euid-prod-config.json build/conf/uid2-integ-config.json build/conf/uid2-prod-config.json build/conf/logback.xml build/conf/logback-debug.xml
3232

3333
build/conf/default-config.json: build_artifacts ./scripts/aws/conf/default-config.json
3434
cp ./scripts/aws/conf/default-config.json ./build/conf/
3535

36+
build/conf/feat-flag.json: build_artifacts ./scripts/aws/conf/feat-flag/feat-flag.json
37+
cp ./scripts/aws/conf/feat-flag/feat-flag.json ./build/conf/
38+
3639
build/conf/euid-integ-config.json: build_artifacts ./scripts/aws/conf/euid-integ-config.json
3740
cp ./scripts/aws/conf/euid-integ-config.json ./build/conf/
3841

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.uid2</groupId>
88
<artifactId>uid2-operator</artifactId>
9-
<version>5.47.47</version>
9+
<version>5.47.73-alpha-180-SNAPSHOT</version>
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -22,7 +22,7 @@
2222
<enclave-aws.version>2.1.0</enclave-aws.version>
2323
<enclave-azure.version>2.1.0</enclave-azure.version>
2424
<enclave-gcp.version>2.1.0</enclave-gcp.version>
25-
<uid2-shared.version>8.0.32</uid2-shared.version>
25+
<uid2-shared.version>8.1.10</uid2-shared.version>
2626
<image.version>${project.version}</image.version>
2727
<maven.compiler.source>21</maven.compiler.source>
2828
<maven.compiler.target>21</maven.compiler.target>

scripts/aws/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ COPY ./conf/default-config.json /app/conf/
3737
COPY ./conf/*.json /app/conf/
3838
COPY ./conf/*.xml /app/conf/
3939
COPY ./syslog-ng-client.conf /etc/syslog-ng/syslog-ng.conf
40-
COPY ./conf/feat-flag/feat-flag.json /app/conf/feat-flag/
40+
COPY ./conf/feat-flag.json /app/conf/feat-flag/
4141

4242
RUN chmod +x /app/vsockpx && chmod +x /app/entrypoint.sh
4343

scripts/aws/conf/default-config.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@
3030
"service_links_metadata_path": "service_links/metadata.json",
3131
"optout_metadata_path": null,
3232
"optout_inmem_cache": false,
33-
"enclave_platform": null,
33+
"enclave_platform": "aws-nitro",
3434
"failure_shutdown_wait_hours": 120,
3535
"sharing_token_expiry_seconds": 2592000,
3636
"validate_service_links": false,
37+
"identity_token_expires_after_seconds": 86400,
38+
"refresh_token_expires_after_seconds": 2592000,
39+
"refresh_identity_token_after_seconds": 3600,
3740
"operator_type": "private"
38-
}
41+
}

scripts/aws/conf/euid-integ-config.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,5 @@
1111
"core_attest_url": "https://core.integ.euid.eu/attest",
1212
"optout_api_uri": "https://optout.integ.euid.eu/optout/replicate",
1313
"optout_s3_folder": "optout/",
14-
"allow_legacy_api": false,
15-
"runtime_config_store": {
16-
"type": "http",
17-
"config" : {
18-
"url": "https://core.integ.euid.eu/operator/config"
19-
},
20-
"config_scan_period_ms": 300000
21-
}
14+
"allow_legacy_api": false
2215
}
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
{
2+
"core_attest_url": "https://core-integ.uidapi.com/attest",
3+
"optout_api_uri": "https://optout-integ.uidapi.com/optout/replicate",
24
"sites_metadata_path": "https://core-integ.uidapi.com/sites/refresh",
35
"clients_metadata_path": "https://core-integ.uidapi.com/clients/refresh",
6+
"client_side_keypairs_metadata_path": "https://core-integ.uidapi.com/client_side_keypairs/refresh",
47
"keysets_metadata_path": "https://core-integ.uidapi.com/key/keyset/refresh",
58
"keyset_keys_metadata_path": "https://core-integ.uidapi.com/key/keyset-keys/refresh",
6-
"client_side_keypairs_metadata_path": "https://core-integ.uidapi.com/client_side_keypairs/refresh",
79
"salts_metadata_path": "https://core-integ.uidapi.com/salt/refresh",
810
"services_metadata_path": "https://core-integ.uidapi.com/services/refresh",
911
"service_links_metadata_path": "https://core-integ.uidapi.com/service_links/refresh",
1012
"optout_metadata_path": "https://optout-integ.uidapi.com/optout/refresh",
11-
"core_attest_url": "https://core-integ.uidapi.com/attest",
12-
"optout_api_uri": "https://optout-integ.uidapi.com/optout/replicate",
13-
"optout_s3_folder": "uid-optout-integ/",
14-
"allow_legacy_api": false,
15-
"runtime_config_store": {
16-
"type": "http",
17-
"config" : {
18-
"url": "https://core-integ.uidapi.com/operator/config"
19-
},
20-
"config_scan_period_ms": 300000
21-
}
22-
}
13+
"optout_s3_folder": "uid-optout-integ/"
14+
}

scripts/aws/ec2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import sys
1616
import time
1717
import yaml
18-
18+
logging.basicConfig(level=logging.INFO)
1919
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
2020
from confidential_compute import ConfidentialCompute, ConfidentialComputeConfig, InstanceProfileMissingError, OperatorKeyNotFoundError, ConfigurationValueError, ConfidentialComputeStartupError
2121

scripts/aws/entrypoint.sh

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,18 @@ exec &> >(tee -a "$LOG_FILE")
1010
PARAMETERIZED_CONFIG="/app/conf/config-overrides.json"
1111
OPERATOR_CONFIG="/tmp/final-config.json"
1212

13-
setup_auxiliaries() {
14-
set -o pipefail
15-
ulimit -n 65536
13+
set -o pipefail
14+
ulimit -n 65536
1615

17-
# -- setup loopback device
18-
echo "Setting up loopback device..."
19-
ifconfig lo 127.0.0.1
16+
# -- setup loopback device
17+
echo "Setting up loopback device..."
18+
ifconfig lo 127.0.0.1
2019

21-
# -- start vsock proxy
22-
echo "Starting vsock proxy..."
23-
/app/vsockpx --config /app/proxies.nitro.yaml --daemon --workers $(( ( $(nproc) + 3 ) / 4 )) --log-level 3
24-
25-
/usr/sbin/syslog-ng --verbose
26-
}
20+
# -- start vsock proxy
21+
echo "Starting vsock proxy..."
22+
/app/vsockpx --config /app/proxies.nitro.yaml --daemon --workers $(( ( $(nproc) + 3 ) / 4 )) --log-level 3
2723

24+
/usr/sbin/syslog-ng --verbose
2825

2926
build_parameterized_config() {
3027
curl -s -f -o "${PARAMETERIZED_CONFIG}" -x socks5h://127.0.0.1:3305 http://127.0.0.1:27015/getConfig
@@ -46,9 +43,7 @@ build_parameterized_config() {
4643

4744
build_operator_config() {
4845
CORE_BASE_URL=$(jq -r ".core_base_url" < "${PARAMETERIZED_CONFIG}")
49-
CORE_BASE_URL=$(echo "$CORE_BASE_URL" | sed -E 's#^(https?://)?([^/]+).*#\2#')
5046
OPTOUT_BASE_URL=$(jq -r ".optout_base_url" < "${PARAMETERIZED_CONFIG}")
51-
OPTOUT_BASE_URL=$(echo "$OPTOUT_BASE_URL" | sed -E 's#^(https?://)?([^/]+).*#\2#')
5247
DEPLOYMENT_ENVIRONMENT=$(jq -r ".environment" < "${PARAMETERIZED_CONFIG}")
5348
DEBUG_MODE=$(jq -r ".debug_mode" < "${PARAMETERIZED_CONFIG}")
5449

@@ -69,22 +64,22 @@ build_operator_config() {
6964

7065
if [[ "$DEPLOYMENT_ENVIRONMENT" != "prod" ]]; then
7166
#Allow override of base URL in non-prod environments
72-
CORE_PATTERN="core.*uidapi.com"
73-
OPTOUT_PATTERN="optout.*uidapi.com"
74-
if [[ "$DEPLOYMENT_ENVIRONMENT" == "euid" ]]; then
75-
CORE_PATTERN="core.*euid.eu"
76-
OPTOUT_PATTERN="optout.*euid.eu"
67+
CORE_PATTERN="https://core.*uidapi.com"
68+
OPTOUT_PATTERN="https://optout.*uidapi.com"
69+
if [[ "$IDENTITY_SCOPE_LOWER" == "euid" ]]; then
70+
CORE_PATTERN="https://core.*euid.eu"
71+
OPTOUT_PATTERN="https://optout.*euid.eu"
7772
fi
7873
sed -i "s#${CORE_PATTERN}#${CORE_BASE_URL}#g" "${OPERATOR_CONFIG}"
7974
sed -i "s#${OPTOUT_PATTERN}#${OPTOUT_BASE_URL}#g" "${OPERATOR_CONFIG}"
8075
fi
8176

8277
}
8378

84-
setup_auxiliaries
8579
build_parameterized_config
8680
build_operator_config
8781

82+
8883
DEBUG_MODE=$(jq -r ".debug_mode" < "${OPERATOR_CONFIG}")
8984
LOGBACK_CONF="./conf/logback.xml"
9085

@@ -107,3 +102,4 @@ java \
107102
-Dlogback.configurationFile=${LOGBACK_CONF} \
108103
-Dhttp_proxy=socks5://127.0.0.1:3305 \
109104
-jar /app/"${JAR_NAME}"-"${JAR_VERSION}".jar
105+

scripts/azure-cc/azureEntryPoint.py

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import shutil
99
import requests
1010
import logging
11-
from urllib.parse import urlparse
1211
from confidential_compute import ConfidentialCompute, ConfigurationMissingError, OperatorKeyPermissionError, OperatorKeyNotFoundError, ConfidentialComputeStartupError
1312
from azure.keyvault.secrets import SecretClient
1413
from azure.identity import DefaultAzureCredential, CredentialUnavailableError
@@ -22,6 +21,8 @@ class AzureEntryPoint(ConfidentialCompute):
2221
env_name = os.getenv("DEPLOYMENT_ENVIRONMENT")
2322
jar_name = os.getenv("JAR_NAME", "default-jar-name")
2423
jar_version = os.getenv("JAR_VERSION", "default-jar-version")
24+
default_core_endpoint = f"https://core-{env_name}.uidapi.com".lower()
25+
default_optout_endpoint = f"https://optout-{env_name}.uidapi.com".lower()
2526

2627
FINAL_CONFIG = "/tmp/final-config.json"
2728

@@ -50,37 +51,25 @@ def __create_final_config(self):
5051
except IOError as e:
5152
logging.error(f"Failed to create {AzureEntryPoint.FINAL_CONFIG} with error: {e}")
5253
sys.exit(1)
53-
54-
CORE_BASE_URL = os.getenv("CORE_BASE_URL")
55-
OPTOUT_BASE_URL = os.getenv("OPTOUT_BASE_URL")
5654

57-
if CORE_BASE_URL and OPTOUT_BASE_URL and AzureEntryPoint.env_name != 'prod':
58-
logging.info(f"-- replacing URLs by {CORE_BASE_URL} and {OPTOUT_BASE_URL}")
59-
with open(AzureEntryPoint.FINAL_CONFIG, "r") as file:
60-
config = file.read()
61-
62-
config = config.replace("core-integ.uidapi.com", urlparse(CORE_BASE_URL).netloc)
63-
config = config.replace("optout-integ.uidapi.com", urlparse(OPTOUT_BASE_URL).netloc)
55+
logging.info(f"-- replacing URLs by {self.configs["core_base_url"]} and {self.configs["optout_base_url"]}")
56+
with open(AzureEntryPoint.FINAL_CONFIG, "r") as file:
57+
config = file.read()
6458

65-
with open(AzureEntryPoint.FINAL_CONFIG, "w") as file:
66-
file.write(config)
59+
config = config.replace("https://core.uidapi.com", self.configs["core_base_url"])
60+
config = config.replace("https://optout.uidapi.com", self.configs["optout_base_url"])
61+
with open(AzureEntryPoint.FINAL_CONFIG, "w") as file:
62+
file.write(config)
6763

6864
with open(AzureEntryPoint.FINAL_CONFIG, "r") as file:
6965
logging.info(file.read())
7066

71-
def __set_base_urls(self):
72-
with open(AzureEntryPoint.FINAL_CONFIG, "r") as file:
73-
jdata = json.load(file)
74-
self.configs["core_base_url"] = jdata["core_attest_url"]
75-
self.configs["optout_base_url"] = jdata["optout_api_uri"]
76-
7767
def __set_operator_key(self):
7868
try:
7969
credential = DefaultAzureCredential()
8070
kv_URL = f"https://{AzureEntryPoint.kv_name}.vault.azure.net"
8171
secret_client = SecretClient(vault_url=kv_URL, credential=credential)
8272
secret = secret_client.get_secret(AzureEntryPoint.secret_name)
83-
# print(f"Secret Value: {secret.value}")
8473
self.configs["operator_key"] = secret.value
8574

8675
except (CredentialUnavailableError, ClientAuthenticationError) as auth_error:
@@ -92,14 +81,13 @@ def __set_operator_key(self):
9281

9382

9483
def _set_confidential_config(self, secret_identifier: str = None):
84+
"""Builds and sets ConfidentialComputeConfig"""
9585
self.configs["skip_validations"] = os.getenv("SKIP_VALIDATIONS", "false").lower() == "true"
9686
self.configs["debug_mode"] = os.getenv("DEBUG_MODE", "false").lower() == "true"
9787
self.configs["environment"] = AzureEntryPoint.env_name
98-
99-
# set self.configs["operator_key"]
88+
self.configs["core_base_url"] = os.getenv("CORE_BASE_URL") if os.getenv("CORE_BASE_URL") and AzureEntryPoint.env_name == "integ" else AzureEntryPoint.default_core_endpoint
89+
self.configs["optout_base_url"] = os.getenv("OPTOUT_BASE_URL") if os.getenv("OPTOUT_BASE_URL") and AzureEntryPoint.env_name == "integ" else AzureEntryPoint.default_optout_endpoint
10090
self.__set_operator_key()
101-
# set base urls from final config file
102-
self.__set_base_urls()
10391

10492
def __run_operator(self):
10593

@@ -150,10 +138,10 @@ def _validate_auxiliaries(self):
150138
def run_compute(self) -> None:
151139
"""Main execution flow for confidential compute."""
152140
self.__check_env_variables()
153-
self.__create_final_config()
154141
self._set_confidential_config()
155142
if not self.configs.get("skip_validations"):
156143
self.validate_configuration()
144+
self.__create_final_config()
157145
self._setup_auxiliaries()
158146
self.__run_operator()
159147

scripts/azure-cc/conf/integ-uid2-config.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"sites_metadata_path": "https://core-integ.uidapi.com/sites/refresh",
3-
"clients_metadata_path": "https://core-integ.uidapi.com/clients/refresh",
4-
"keysets_metadata_path": "https://core-integ.uidapi.com/key/keyset/refresh",
5-
"keyset_keys_metadata_path": "https://core-integ.uidapi.com/key/keyset-keys/refresh",
6-
"client_side_keypairs_metadata_path": "https://core-integ.uidapi.com/client_side_keypairs/refresh",
7-
"salts_metadata_path": "https://core-integ.uidapi.com/salt/refresh",
8-
"services_metadata_path": "https://core-integ.uidapi.com/services/refresh",
9-
"service_links_metadata_path": "https://core-integ.uidapi.com/service_links/refresh",
10-
"optout_metadata_path": "https://optout-integ.uidapi.com/optout/refresh",
11-
"core_attest_url": "https://core-integ.uidapi.com/attest",
12-
"optout_api_uri": "https://optout-integ.uidapi.com/optout/replicate",
2+
"sites_metadata_path": "https://core.uidapi.com/sites/refresh",
3+
"clients_metadata_path": "https://core.uidapi.com/clients/refresh",
4+
"keysets_metadata_path": "https://core.uidapi.com/key/keyset/refresh",
5+
"keyset_keys_metadata_path": "https://core.uidapi.com/key/keyset-keys/refresh",
6+
"client_side_keypairs_metadata_path": "https://core.uidapi.com/client_side_keypairs/refresh",
7+
"salts_metadata_path": "https://core.uidapi.com/salt/refresh",
8+
"services_metadata_path": "https://core.uidapi.com/services/refresh",
9+
"service_links_metadata_path": "https://core.uidapi.com/service_links/refresh",
10+
"optout_metadata_path": "https://optout.uidapi.com/optout/refresh",
11+
"core_attest_url": "https://core.uidapi.com/attest",
12+
"optout_api_uri": "https://optout.uidapi.com/optout/replicate",
1313
"optout_s3_folder": "uid-optout-integ/",
1414
"runtime_config_store": {
1515
"type": "http",
1616
"config" : {
17-
"url": "https://core-integ.uidapi.com/operator/config"
17+
"url": "https://core.uidapi.com/operator/config"
1818
},
1919
"config_scan_period_ms": 300000
2020
}

0 commit comments

Comments
 (0)