Skip to content

Commit bb87509

Browse files
committed
Also remove defunct custos vault
1 parent c0a0e4e commit bb87509

File tree

7 files changed

+1
-108
lines changed

7 files changed

+1
-108
lines changed

doc/source/admin/special_topics/vault.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ There are currently 3 supported backends.
1212
| Backend | Description |
1313
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1414
| hashicorp | Hashicorp Vault is a secrets and encryption management system. https://www.vaultproject.io/ |
15-
| custos | Custos is an NSF-funded project, backed by open source software that provides science gateways such as Galaxy with single sign-on, group management, and management of secrets such as access keys and OAuth2 access tokens. Custos secrets management is backed by Hashicorp's vault, but provides a convenient, always-on ReST API service. |
1615
| database | The database backend stores secrets in an encrypted table in the Galaxy database itself. It is a convenient way to get started with a vault, and while it supports basic key rotation, we recommend using one of the other options in production. |
1716

1817
## Configuring Galaxy
@@ -36,7 +35,7 @@ path_prefix: /galaxy # optional
3635
...
3736
```
3837

39-
The `type` must be a valid backend type: `hashicorp`, `custos`, or `database`. At present, only a single vault backend
38+
The `type` must be a valid backend type: `hashicorp`, or `database`. At present, only a single vault backend
4039
is supported. The `path_prefix` property indicates the root path under which to store all vault keys. If multiple
4140
Galaxy instances are using the same vault, a prefix can be used to uniquely identify the Galaxy instance.
4241
If no path_prefix is provided, the prefix defaults to `/galaxy`.
@@ -50,19 +49,6 @@ vault_address: http://localhost:8200
5049
vault_token: vault_application_token
5150
```
5251
53-
## Vault configuration for Custos
54-
55-
```yaml
56-
type: custos
57-
custos_host: service.staging.usecustos.org
58-
custos_port: 30170
59-
custos_client_id: custos-jeREDACTEDye-10000001
60-
custos_client_sec: OGREDACTEDBSUDHn
61-
```
62-
63-
Obtaining the Custos client id and client secret requires first registering your Galaxy instance with Custos.
64-
Visit [usecustos.org](http://usecustos.org/) for more information.
65-
6652
## Vault configuration for database
6753
6854
```yaml

lib/galaxy/dependencies/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,6 @@ def check_pydyf(self):
308308
# See notes in ./conditional-requirements.txt for more information.
309309
return os.environ.get("GALAXY_DEPENDENCIES_INSTALL_WEASYPRINT") == "1"
310310

311-
def check_custos_sdk(self):
312-
return "custos" == self.vault_type
313-
314311
def check_hvac(self):
315312
return "hashicorp" == self.vault_type
316313

lib/galaxy/dependencies/conditional-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ huggingface_hub
3737

3838
# Vault backend
3939
hvac
40-
custos-sdk
4140

4241
# Chronos client
4342
chronos-python==1.2.1

lib/galaxy/security/vault.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@
1313
)
1414
from sqlalchemy import select
1515

16-
try:
17-
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
18-
from custos.clients.utils.exceptions.CustosExceptions import KeyDoesNotExist
19-
from custos.transport.settings import CustosServerClientSettings
20-
21-
logging.getLogger("custos.clients.resource_secret_management_client").setLevel(logging.CRITICAL)
22-
23-
custos_sdk_available = True
24-
except ImportError:
25-
custos_sdk_available = False
26-
2716
try:
2817
import hvac
2918
except ImportError:
@@ -184,34 +173,6 @@ def _get_vault_value(self, key):
184173
return self.sa_session.scalars(stmt).first()
185174

186175

187-
class CustosVault(Vault):
188-
def __init__(self, config):
189-
if not custos_sdk_available:
190-
raise InvalidVaultConfigException(
191-
"Custos sdk library 'custos-sdk' is not available. Make sure the custos-sdk is installed."
192-
)
193-
custos_settings = CustosServerClientSettings(
194-
custos_host=config.get("custos_host"),
195-
custos_port=config.get("custos_port"),
196-
custos_client_id=config.get("custos_client_id"),
197-
custos_client_sec=config.get("custos_client_sec"),
198-
)
199-
self.client = ResourceSecretManagementClient(custos_settings)
200-
201-
def read_secret(self, key: str) -> Optional[str]:
202-
try:
203-
response = self.client.get_kv_credential(key=key)
204-
return response.get("value")
205-
except KeyDoesNotExist:
206-
return None
207-
208-
def write_secret(self, key: str, value: str) -> None:
209-
self.client.set_kv_credential(key=key, value=value)
210-
211-
def list_secrets(self, key: str) -> list[str]:
212-
raise NotImplementedError()
213-
214-
215176
class UserVaultWrapper(Vault):
216177
def __init__(self, vault: Vault, user):
217178
self.vault = vault
@@ -300,8 +261,6 @@ def from_vault_type(app, vault_type: Optional[str], cfg: dict) -> Vault:
300261
vault = HashicorpVault(cfg)
301262
elif vault_type == "database":
302263
vault = DatabaseVault(app.model.context, cfg)
303-
elif vault_type == "custos":
304-
vault = CustosVault(cfg)
305264
else:
306265
raise InvalidVaultConfigException(f"Unknown vault type: {vault_type}")
307266
vault_prefix = cfg.get("path_prefix") or "/galaxy"

test/unit/app/dependencies/test_deps.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
runner1:
3131
load: job_runner_A
3232
"""
33-
VAULT_CONF_CUSTOS = """
34-
type: custos
35-
"""
3633
VAULT_CONF_HASHICORP = """
3734
type: hashicorp
3835
"""
@@ -102,17 +99,6 @@ def test_yaml_jobconf_runners():
10299
assert "job_runner_A" in cds.job_runners
103100

104101

105-
def test_vault_custos_configured():
106-
with _config_context() as cc:
107-
vault_conf = cc.write_config("vault_conf.yml", VAULT_CONF_CUSTOS)
108-
config = {
109-
"vault_config_file": vault_conf,
110-
}
111-
cds = cc.get_cond_deps(config=config)
112-
assert cds.check_custos_sdk()
113-
assert not cds.check_hvac()
114-
115-
116102
def test_vault_hashicorp_configured():
117103
with _config_context() as cc:
118104
vault_conf = cc.write_config("vault_conf.yml", VAULT_CONF_HASHICORP)
@@ -121,7 +107,6 @@ def test_vault_hashicorp_configured():
121107
}
122108
cds = cc.get_cond_deps(config=config)
123109
assert cds.check_hvac()
124-
assert not cds.check_custos_sdk()
125110

126111

127112
@pytest.mark.parametrize(

test/unit/data/security/fixtures/vault_conf_custos.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/unit/data/security/test_vault.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -110,30 +110,3 @@ def test_wrong_keys(self):
110110
vault = VaultFactory.from_app(app)
111111
with self.assertRaises(InvalidToken):
112112
vault.read_secret("my/incorrect/secret")
113-
114-
115-
VAULT_CONF_CUSTOS = os.path.join(os.path.dirname(__file__), "fixtures/vault_conf_custos.yml")
116-
117-
118-
@pytest.mark.skipif(
119-
not os.environ.get("CUSTOS_CLIENT_ID") or not os.environ.get("CUSTOS_CLIENT_SECRET"),
120-
reason="CUSTOS_CLIENT_ID and CUSTOS_CLIENT_SECRET env vars not set",
121-
)
122-
class TestCustosVault(AbstractTestCases.VaultTestBase):
123-
def setUp(self) -> None:
124-
with (
125-
tempfile.NamedTemporaryFile(mode="w", prefix="vault_custos", delete=False) as tempconf,
126-
open(VAULT_CONF_CUSTOS) as f,
127-
):
128-
content = string.Template(f.read()).safe_substitute(
129-
custos_client_id=os.environ.get("CUSTOS_CLIENT_ID"),
130-
custos_client_secret=os.environ.get("CUSTOS_CLIENT_SECRET"),
131-
)
132-
tempconf.write(content)
133-
self.vault_temp_conf = tempconf.name
134-
config = GalaxyDataTestConfig(vault_config_file=self.vault_temp_conf)
135-
app = GalaxyDataTestApp(config=config)
136-
self.vault = VaultFactory.from_app(app)
137-
138-
def tearDown(self) -> None:
139-
os.remove(self.vault_temp_conf)

0 commit comments

Comments
 (0)