Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f11ce84
Initial Draft version to load the CA trusted store code.
lokeshrangineni Dec 14, 2024
cc40246
Initial Draft version to load the CA trusted store code.
lokeshrangineni Dec 14, 2024
eda6900
Fixing the lint error.
lokeshrangineni Dec 14, 2024
abf4c7e
Trying to fix the online store test cases.
lokeshrangineni Dec 17, 2024
d497a9c
Merge branch 'master' into feature/adding-ca-store-support
lokeshrangineni Dec 17, 2024
767f241
Formatted the python to fix lint errors.
lokeshrangineni Dec 17, 2024
436f0db
Fixing the unit test cases.
lokeshrangineni Dec 17, 2024
1d64ebb
Fixing the unit test cases.
lokeshrangineni Dec 17, 2024
9540e7e
removing unnecessary cli args.
lokeshrangineni Dec 17, 2024
fff05f4
Now configuring the SSL ca store configurations on the feast client s…
lokeshrangineni Dec 17, 2024
36859bf
Renamed the remote registry is_tls_mode variable to is_tls.
lokeshrangineni Dec 17, 2024
9b6f8e5
Adding the existing trust store certificates to the newly created tru…
lokeshrangineni Dec 17, 2024
4a5de3b
Clearing the existing trust store configuration to see if it fixes th…
lokeshrangineni Dec 17, 2024
a6d3420
Clearing the existing trust store configuration to see if it fixes th…
lokeshrangineni Dec 17, 2024
706e9b4
Clearing the existing trust store configuration to see if it fixes th…
lokeshrangineni Dec 17, 2024
4970151
combining the default system ca store with the custom one to fix the …
lokeshrangineni Dec 18, 2024
f9aea9a
Final clean up and adding documentation.
lokeshrangineni Dec 18, 2024
6084fb9
Incorporating the code review comments from Francisco.
lokeshrangineni Dec 18, 2024
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
Prev Previous commit
Next Next commit
Final clean up and adding documentation.
Signed-off-by: lrangine <19699092+lokeshrangineni@users.noreply.github.com>
  • Loading branch information
lokeshrangineni committed Dec 18, 2024
commit f9aea9a1660eb3d41efa9c3d102e8de34cc1518d
5 changes: 5 additions & 0 deletions docs/how-to-guides/starting-feast-servers-tls-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,8 @@ INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on https://0.0.0.0:8888 (Press CTRL+C to quit)
```


## Adding public key to CA trust store and configuring the feast to use the trust store.
You can pass the public key for SSL verification using `cert` parameter, however, it is sometimes a hassle to maintain individual certificate and pass the public certificate individually.
Comment thread
lokeshrangineni marked this conversation as resolved.
Outdated
The alternate recommendation is to add the public certificate to CA trust store and set the path as environment variable `FEAST_CA_CERT_FILE_PATH`. Feast will refer the trust store path set as environment variable as `FEAST_CA_CERT_FILE_PATH`
Comment thread
lokeshrangineni marked this conversation as resolved.
Outdated
1 change: 1 addition & 0 deletions sdk/python/feast/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ def materialize_incremental_command(ctx: click.Context, end_ts: str, views: List
"cassandra",
"hazelcast",
"ikv",
"couchbase",
],
case_sensitive=False,
),
Expand Down
7 changes: 3 additions & 4 deletions sdk/python/feast/infra/registry/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ class RemoteRegistryConfig(RegistryConfig):
If registry_type is 'remote', then this configuration is needed to connect to remote registry server in TLS mode. If the remote registry started in non-tls mode then this configuration is not needed."""

is_tls: bool = False
""" str: Path to the public certificate when the registry server starts in TLS(SSL) mode. This may be needed if the registry server started with a self-signed certificate, typically this file ends with `*.crt`, `*.cer`, or `*.pem`.
If registry_type is 'remote', then this configuration is needed to connect to remote registry server in TLS mode. If the remote registry started in non-tls mode then this configuration is not needed."""
""" bool: if you are planning to connect the registry server which started in TLS(SSL) mode then this should be true.
Comment thread
lokeshrangineni marked this conversation as resolved.
Outdated
If you are planning to add the public certificate as part of the trust store instead of passing it as a `cert` parameters then setting this field to `true` is a mandatory.
Comment thread
lokeshrangineni marked this conversation as resolved.
Outdated
"""


class RemoteRegistry(BaseRegistry):
Expand All @@ -75,8 +76,6 @@ def __init__(
):
self.auth_config = auth_config
assert isinstance(registry_config, RemoteRegistryConfig)
# self.channel = create_tls_channel(registry_config)

self.channel = self._create_grpc_channel(registry_config)

auth_header_interceptor = GrpcClientAuthHeaderInterceptor(auth_config)
Expand Down
2 changes: 0 additions & 2 deletions sdk/python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,6 @@ def auth_config(request, is_integration_test):
@pytest.fixture(scope="module")
def tls_mode(request):
is_tls_mode = request.param[0]
# remove any existing environment variables if there are any
# clear_previous_cert_env_vars()
output_combined_truststore_path = ""

if is_tls_mode:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ def start_registry_server(

is_tls_mode, tls_key_path, tls_cert_path, tls_ca_file_path = tls_mode
if is_tls_mode:
# configure_ssl_ca(ca_file_path=tls_ca_file_path)
# Setting the ca_trust_store_path environment variables.
print(f"Starting Registry in TLS mode at {server_port}")
server = start_server(
store=feature_store,
Expand Down
30 changes: 3 additions & 27 deletions sdk/python/tests/utils/ssl_certifcates_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,6 @@ def generate_self_signed_cert(
)


def clear_previous_cert_env_vars():
"""
Clear SSL_CERT_FILE and REQUESTS_CA_BUNDLE environment variables if they match FEAST_CA_CERT_FILE_PATH.
"""
# Fetch FEAST_CA_CERT_FILE_PATH value
feast_ca_cert_file_path = os.environ.get("FEAST_CA_CERT_FILE_PATH")

if not feast_ca_cert_file_path:
print("FEAST_CA_CERT_FILE_PATH is not set. Skipping cleanup.")
return

print(f"FEAST_CA_CERT_FILE_PATH: {feast_ca_cert_file_path}")
env_vars_to_check = ["SSL_CERT_FILE", "REQUESTS_CA_BUNDLE"]

# Compare and clear the environment variables
for var in env_vars_to_check:
env_value = os.environ.get(var)
if env_value and env_value == feast_ca_cert_file_path:
del os.environ[var]
print(f"Cleared environment variable: {var}")
else:
print(f"Skipped clearing {var}. Current value: {env_value}")


def create_ca_trust_store(
public_key_path: str, private_key_path: str, output_trust_store_path: str
):
Expand All @@ -124,7 +100,6 @@ def create_ca_trust_store(
"REQUESTS_CA_BUNDLE"
)

# Step 2: Copy the existing trust store to the new location (if it exists)
# Step 2: Copy the existing trust store to the new location (if it exists)
if existing_trust_store and os.path.exists(existing_trust_store):
shutil.copy(existing_trust_store, output_trust_store_path)
Expand Down Expand Up @@ -192,7 +167,8 @@ def combine_trust_stores(custom_cert_path: str, output_combined_path: str):
with open(custom_cert_path, "rb") as custom_file:
combined_file.write(custom_file.read())

print(f"Combined trust store created at: {output_combined_path}")
logger.info(f"Combined trust store created at: {output_combined_path}")

except Exception as e:
print(f"Error combining trust stores: {e}")
logger.error(f"Error combining trust stores: {e}")
raise e