Loading services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/app.py +21 −2 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,10 @@ from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization NAME = "Invoker-Service" NAME = "Invoker-Service" # Setting log level # Setting log level Loading Loading @@ -115,8 +119,23 @@ def verbose_formatter(): datefmt='%d/%m/%Y %H:%M:%S' datefmt='%d/%m/%Y %H:%M:%S' ) ) with open("/usr/src/app/api_invoker_management/pubkey.pem", "rb") as pub_file: # with open("/usr/src/app/api_invoker_management/pubkey.pem", "rb") as pub_file: pub_data = pub_file.read() # pub_data = pub_file.read() with open("/usr/src/app/api_invoker_management/pubkey.pem", "rb") as f: pem_data = f.read() # Extraer el primer certificado del PEM (aunque venga en bundle) cert = x509.load_pem_x509_certificate(pem_data, default_backend()) # Extraer la clave pública public_key = cert.public_key() # Convertir la clave pública a PEM (lo que JWT necesita) pub_data = public_key.public_bytes( encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo, ) app = connexion.App(__name__, specification_dir='openapi/') app = connexion.App(__name__, specification_dir='openapi/') app.app.json_encoder = encoder.CustomJSONEncoder app.app.json_encoder = encoder.CustomJSONEncoder Loading services/TS29222_CAPIF_API_Invoker_Management_API/prepare_invoker.sh +8 −1 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,17 @@ while [ $ATTEMPT -lt $MAX_RETRIES ]; do eval "ATTEMPT=\$((ATTEMPT + 1))" eval "ATTEMPT=\$((ATTEMPT + 1))" echo "Attempt $ATTEMPT of $MAX_RETRIES" echo "Attempt $ATTEMPT of $MAX_RETRIES" # Make the request to Vault and store the response in a variable # RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ # --header "X-Vault-Token: $VAULT_TOKEN" \ # --request GET "$VAULT_ADDR/v1/secret/data/server_cert/pub" | jq -r '.data.data.pub_key') CCF_ID="CCF11111111-2222-3333-4444-555555555555" # Make the request to Vault and store the response in a variable # Make the request to Vault and store the response in a variable RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ --header "X-Vault-Token: $VAULT_TOKEN" \ --header "X-Vault-Token: $VAULT_TOKEN" \ --request GET "$VAULT_ADDR/v1/secret/data/server_cert/pub" | jq -r '.data.data.pub_key') --request GET "$VAULT_ADDR/v1/secret/data/capif/${CCF_ID}/nginx" | jq -r '.data.data.server_crt') echo "$RESPONSE" echo "$RESPONSE" Loading services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/app.py +23 −2 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,10 @@ from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization from .config import Config from .config import Config NAME = "Provider-Service" NAME = "Provider-Service" Loading Loading @@ -108,8 +112,25 @@ def verbose_formatter(): ) ) with open("/usr/src/app/api_provider_management/pubkey.pem", "rb") as pub_file: # with open("/usr/src/app/api_provider_management/pubkey.pem", "rb") as pub_file: pub_data = pub_file.read() # pub_data = pub_file.read() with open("/usr/src/app/api_provider_management/pubkey.pem", "rb") as f: pem_data = f.read() # Extraer el primer certificado del PEM (aunque venga en bundle) cert = x509.load_pem_x509_certificate(pem_data, default_backend()) # Extraer la clave pública public_key = cert.public_key() # Convertir la clave pública a PEM (lo que JWT necesita) pub_data = public_key.public_bytes( encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo, ) app = connexion.App(__name__, specification_dir='openapi/') app = connexion.App(__name__, specification_dir='openapi/') app.app.json_encoder = api_provider_management.encoder.CustomJSONEncoder app.app.json_encoder = api_provider_management.encoder.CustomJSONEncoder Loading services/TS29222_CAPIF_API_Provider_Management_API/prepare_provider.sh +3 −1 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,12 @@ while [ $ATTEMPT -lt $MAX_RETRIES ]; do eval "ATTEMPT=\$((ATTEMPT + 1))" eval "ATTEMPT=\$((ATTEMPT + 1))" echo "Attempt $ATTEMPT of $MAX_RETRIES" echo "Attempt $ATTEMPT of $MAX_RETRIES" CCF_ID="CCF11111111-2222-3333-4444-555555555555" # Make the request to Vault and store the response in a variable # Make the request to Vault and store the response in a variable RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ --header "X-Vault-Token: $VAULT_TOKEN" \ --header "X-Vault-Token: $VAULT_TOKEN" \ --request GET "$VAULT_ADDR/v1/secret/data/server_cert/pub" | jq -r '.data.data.pub_key') --request GET "$VAULT_ADDR/v1/secret/data/capif/${CCF_ID}/nginx" | jq -r '.data.data.server_crt') echo "$RESPONSE" echo "$RESPONSE" Loading services/TS29222_CAPIF_Security_API/prepare_security.sh +7 −1 Original line number Original line Diff line number Diff line Loading @@ -53,9 +53,15 @@ while [ $ATTEMPT -lt $MAX_RETRIES ]; do echo "Attempt $ATTEMPT of $MAX_RETRIES" echo "Attempt $ATTEMPT of $MAX_RETRIES" # Make the request to Vault and store the response in a variable # Make the request to Vault and store the response in a variable # RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ # --header "X-Vault-Token: $VAULT_TOKEN" \ # --request GET "$VAULT_ADDR/v1/secret/data/server_cert/private" | jq -r '.data.data.key') CCF_ID="CCF11111111-2222-3333-4444-555555555555" RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ --header "X-Vault-Token: $VAULT_TOKEN" \ --header "X-Vault-Token: $VAULT_TOKEN" \ --request GET "$VAULT_ADDR/v1/secret/data/server_cert/private" | jq -r '.data.data.key') --request GET "$VAULT_ADDR/v1/secret/data/capif/${CCF_ID}/nginx" | jq -r '.data.data.server_key') echo "$RESPONSE" echo "$RESPONSE" Loading Loading
services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/app.py +21 −2 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,10 @@ from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization NAME = "Invoker-Service" NAME = "Invoker-Service" # Setting log level # Setting log level Loading Loading @@ -115,8 +119,23 @@ def verbose_formatter(): datefmt='%d/%m/%Y %H:%M:%S' datefmt='%d/%m/%Y %H:%M:%S' ) ) with open("/usr/src/app/api_invoker_management/pubkey.pem", "rb") as pub_file: # with open("/usr/src/app/api_invoker_management/pubkey.pem", "rb") as pub_file: pub_data = pub_file.read() # pub_data = pub_file.read() with open("/usr/src/app/api_invoker_management/pubkey.pem", "rb") as f: pem_data = f.read() # Extraer el primer certificado del PEM (aunque venga en bundle) cert = x509.load_pem_x509_certificate(pem_data, default_backend()) # Extraer la clave pública public_key = cert.public_key() # Convertir la clave pública a PEM (lo que JWT necesita) pub_data = public_key.public_bytes( encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo, ) app = connexion.App(__name__, specification_dir='openapi/') app = connexion.App(__name__, specification_dir='openapi/') app.app.json_encoder = encoder.CustomJSONEncoder app.app.json_encoder = encoder.CustomJSONEncoder Loading
services/TS29222_CAPIF_API_Invoker_Management_API/prepare_invoker.sh +8 −1 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,17 @@ while [ $ATTEMPT -lt $MAX_RETRIES ]; do eval "ATTEMPT=\$((ATTEMPT + 1))" eval "ATTEMPT=\$((ATTEMPT + 1))" echo "Attempt $ATTEMPT of $MAX_RETRIES" echo "Attempt $ATTEMPT of $MAX_RETRIES" # Make the request to Vault and store the response in a variable # RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ # --header "X-Vault-Token: $VAULT_TOKEN" \ # --request GET "$VAULT_ADDR/v1/secret/data/server_cert/pub" | jq -r '.data.data.pub_key') CCF_ID="CCF11111111-2222-3333-4444-555555555555" # Make the request to Vault and store the response in a variable # Make the request to Vault and store the response in a variable RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ --header "X-Vault-Token: $VAULT_TOKEN" \ --header "X-Vault-Token: $VAULT_TOKEN" \ --request GET "$VAULT_ADDR/v1/secret/data/server_cert/pub" | jq -r '.data.data.pub_key') --request GET "$VAULT_ADDR/v1/secret/data/capif/${CCF_ID}/nginx" | jq -r '.data.data.server_crt') echo "$RESPONSE" echo "$RESPONSE" Loading
services/TS29222_CAPIF_API_Provider_Management_API/api_provider_management/app.py +23 −2 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,10 @@ from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization from .config import Config from .config import Config NAME = "Provider-Service" NAME = "Provider-Service" Loading Loading @@ -108,8 +112,25 @@ def verbose_formatter(): ) ) with open("/usr/src/app/api_provider_management/pubkey.pem", "rb") as pub_file: # with open("/usr/src/app/api_provider_management/pubkey.pem", "rb") as pub_file: pub_data = pub_file.read() # pub_data = pub_file.read() with open("/usr/src/app/api_provider_management/pubkey.pem", "rb") as f: pem_data = f.read() # Extraer el primer certificado del PEM (aunque venga en bundle) cert = x509.load_pem_x509_certificate(pem_data, default_backend()) # Extraer la clave pública public_key = cert.public_key() # Convertir la clave pública a PEM (lo que JWT necesita) pub_data = public_key.public_bytes( encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo, ) app = connexion.App(__name__, specification_dir='openapi/') app = connexion.App(__name__, specification_dir='openapi/') app.app.json_encoder = api_provider_management.encoder.CustomJSONEncoder app.app.json_encoder = api_provider_management.encoder.CustomJSONEncoder Loading
services/TS29222_CAPIF_API_Provider_Management_API/prepare_provider.sh +3 −1 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,12 @@ while [ $ATTEMPT -lt $MAX_RETRIES ]; do eval "ATTEMPT=\$((ATTEMPT + 1))" eval "ATTEMPT=\$((ATTEMPT + 1))" echo "Attempt $ATTEMPT of $MAX_RETRIES" echo "Attempt $ATTEMPT of $MAX_RETRIES" CCF_ID="CCF11111111-2222-3333-4444-555555555555" # Make the request to Vault and store the response in a variable # Make the request to Vault and store the response in a variable RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ --header "X-Vault-Token: $VAULT_TOKEN" \ --header "X-Vault-Token: $VAULT_TOKEN" \ --request GET "$VAULT_ADDR/v1/secret/data/server_cert/pub" | jq -r '.data.data.pub_key') --request GET "$VAULT_ADDR/v1/secret/data/capif/${CCF_ID}/nginx" | jq -r '.data.data.server_crt') echo "$RESPONSE" echo "$RESPONSE" Loading
services/TS29222_CAPIF_Security_API/prepare_security.sh +7 −1 Original line number Original line Diff line number Diff line Loading @@ -53,9 +53,15 @@ while [ $ATTEMPT -lt $MAX_RETRIES ]; do echo "Attempt $ATTEMPT of $MAX_RETRIES" echo "Attempt $ATTEMPT of $MAX_RETRIES" # Make the request to Vault and store the response in a variable # Make the request to Vault and store the response in a variable # RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ # --header "X-Vault-Token: $VAULT_TOKEN" \ # --request GET "$VAULT_ADDR/v1/secret/data/server_cert/private" | jq -r '.data.data.key') CCF_ID="CCF11111111-2222-3333-4444-555555555555" RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ RESPONSE=$(curl -s -k --connect-timeout 5 --max-time 10 \ --header "X-Vault-Token: $VAULT_TOKEN" \ --header "X-Vault-Token: $VAULT_TOKEN" \ --request GET "$VAULT_ADDR/v1/secret/data/server_cert/private" | jq -r '.data.data.key') --request GET "$VAULT_ADDR/v1/secret/data/capif/${CCF_ID}/nginx" | jq -r '.data.data.server_key') echo "$RESPONSE" echo "$RESPONSE" Loading