Skip to content

Commit f026af1

Browse files
author
Phil Varner
authored
Merge pull request #345 from stac-utils/pv/add-config-example-for-thumbnails
add config for thumbnail permissions
2 parents 5568738 + a3a94a1 commit f026af1

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# stac-server
22

3-
![](https://github.com/stac-utils/stac-server/workflows/Push%20Event/badge.svg)
3+
![push event badge](https://github.com/stac-utils/stac-server/workflows/Push%20Event/badge.svg)
44

55
- [stac-server](#stac-server)
66
- [Overview](#overview)
@@ -9,6 +9,7 @@
99
- [0.4.x -\> 0.5.x](#04x---05x)
1010
- [Elasticsearch to OpenSearch Migration](#elasticsearch-to-opensearch-migration)
1111
- [Preferred Elasticsearch to OpenSearch Migration Process](#preferred-elasticsearch-to-opensearch-migration-process)
12+
- [Granting Access for Thumbnails](#granting-access-for-thumbnails)
1213
- [0.3.x -\> 0.4.x](#03x---04x)
1314
- [Elasticsearch upgrade from 7.9 to 7.10](#elasticsearch-upgrade-from-79-to-710)
1415
- [Disable automatic index creation](#disable-automatic-index-creation)
@@ -20,8 +21,8 @@
2021
- [Create collection index](#create-collection-index)
2122
- [Enable OpenSearch fine-grained access control](#enable-opensearch-fine-grained-access-control)
2223
- [Configure OpenSearch for fine-grained access control](#configure-opensearch-for-fine-grained-access-control)
23-
- [Option 1 - API method:](#option-1---api-method)
24-
- [Option 2 - Dashboard method:](#option-2---dashboard-method)
24+
- [Option 1 - API method](#option-1---api-method)
25+
- [Option 2 - Dashboard method](#option-2---dashboard-method)
2526
- [Populating and accessing credentials](#populating-and-accessing-credentials)
2627
- [Proxying Stac-server through CloudFront](#proxying-stac-server-through-cloudfront)
2728
- [Locking down transaction endpoints](#locking-down-transaction-endpoints)
@@ -243,6 +244,19 @@ Switch the DNS entry for the domain name to the API Gateway endpoint for the new
243244

244245
Double-check that the `DeletionPolicy: Retain` is set on the old Stack for the Elasticsearch/OpenSearch resource, and then delete the old Stack.
245246

247+
#### Granting Access for Thumbnails
248+
249+
The new experimental endpoint `/collections/{c_id}/items/{item_id}/thumbnail` will
250+
redirect to a URL providing a thumbnail as determined by the assets in an item. If the
251+
href for this is an AWS S3 ARN, IAM permissions must be granted for the API Lambda to
252+
generate a pre-signed HTTP URL instead. For example:
253+
254+
```yaml
255+
- Effect: Allow
256+
Action: s3:GetObject
257+
Resource: 'arn:aws:s3:::usgs-landsat/*'
258+
```
259+
246260
### 0.3.x -> 0.4.x
247261
248262
Create a new deployment, copy the elasticsearch database, and rename indexes.
@@ -401,7 +415,6 @@ There are some settings that should be reviewed and updated as needeed in the se
401415
| OPENSEARCH_CREDENTIALS_SECRET_ID | The AWS Secrets Manager secret to retrieve the username and password from, to authenticate to OpenSearch with if fine-grained access control is enabled. | |
402416
| COLLECTION_TO_INDEX_MAPPINGS | A JSON object representing collection id to index name mappings if they do not have the same names. | |
403417

404-
405418
| ITEMS_INDICIES_NUM_OF_SHARDS | Configure the number of shards for the indices that contain Items. | none |
406419
| ITEMS_INDICIES_NUM_OF_REPLICAS | Configure the number of replicas for the indices that contain Items. | none |
407420

@@ -553,7 +566,7 @@ Redeploy the stack, and this will be updated without re-creating the cluster.
553566
The next step is to create the OpenSearch user and role to use for stac-server. This can
554567
either be done through the OpenSearch API or Dashboard.
555568

556-
##### Option 1 - API method:
569+
##### Option 1 - API method
557570

558571
This assumes the master username is `admin` and creats a user with the name `stac_server`.
559572

@@ -617,7 +630,7 @@ curl -X "PUT" "${HOST}/_plugins/_security/api/rolesmapping/stac_server_role" \
617630
}'
618631
```
619632

620-
##### Option 2 - Dashboard method:
633+
##### Option 2 - Dashboard method
621634

622635
Login to the OpenSearch Dashboard with the master username (e.g. `admin`) and password.
623636
From the left sidebar menu, select "Security". Select "Internal users", and then "Create
@@ -726,7 +739,8 @@ def lambda_handler(event, context):
726739

727740
### Locking down transaction endpoints
728741

729-
If you wanted to deploy STAC Server in a way which ensures certain endpoints have restricted access but others don't, you can deploy it into a VPC and add conditions that allow only certain IP addresses to access certain endpoints. Once you deploy STAC Server into a VPC, you can modify the Resource Policy of the API Gateway endpoint that gets deployed to restrict access to certain endpoints. Here is a hypothetical example. Assume that the account into which STAC Server is deployed is numbered 1234-5678-9123, the API ID is ab1c23def, and the region in which it is deployed is us-west-2. You might want to give the general public access to use any GET or POST endpoints with the API such as the "/search" endpoint, but lock down access to the transaction endpoints (see https://github.com/radiantearth/stac-api-spec/tree/master/ogcapi-features/extensions/transaction) to only allow certain IP addresses to access them. These IP addresses can be, for example: 94.61.192.106, 204.176.50.129, and 11.27.65.78. In order to do this, you can impose a condition on the API Gateway that only allows API transactions such as adding, updating, and deleting STAC items from the whitelisted endpoints. For example, here is a Resource Policy containing two statements that allow this to happen:
742+
If you wanted to deploy STAC Server in a way which ensures certain endpoints have restricted access but others don't, you can deploy it into a VPC and add conditions that allow only certain IP addresses to access certain endpoints. Once you deploy STAC Server into a VPC, you can modify the Resource Policy of the API Gateway endpoint that gets deployed to restrict access to certain endpoints. Here is a hypothetical example. Assume that the account into which STAC Server is deployed is numbered 1234-5678-9123, the API ID is ab1c23def, and the region in which it is deployed is us-west-2. You might want to give the general public access to use any GET or POST endpoints with the API such as the "/search" endpoint, but lock down access to the transaction endpoints (see <https://github.com/radiantearth/stac-api-spec/tree/master/ogcapi-features/extensions/transaction>) to only allow certain IP addresses to access them. These IP addresses can be, for example: 94.61.192.106, 204.176.50.129, and 11.27.65.78. In order to do this, you can impose a condition on the API Gateway that only allows API transactions such as adding, updating, and deleting STAC items from the whitelisted endpoints. For example, here is a Resource Policy containing two statements that allow this to happen:
743+
730744
```
731745
{
732746
"Version": "2012-10-17",

serverless.example.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ provider:
3737
- sqs:DeleteMessage
3838
Resource:
3939
Fn::GetAtt: [ingestQueue, Arn]
40+
- Effect: Allow
41+
Action: s3:GetObject
42+
Resource: 'arn:aws:s3:::usgs-landsat/*'
4043
# - Effect: "Allow"
4144
# Action: "lambda:InvokeFunction"
4245
# Resource: "arn:aws:lambda:${aws:region}:${aws:accountId}:function:${self:service}-${self:provider.stage}-preHook"

0 commit comments

Comments
 (0)