Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magpie thredds #107

Merged
merged 25 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
807a13d
updated magpie and twitcher to 3.2.0 + add thredds browse permission …
Nov 10, 2020
d2c6405
secure config for thredds
fmigneault Nov 9, 2020
5bcc1c3
readme secure-thredds updates + remove public handled by other config
fmigneault Nov 10, 2020
89cbd89
remove top-level secure directory permission + add write deny permission
fmigneault Nov 11, 2020
d9f4739
add readme details
fmigneault Nov 11, 2020
2c460c9
fix typos and over-length doc lines
fmigneault Nov 11, 2020
2ddf64e
fix markdown links
fmigneault Nov 11, 2020
c6982c3
add how-to enable secure component
fmigneault Nov 11, 2020
b08f972
Merge pull request #99 from bird-house/test-magpie-auth
fmigneault Nov 12, 2020
9759e1d
Merge remote-tracking branch 'origin/master' into bump_magpie_and_twi…
tlvu Nov 13, 2020
90b27b3
README: remove trailing white
tlvu Nov 13, 2020
32cd6f9
create-magpie-users: bump magpie image to match newer version
tlvu Nov 13, 2020
8f8eb2a
bump magpie 3.2.1 (fix permission modifiers from config) + add resour…
fmigneault Nov 18, 2020
67ff45c
allow test user access to thredds secure resource + use permission ob…
fmigneault Nov 19, 2020
c9ce4ca
Merge remote-tracking branch 'origin/master' into bump_magpie_and_twi…
tlvu Nov 20, 2020
0d332a3
custom magpie thredds config
fmigneault Nov 24, 2020
6cbfe85
bump magpie/twticher v3.3.0
fmigneault Nov 25, 2020
0863653
update magpie's thredds config with extra prefixes
fmigneault Nov 26, 2020
6e9b1d8
add doc reference to magpie thredds config
fmigneault Nov 26, 2020
f448778
add ncml extension to magpie-thredds config
fmigneault Nov 30, 2020
79c56f1
bump magpie and twitcher to 3.5.0
Jan 27, 2021
242e234
bump magpie/twitcher 3.5.1
fmigneault Feb 8, 2021
7c1a831
Merge branch 'master' into magpie-thredds
fmigneault Mar 16, 2021
81b2304
reapply readme details against latest master changes
fmigneault Mar 16, 2021
ea21821
Merge branch 'master' into magpie-thredds
fmigneault Mar 18, 2021
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
26 changes: 26 additions & 0 deletions birdhouse/config/magpie/providers.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,32 @@ providers:
c4i: false
type: thredds
sync_type: thredds
# below is a custom config to indicate how magpie should convert thredds path elements into resources/permissions
# see: https://pavics-magpie.readthedocs.io/en/latest/services.html#servicethredds
configuration:
skip_prefix: "thredds" # prefix to ignore, below prefixes will be matched against whatever comes after in path
file_patterns:
# note: make sure to employ quotes and double escapes to avoid parsing YAML error
- ".+\\.ncml" # match longest extension first to avoid tuncating it by match of sorter '.nc'
- ".+\\.nc"
fmigneault marked this conversation as resolved.
Show resolved Hide resolved
fmigneault marked this conversation as resolved.
Show resolved Hide resolved
metadata_type:
prefixes:
- null # note: special YAML value evaluated as `no-prefix`, use quotes if literal value is needed
- "\\w+\\.gif" # threddsIcon, folder icon, etc.
- "\\w+\\.ico" # favicon
- "\\w+\\.txt" # licence
- "\\w+\\.css" # tds.css
- "catalog\\.\\w+" # note: special case for `THREDDS` top-level directory (root) accessed for `BROWSE`
- catalog
- ncml
fmigneault marked this conversation as resolved.
Show resolved Hide resolved
- uddc
- iso
data_type:
prefixes:
- fileServer
- dodsC
- wcs
- wms

ncWMS2:
url: http://${PAVICS_FQDN}:8080/ncWMS2
Expand Down
4 changes: 2 additions & 2 deletions birdhouse/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ services:
restart: always

magpie:
image: pavics/magpie:1.7.3
image: pavics/magpie:3.5.1
container_name: magpie
ports:
- "2001:2001"
Expand All @@ -312,7 +312,7 @@ services:
restart: always

twitcher:
image: pavics/twitcher:magpie-1.7.3
image: pavics/twitcher:magpie-3.5.1
container_name: twitcher
ports:
- "8000:8000"
Expand Down
7 changes: 5 additions & 2 deletions birdhouse/env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,17 @@ export POSTGRES_MAGPIE_PASSWORD=postgres-qwerty
# Format: space separated list of dirs
#
#export EXTRA_CONF_DIRS="/path/to/dir1 ./path/to/dir2 dir3 dir4"
#export EXTRA_CONF_DIRS="./optional-components/canarie-api-full-monitoring
#export EXTRA_CONF_DIRS="
# ./optional-components/canarie-api-full-monitoring
# ./optional-components/emu
# ./optional-components/testthredds
# ./optional-components/generic_bird
# ./optional-components/all-public-access
# ./optional-components/secure-thredds
# ./components/scheduler
# ./components/monitoring
# /path/to/private-config-repo"
# /path/to/private-config-repo
#"

# Extra repos, than the current repo, the autodeploy should keep up-to-date.
# Any changes to these extra repos will also trigger autodeploy.
Expand Down
61 changes: 47 additions & 14 deletions birdhouse/optional-components/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ the end user).
This assume all the WPS services are public. If not the case, make a copy of
this config and adjust accordingly.

How to enable this config in ``env.local`` (a copy from env.local.example_ (:download:`download </birdhouse/env.local.example>`)):
How to enable this config in ``env.local`` (a copy from env.local.example_
(:download:`download </birdhouse/env.local.example>`)):

* Add ``./optional-components/canarie-api-full-monitoring`` to ``EXTRA_CONF_DIRS``.

Expand All @@ -30,13 +31,15 @@ alternative configuration of existing birds.
No Postgres DB configured. If need Postgres DB, use generic_bird component
instead.

How to enable Emu in ``env.local`` (a copy from env.local.example_ (:download:`download </birdhouse/env.local.example>`)):
How to enable Emu in ``env.local`` (a copy from env.local.example_
(:download:`download </birdhouse/env.local.example>`)):

* Add ``./optional-components/emu`` to ``EXTRA_CONF_DIRS``.
* Optionally set ``EMU_IMAGE``, ``EMU_PORT``,
``EMU_NAME``, ``EMU_INTERNAL_PORT``,
``EMU_WPS_OUTPUTS_VOL`` in ``env.local`` for further customizations.
Default values are in `optional-components/emu/default.env <emu/default.env>`_ (:download:`download </birdhouse/optional-components/emu/default.env>`).
Default values are in `optional-components/emu/default.env <emu/default.env>`_
(:download:`download </birdhouse/optional-components/emu/default.env>`).

Emu service will be available at ``http://PAVICS_FQDN:EMU_PORT/wps`` or
``https://PAVICS_FQDN_PUBLIC/TWITCHER_PROTECTED_PATH/EMU_NAME`` where
Expand All @@ -50,7 +53,7 @@ CANARIE monitoring will also be automatically configured for this Emu WPS
service.


A second THREDDs server for testing
A second THREDDS server for testing
-----------------------------------

How to enable in ``env.local`` (a copy from env.local.example_ (:download:`download </birdhouse/env.local.example>`)):
Expand All @@ -62,12 +65,12 @@ How to enable in ``env.local`` (a copy from env.local.example_ (:download:`downl
``TESTTHREDDS_INTERNAL_PORT``\ , ``TESTTHREDDS_NAME``\ , in ``env.local`` for further
customizations. Default values are in: `optional-components/testthredds/default.env <testthredds/default.env>`_ (:download:`download </birdhouse/optional-components/testthredds/default.env>`).

Test THREDDs service will be available at
Test THREDDS service will be available at
``http://PAVICS_FQDN:TESTTHREDDS_PORT/TESTTHREDDS_CONTEXT_ROOT`` or
``https://PAVICS_FQDN_PUBLIC/TESTTHREDDS_CONTEXT_ROOT`` where ``PAVICS_FQDN`` and
``PAVICS_FQDN_PUBLIC`` are defined in your ``env.local``.

Use same docker image as regular THREDDs by default but can be customized.
Use same docker image as regular THREDDS by default but can be customized.

New container have new ``TestDatasets`` with volume-mount to ``/data/testdatasets``
on the host. So your testing ``.nc`` and ``.ncml`` files should be added to
Expand All @@ -79,11 +82,11 @@ server.
``export EMU_WPS_OUTPUTS_VOL=testwps_outputs`` to ``env.local`` for Emu to write to
``TestWps_Output`` dataset.

No Twitcher/Magpie access control, this Test THREDDs is directly behind the
No Twitcher/Magpie access control, this Test THREDDS is directly behind the
Nginx proxy.

CANARIE monitoring will also be automatically configured for this second
THREDDs server.
THREDDS server.


A generic bird WPS service
Expand All @@ -99,7 +102,8 @@ How to enable in ``env.local`` (a copy from env.local.example_ (:download:`downl
* Optionally set ``GENERIC_BIRD_IMAGE``, ``GENERIC_BIRD_PORT``,
``GENERIC_BIRD_NAME``, ``GENERIC_BIRD_INTERNAL_PORT``, and
``GENERIC_BIRD_POSTGRES_IMAGE`` in ``env.local`` for further customizations.
Default values are in `optional-components/generic_bird/default.env <generic_bird/default.env>`_ (:download:`download </birdhouse/optional-components/generic_bird/default.env>`).
Default values are in `optional-components/generic_bird/default.env <generic_bird/default.env>`_
(:download:`download </birdhouse/optional-components/generic_bird/default.env>`).

The WPS service will be available at ``http://PAVICS_FQDN:GENERIC_BIRD_PORT/wps``
or ``https://PAVICS_FQDN_PUBLIC/TWITCHER_PROTECTED_PATH/GENERIC_BIRD_NAME`` where
Expand All @@ -117,23 +121,52 @@ access for this WPS service.

CANARIE monitoring will also be automatically configured for this WPS service.

.. _magpie-public-access-config:

Give public access to all resources for testing purposes
--------------------------------------------------------

By enabling this component, all WPS services and data on THREDDs are completely public, please beware.
Once enabled, if you need to revert the change, you have to do it manually by logging into Magpie.
By enabling this component, all WPS services and data on THREDDS are completely public, please beware.
Once enabled, if you need to revert the change, you have to do it manually by logging into Magpie.
Just disabling this component will not revert the change.
Alternatively, you can create a similar file to |magpie-public-perms|_ and replace all desired ``action: create``
entries by ``action: remove`` to make sure the permissions are removed as startup if they exist.

This optional component is required for the test suite at
https://github.com/Ouranosinc/PAVICS-e2e-workflow-tests.

How to enable in ``env.local`` (a copy from env.local.example_ (:download:`download </birdhouse/env.local.example>`)):
How to enable in ``env.local`` (a copy from `env.local.example`_ (:download:`download </birdhouse/env.local.example>`)):

* Add ``./optional-components/all-public-access`` to ``EXTRA_CONF_DIRS``.

The anonymous user will now have all the permissions described in `optional-components/all-public-access/all-public-access-magpie-permission.cfg <all-public-access/all-public-access-magpie-permission.cfg>`_ (:download:`download </birdhouse/optional-components/all-public-access/all-public-access-magpie-permission.cfg>`).

The anonymous user will now have all the permissions described in |magpie-public-perms|_
(:download:`download </birdhouse/optional-components/all-public-access/all-public-access-magpie-permission.cfg>`).


.. _magpie-public-perms: ./all-public-access/all-public-access-magpie-permission.cfg
.. |magpie-public-perms| replace:: optional-components/all-public-access/all-public-access-magpie-permission.cfg
.. _env.local.example: ../env.local.example


Control secured access to resources example
--------------------------------------------------------

Optional configuration |magpie-secure-perms|_ is provided as example to illustrate how to apply permissions on specific
THREDDS resources to limit their access publicly. This permission configuration can be combined with others, such as
`magpie-public-access-config`_ ones to formulate specific permissions schemes that matches your data structure and
desired access rules.

How to enable in ``env.local`` (a copy from `env.local.example`_ (:download:`download </birdhouse/env.local.example>`)):

* Add ``./optional-components/secure-thredds`` to ``EXTRA_CONF_DIRS``.

The anonymous user will *NOT* have access anymore to THREDDS test directory ``birdhouse/testdata/secure`` and any other
directories and files under it. Directories above and next to ``secure`` will still be accessible if
`magpie-public-access-config`_ component was also enabled.

On a typical server, custom and private permission rules should be provided in a similar fashion to ensure that
each time a new instance is booted, the same scheme of access configuration is applied. Permissions applied manually
into Magpie will not be replicated onto other server instance.

.. _magpie-secure-perms: ./secure-thredds/secure-access-magpie-permission.cfg
.. |magpie-secure-perms| replace:: optional-components/secure-thredds/secure-access-magpie-permission.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@ permissions:
permission: read
group: anonymous
action: create

- service: thredds
permission: browse
group: anonymous
action: create
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: '2.1'
services:
magpie:
volumes:
- ./optional-components/secure-thredds/secure-access-magpie-permission.cfg:/opt/local/src/magpie/config/permissions/secure-access-magpie-permission.cfg:ro
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
permissions:
# note:
# following permissions can be combined with others such as 'optional-components/all-public-access'
# to provide access to 'everything' except those under 'secure' directories listed below

# following permissions only enforce security on specific directories and files under it
# these can be reverted or combined with other set of permissions on resources 'above' or 'under' in the hierarchy
# users or groups will need explicit permissions under following resources for them to access sub-directories/files
- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: browse
access: deny
scope: recursive
group: anonymous
action: create

- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: read
access: deny
scope: recursive
group: anonymous
action: create

- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: write
access: deny
scope: recursive
group: anonymous
action: create

# preserve access for test-suite user
- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: browse
access: allow
scope: recursive
user: authtest
action: create

- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: read
access: allow
scope: recursive
user: authtest
action: create

- service: thredds
resource: /birdhouse/testdata/secure
type: directory
permission:
name: write
access: allow
scope: recursive
user: authtest
action: create
2 changes: 1 addition & 1 deletion birdhouse/scripts/create-magpie-users
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ if [ -z "$MAGPIE_CLI_CONF" ]; then
fi

if [ -z "$MAGPIE_CLI_IMAGE" ]; then
MAGPIE_CLI_IMAGE="pavics/magpie:2.0.1"
MAGPIE_CLI_IMAGE="pavics/magpie:3.2.0"
fi

# End configurable config via env var.
Expand Down