Skip to content
Snippets Groups Projects
Verified Commit c3b7dc46 authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Split rgw user in two

#48
parent a5174b68
No related branches found
No related tags found
No related merge requests found
...@@ -4,9 +4,11 @@ variables: ...@@ -4,9 +4,11 @@ variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PYTHONPATH: "$CI_PROJECT_DIR" PYTHONPATH: "$CI_PROJECT_DIR"
OBJECT_GATEWAY_URI: "http://127.0.0.1:8000" OBJECT_GATEWAY_URI: "http://127.0.0.1:8000"
CEPH_ACCESS_KEY: "" BUCKET_CEPH_ACCESS_KEY: ""
CEPH_SECRET_KEY: "" BUCKET_CEPH_SECRET_KEY: ""
CEPH_USERNAME: "" USER_CEPH_ACCESS_KEY: ""
USER_CEPH_SECRET_KEY: ""
BUCKET_CEPH_USERNAME: ""
OIDC_CLIENT_SECRET: "" OIDC_CLIENT_SECRET: ""
OIDC_CLIENT_ID: "" OIDC_CLIENT_ID: ""
OIDC_BASE_URI: "http://127.0.0.1:8000" OIDC_BASE_URI: "http://127.0.0.1:8000"
......
...@@ -21,19 +21,21 @@ user-friendly manner. 👍 ...@@ -21,19 +21,21 @@ user-friendly manner. 👍
### Mandatory / Recommended Variables ### Mandatory / Recommended Variables
| Variable | Default | Value | Description | | Variable | Default | Value | Description |
|----------------------------------------|--------------------|---------------------------------|-----------------------------------------------------| |----------------------------------------|--------------------|---------------------------------|------------------------------------------------------------------------------------|
| `DB_HOST` | unset | <db hostname / IP> | IP or Hostname Adress of DB | | `DB_HOST` | unset | <db hostname / IP> | IP or Hostname Adress of DB |
| `DB_PORT` | 3306 | Number | Port of the database | | `DB_PORT` | 3306 | Number | Port of the database |
| `DB_USER` | unset | \<db username> | Username of the database user | | `DB_USER` | unset | \<db username> | Username of the database user |
| `DB_PASSWORD` | unset | \<db password> | Password of the database user | | `DB_PASSWORD` | unset | \<db password> | Password of the database user |
| `DB_DATABASE` | unset | \<db name> | Name of the database | | `DB_DATABASE` | unset | \<db name> | Name of the database |
| `OBJECT_GATEWAY_URI` | unset | HTTP URL | HTTP URL of the Ceph Object Gateway | | `OBJECT_GATEWAY_URI` | unset | HTTP URL | HTTP URL of the Ceph Object Gateway |
| `CEPH_ACCESS_KEY` | unset | \<access key> | Ceph access key with admin privileges | | `BUCKET_CEPH_ACCESS_KEY` | unset | \<access key> | Access key for the Ceph Object Gateway user with unlimited buckets. |
| `CEPH_SECRET_KEY` | unset | \<secret key> | Ceph secret key with admin privileges | | `BUCKET_CEPH_SECRET_KEY` | unset | \<secret key> | Secret key for the Ceph Object Gateway user with unlimited buckets. |
| `CEPH_USERNAME` | unset | \<ceph username> | Username in Ceph of the backend user | | `BUCKET_CEPH_USERNAME` | unset | \<ceph username> | ID of the user in ceph who owns all the buckets. Owner of `BUCKET_CEPH_ACCESS_KEY` |
| `PUBLIC_KEY_VALUE` / `PUBLIC_KEY_FILE` | randomly generated | Public Key / Path to Public Key | Public part of RSA Key in PEM format to verify JWTs | | `USER_CEPH_ACCESS_KEY` | unset | \<access key> | Access key for the Ceph Object Gateway user with `user:*` privileges |
| `AUTHZ_ENDPOINT` | unset | HTTP URL | HTTP URL to ask the Auth Service for Authorization | | `USER_CEPH_SECRET_KEY` | unset | \<secret key> | Secret key for the Ceph Object Gateway user with `user:*` privileges. |
| `PUBLIC_KEY_VALUE` / `PUBLIC_KEY_FILE` | randomly generated | Public Key / Path to Public Key | Public part of RSA Key in PEM format to verify JWTs |
| `AUTHZ_ENDPOINT` | unset | HTTP URL | HTTP URL to ask the Auth Service for Authorization |
### Optional Variables ### Optional Variables
......
...@@ -142,7 +142,7 @@ async def create_bucket( ...@@ -142,7 +142,7 @@ async def create_bucket(
{ {
"Sid": "ProxyOwnerPerm", "Sid": "ProxyOwnerPerm",
"Effect": "Allow", "Effect": "Allow",
"Principal": {"AWS": [f"arn:aws:iam:::user/{settings.CEPH_USERNAME}"]}, "Principal": {"AWS": [f"arn:aws:iam:::user/{settings.BUCKET_CEPH_USERNAME}"]},
"Action": ["s3:GetObject"], "Action": ["s3:GetObject"],
"Resource": [f"arn:aws:s3:::{db_bucket.name}/*"], "Resource": [f"arn:aws:s3:::{db_bucket.name}/*"],
}, },
......
...@@ -13,13 +13,13 @@ else: ...@@ -13,13 +13,13 @@ else:
s3_resource: ServiceResource = resource( s3_resource: ServiceResource = resource(
service_name="s3", service_name="s3",
endpoint_url=settings.OBJECT_GATEWAY_URI, endpoint_url=settings.OBJECT_GATEWAY_URI,
aws_access_key_id=settings.CEPH_ACCESS_KEY, aws_access_key_id=settings.BUCKET_CEPH_ACCESS_KEY,
aws_secret_access_key=settings.CEPH_SECRET_KEY, aws_secret_access_key=settings.BUCKET_CEPH_SECRET_KEY,
verify=False, verify=settings.OBJECT_GATEWAY_URI.startswith("https"),
) )
rgw = RGWAdmin( rgw = RGWAdmin(
access_key=settings.CEPH_ACCESS_KEY, access_key=settings.USER_CEPH_ACCESS_KEY,
secret_key=settings.CEPH_SECRET_KEY, secret_key=settings.USER_CEPH_ACCESS_KEY,
secure=False, secure=settings.OBJECT_GATEWAY_URI.startswith("https"),
server=settings.OBJECT_GATEWAY_URI.split("://")[-1], server=settings.OBJECT_GATEWAY_URI.split("://")[-1],
) )
...@@ -72,9 +72,21 @@ class Settings(BaseSettings): ...@@ -72,9 +72,21 @@ class Settings(BaseSettings):
return _assemble_db_uri(values, async_flag=False) return _assemble_db_uri(values, async_flag=False)
OBJECT_GATEWAY_URI: AnyHttpUrl = Field(..., description="URI of the Ceph Object Gateway.") OBJECT_GATEWAY_URI: AnyHttpUrl = Field(..., description="URI of the Ceph Object Gateway.")
CEPH_ACCESS_KEY: str = Field(..., description="Access key for the Ceph Object Gateway with admin privileges.") USER_CEPH_ACCESS_KEY: str = Field(
CEPH_SECRET_KEY: str = Field(..., description="Secret key for the Ceph Object Gateway with admin privileges.") ..., description="Access key for the Ceph Object Gateway with 'user:read,user:write privileges'."
CEPH_USERNAME: str = Field(..., description="ID of the Proxy user in Ceph.") )
USER_CEPH_SECRET_KEY: str = Field(
..., description="Secret key for the Ceph Object Gateway with 'user:read,user:write privileges'."
)
BUCKET_CEPH_ACCESS_KEY: str = Field(
..., description="Access key for the Ceph Object Gateway with unlimited buckets."
)
BUCKET_CEPH_SECRET_KEY: str = Field(
..., description="Secret key for the Ceph Object Gateway with unlimited buckets."
)
BUCKET_CEPH_USERNAME: str = Field(
..., description="ID of the user in ceph who owns all the buckets. Owner of 'BUCKET_CEPH_ACCESS_KEY'"
)
AUTHZ_ENDPOINT: AnyHttpUrl = Field(..., description="Endpoint of the CloWM Auth service to authorize requests") AUTHZ_ENDPOINT: AnyHttpUrl = Field(..., description="Endpoint of the CloWM Auth service to authorize requests")
class Config: class Config:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment