Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Add initial osg token renewer doc (SOFTWARE-4763) #868

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
92b6698
add initial osg token renewer doc (SOFTWARE-4763)
edquist Aug 21, 2021
7588a58
Apply suggestions from code review
edquist Aug 23, 2021
11edb37
slide this up (SOFTWARE-4763)
edquist Aug 21, 2021
895917e
update setup script usage to include ISSUER parameter (SOFTWARE-4763)
edquist Aug 27, 2021
d6ab9cb
make OIDC token issuer account requirement non-WLCG-specific
edquist Aug 27, 2021
b58770b
convert steps to ordered list (SOFTWARE-4763)
edquist Aug 27, 2021
f1c0d26
whitespace cleanup
edquist Aug 27, 2021
81d2400
reorganize section names a bit (SOFTWARE-4763)
edquist Aug 27, 2021
4c119a4
move details out that belong in readmen (SOFTWARE-4763)
edquist Aug 27, 2021
25cf6b6
drop duplicate section heading (SOFTWARE-4763)
edquist Aug 27, 2021
f000aca
drop configuration prose, to be moved to README (SOFTWARE-4763)
edquist Aug 27, 2021
9157999
add service tables (SOFTWARE-4763)
edquist Aug 27, 2021
3e4868a
Apply suggestions from code review
edquist Sep 13, 2021
359ecbd
include TOKEN_NAME in token path (SOFTWARE-4763)
edquist Sep 21, 2021
8ea591f
tidy whitespace (SOFTWARE-4763)
edquist Sep 21, 2021
1c80c14
reflect updated osg-token-renewer-setup.sh usage (SOFTWARE-4763)
edquist Sep 21, 2021
594da1f
mention updated timer frequency (SOFTWARE-4763)
edquist Sep 21, 2021
6279ace
misc ocd tidying (SOFTWARE-4763)
edquist Sep 21, 2021
2cfd173
Merge remote-tracking branch 'edquist/SOFTWARE-4763.osg-token-renewer…
edquist Sep 21, 2021
3bd76b8
Apply suggestions from code review
edquist Sep 27, 2021
1560838
doc tweaks from Brian
edquist Sep 28, 2021
32d448a
reword a bit per PR discussion (SOFTWARE-4763)
edquist Sep 28, 2021
1486211
provide example config (SOFTWARE-4763)
edquist Sep 28, 2021
a804c2f
fix path to other/osg-token-renewer.md in index (SOFTWARE-4763)
edquist Sep 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
174 changes: 174 additions & 0 deletions docs/other/osg-token-renewer.md
@@ -0,0 +1,174 @@
Installing and Using the OSG Token Renewal Service
==================================================

This document contains instructions to install and configure the
OSG Token Renewal Service package, `osg-token-renewer`,
for obtaining and automatically renewing tokens with [oidc-agent](https://github.com/indigo-dc/oidc-agent).


Before Starting
---------------

Before starting the installation process, consider the following points
(consulting [the Reference section below](#reference) as needed):

- An account is needed with an OIDC token issuer that offers the device flow
- **User and Group IDs:** If they do not exist already, the installation will
create the Linux user and group named `osg-token-svc`

As with all OSG software installations, there are some one-time (per host)
steps to prepare in advance:

- Ensure the host has
[a supported operating system](../release/supported_platforms.md)
- Obtain root access to the host
- Prepare the [required Yum repositories](../common/yum.md)


Installing the OSG Token Renewal Service
----------------------------------------

Install the OSG Token Renewal Service package:

```console
root@server # yum install osg-token-renewer
```

This will install the `osg-token-renewer` scripts & systemd service files,
and will pull in the `oidc-agent` package that the service depends on.


Configuring the OSG Token Renewal Service
-----------------------------------------


### Configuring accounts

To create a new client account named `<ACCOUNT_SHORTNAME>`:

1. Create a corresponding file named `/etc/osg/tokens/<ACCOUNT_SHORTNAME>.pw`
with the encryption password to use for this client account.
1. Consult the
[Requesting Tokens](https://opensciencegrid.org/technology/software/requesting-tokens/)
document to determine which scopes you will need for this client account.
1. Run the setup script as follows:

:::console
root@server # osg-token-renewer-setup.sh <ACCOUNT_SHORTNAME>

For example,

:::console
root@server # osg-token-renewer-setup.sh myaccount123

1. When prompted, enter your Issuer and desired scopes for this account
from the list of valid options.
1. You will also be prompted on the console to visit a web link to authorize
the client request with a passcode printed on the console.
Follow the prompts (visit the web link, enter the request passcode,
log in with your account for your issuer, and authorize the request).
1. If this succeeds, you will be prompted with a new
`[account <ACCOUNT_SHORTNAME>]` section to add to your `config.ini`.
Add the section to your `/etc/token-renewer/config.ini`,
replacing the example section if it's still there.

Next you can configure one or more tokens for this client account.


### Configuring tokens

After you have created an OIDC client account and added it to
`/osg/token-renewer/config.ini`, you need to create a corresponding `token`
section in the config for each token that should be generated for this account
(possibly with different options).

1. Choose a `<TOKEN_NAME>` and add a new `[token <TOKEN_NAME>]` section
(replacing the example section if it's still there).

The `account` option in this section must match the `<ACCOUNT_SHORTNAME>`
for the corresponding `[account <ACCOUNT_SHORTNAME>]` section.

1. Set the `token_path` to
`/etc/osg/tokens/<ACCOUNT_SHORTNAME>.<TOKEN_NAME>.token`

1. Optionally, you may also specify any of the following options, which will
be passed to the `oidc-token` command when generating the token:

| Option | Description |
|:---------------|:----------------------------------------------------------|
| `audience` | list of audiences to pass via `--aud` option |
| `scope` | list of scopes to pass via `--scope` option |
| `min_lifetime` | min token lifetime in seconds to pass via `--time` option |
edquist marked this conversation as resolved.
Show resolved Hide resolved

!!! note
For tokens used against an HTCondor-CE, set the `audience` option to
`<CE FQDN>:<CE PORT>`.

### Example configuration

<insert example config here with account + token sections>
edquist marked this conversation as resolved.
Show resolved Hide resolved

Managing the OSG Token Renewal Service
--------------------------------------

These services are managed by `systemctl` and may start additional services as
dependencies.
As a reminder, here are common service commands (all run as `root`) for EL7:

| To... | On EL7, run the command... |
| :-------------------------------------- | :--------------------------------- |
| Start a service | `systemctl start <SERVICE-NAME>` |
| Stop a service | `systemctl stop <SERVICE-NAME>` |
| Enable a service to start on boot | `systemctl enable <SERVICE-NAME>` |
| Disable a service from starting on boot | `systemctl disable <SERVICE-NAME>` |

edquist marked this conversation as resolved.
Show resolved Hide resolved
### Public cache services
edquist marked this conversation as resolved.
Show resolved Hide resolved

| **Software** | **Service name** | **Notes** |
|--------------|------------------|-----------|
| OSG Token Renewer | `osg-token-renewer.service` | The OSG Token Renewer, runs as a "oneshot" service, not a daemon. |
| OSG Token Renewer timer | `osg-token-renewer.timer` | Nightly run schedule for OSG Token Renewer |


The OSG token renewal service is set to run via a systemd timer every 15
minutes.

If you would like to run the service manually at a different time (e.g., to
generate all the tokens immediately), you can run the service once with:

```console
root@host # systemctl start osg-token-renewer
```

If this succeeds, the new token will be written to the location you configured
for `token_path` (`/etc/osg/tokens/<ACCOUNT_SHORTNAME>.token`, by convention).

Failures can be diagnosed by running:

```console
root@host # journalctl -eu osg-token-renewer
```

Help
----

To get assistance please use this [Help Procedure](../common/help.md).


Reference
---------

### Files of interest

| Path | Description |
|:---------------------------------------------------------|:----------------------------------------------|
| `/etc/osg/token-renewer/config.ini` | Main config file for service |
| `/etc/osg/tokens/<ACCOUNT_SHORTNAME>.pw` | Encryption password file for client account |
| `/etc/osg/tokens/<ACCOUNT_SHORTNAME>.<TOKEN_NAME>.token` | Output location for token files |
| `/usr/bin/osg-token-renewer-setup.sh` | Setup script for each new client account |
| `/usr/lib/systemd/system/osg-token-renewer.service` | SystemD service unit configuruation |
| `/usr/lib/systemd/system/osg-token-renewer.timer` | SystemD timer for service |
| `/usr/bin/osg-token-renewer.sh` | Main wrapper script invoked by service |
| `/usr/bin/osg-token-renewer` | Token renewal program invoked by main wrapper |


1 change: 1 addition & 0 deletions mkdocs.yml
Expand Up @@ -56,6 +56,7 @@ nav:
- 'Install a CVMFS Stratum 1': 'other/install-cvmfs-stratum1.md'
- 'Troubleshooting Gratia': 'other/troubleshooting-gratia.md'
- 'Install Transfer Log Filebeats': 'other/schedd-filebeats.md'
- 'Install OSG Token Renewal Service': 'other/install-osg-token-renewer.md'
- Deprecated:
- POSIX Storage:
- 'Install GridFTP Server': 'data/gridftp.md'
Expand Down