Skip to content

Commit

Permalink
Disable xoauth2 integration testst
Browse files Browse the repository at this point in the history
While these tests are neccessary, they cannot be completed
immutably. They rely in access and refresh token from Google
and these expire -- we would need to devise a smart way of
getting them every time before the tests are run.
  • Loading branch information
bokysan committed Nov 7, 2020
1 parent 16771d4 commit 7d21881
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,14 @@ This level defines how the postfix will connect to your upstream server.
> Note: These parameters are used when `RELAYHOST` and `RELAYHOST_USERNAME` are provided.
These parameters allow you to configure a relayhost that requires (or recommends) the [XOAuth2 authentication method](https://github.com/tarickb/sasl-xoauth2) (e.g. GMail).
- `XOAUTH2_CLIENT_ID` and `XOAUTH2_SECRET` are the [OAuth2 client credentials](#oauth2-client-credentials-gmail).
- `XOAUTH2_INITIAL_ACCESS_TOKEN` and `XOAUTH2_INITIAL_REFRESH_TOKEN` are the [initial access token and refresh tokens](#obtain-initial-access-token-gmail). These values are only required to initialize the token file `/var/spool/postfix/xoauth2-tokens/$RELAYHOST_USERNAME`.

* `XOAUTH2_CLIENT_ID` and `XOAUTH2_SECRET` are the [OAuth2 client credentials](#oauth2-client-credentials-gmail).
* `XOAUTH2_INITIAL_ACCESS_TOKEN` and `XOAUTH2_INITIAL_REFRESH_TOKEN` are the [initial access token and refresh tokens](#obtain-initial-access-token-gmail).
These values are only required to initialize the token file `/var/spool/postfix/xoauth2-tokens/$RELAYHOST_USERNAME`.

Example:
```

```shell script
docker run --rm --name pruebas-postfix \
-e RELAYHOST="[smtp.gmail.com]:587" \
-e RELAYHOST_USERNAME="<put.your.account>@gmail.com" \
Expand All @@ -208,6 +211,7 @@ docker run --rm --name pruebas-postfix \
-e XOAUTH2_INITIAL_REFRESH_TOKEN="<put_your_refresh_token>" \
boky/postfix
```

Next sections describe how to obtain these values.

##### OAuth2 Client Credentials (GMail)
Expand All @@ -226,8 +230,8 @@ Save the resulting tokens and use them to initialize `XOAUTH2_INITIAL_ACCESS_TOK

##### Debug XOAuth2 issues

If you have XOAuth2 authentication issues you can enable XOAuth2 debug message setting `XOAUTH2_SYSLOG_ON_FAILURE` to `"yes"` (default: `"no"`). If you need a more detailed log trace about XOAuth2 you can set `XOAUTH2_FULL_TRACE` to `"yes"` (default: `"no"`).

If you have XOAuth2 authentication issues you can enable XOAuth2 debug message setting `XOAUTH2_SYSLOG_ON_FAILURE` to `"yes"` (default: `"no"`). If you need a more detailed
log trace about XOAuth2 you can set `XOAUTH2_FULL_TRACE` to `"yes"` (default: `"no"`).

#### `MASQUERADED_DOMAINS`

Expand Down Expand Up @@ -496,7 +500,7 @@ account which will use `UID:GID` of `100:101`. `opendkim` will run under account
### Relaying messages through your Gmail account
Please note that Gmail does not support using your password with non-OAuth2 clients. You will need to either enable
Please note that Gmail does not support using your password with non-OAuth2 clients. You will need to either enable
[Less secure apps](https://support.google.com/accounts/answer/6010255?hl=en) in your account and assign an "app password"
or [configure postfix support for XOAuth2 authentication](#xoauth2_client_id-xoauth2_secret-xoauth2_initial_access_token-and-xoauth2_initial_refresh_token).
You'll also need to use (only) your email as the sender address.
Expand Down
6 changes: 4 additions & 2 deletions integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ if [[ $# -gt 0 ]]; then
shift
done
else
for i in `find -maxdepth 1 -type d`; do
# Disable xoauth2 integration tests as they an access and refresh token. And these expire
# after a certain time, so we cannot rely on tests working all the time.
for i in `find -maxdepth 1 -type d | grep -Ev "^./(xoauth2|tester)" | sort`; do
i="$(basename "$i")"
if [ "$i" == "tester" ] || [ "$i" == "." ] || [ "$i" == ".." ]; then
if [ "$i" == "." ] || [ "$i" == ".." ]; then
continue
fi
run_test $i
Expand Down

0 comments on commit 7d21881

Please sign in to comment.