| 1 |
# Debugging Errors |
| 2 |
|
| 3 |
## named cookie not present |
| 4 |
|
| 5 |
Debugging this issue is a bit hard. At least here is a step-by-step guide to debug the cookie handling in the browser. |
| 6 |
|
| 7 |
I assume you are using a Chrome-based Browser. |
| 8 |
|
| 9 |
### Requirements |
| 10 |
|
| 11 |
- Before connecting to OpenVPN server, open a browser locally. On the new tab |
| 12 |
page, right-click and select **Inspect**. Open the **Network** tab and enable |
| 13 |
**Preserve log** before continuing. |
| 14 |
 |
| 15 |
|
| 16 |
- Ideally, you aren't logged on Azure with your main browser, otherwise you are not intercept the flow. |
| 17 |
|
| 18 |
- Ensure that you have access to OpenVPN server logs in real time. If you use |
| 19 |
`journalctl`, add `--no-pager` so long links are not truncated. |
| 20 |
|
| 21 |
### Debugging Steps |
| 22 |
|
| 23 |
1. Initiate connection to OpenVPN server, close the browser opened by OpenVPN client. |
| 24 |
2. Goto OpenVPN server logs, grab the line with `INFO_PRE,WEB_AUTH` and copy the link with the full state. |
| 25 |
3. Paste the link on the tab where the browser console is opened. |
| 26 |
4. Continue the auth flow. |
| 27 |
5. On the access-denied screen, check the Browser Console for any errors. |
| 28 |
6. Then get the Network tab again. |
| 29 |
There is a request with `/oauth2/start` or just `start`. |
| 30 |
Click on Cookies and check if the response cookie is present. |
| 31 |
Example Screenshot: |
| 32 |
 |
| 33 |
7. Then get the Network tab again. |
| 34 |
There is a request with `/oauth2/callback` or just `callback`. |
| 35 |
Click on Cookies and check if the request cookie is present. |
| 36 |
Example Screenshot: |
| 37 |
 |
| 38 |
|
| 39 |
## Error Message `Received control message: 'PUSH_REQUEST'` in OpenVPN Client v3 |
| 40 |
|
| 41 |
Sometimes the client stuck at this stage `Received control message: 'PUSH_REQUEST'` and can't connect, and at the end it will time out like this message `Connection Timeout`, and you can see in the logs like this: |
| 42 |
|
| 43 |
``` |
| 44 |
[Feb 14, 2024, 22:28:57] Session is ACTIVE |
| 45 |
[Feb 14, 2024, 22:28:57] EVENT: GET_CONFIG |
| 46 |
[Feb 14, 2024, 22:28:57] Sending PUSH_REQUEST to server... |
| 47 |
[Feb 14, 2024, 22:28:58] Sending PUSH_REQUEST to server... |
| 48 |
[Feb 14, 2024, 22:29:00] Sending PUSH_REQUEST to server... |
| 49 |
[Feb 14, 2024, 22:29:03] Sending PUSH_REQUEST to server... |
| 50 |
[Feb 14, 2024, 22:29:06] Sending PUSH_REQUEST to server... |
| 51 |
[Feb 14, 2024, 22:29:09] Sending PUSH_REQUEST to server... |
| 52 |
[Feb 14, 2024, 22:29:12] Sending PUSH_REQUEST to server... |
| 53 |
[Feb 14, 2024, 22:29:15] Sending PUSH_REQUEST to server... |
| 54 |
[Feb 14, 2024, 22:29:18] Sending PUSH_REQUEST to server... |
| 55 |
[Feb 14, 2024, 22:29:21] Sending PUSH_REQUEST to server... |
| 56 |
[Feb 14, 2024, 22:29:24] Sending PUSH_REQUEST to server... |
| 57 |
[Feb 14, 2024, 22:29:27] Sending PUSH_REQUEST to server... |
| 58 |
[Feb 14, 2024, 22:29:29] Raw stats on disconnect: |
| 59 |
BYTES_IN : 3483 |
| 60 |
BYTES_OUT : 4088 |
| 61 |
PACKETS_IN : 18 |
| 62 |
PACKETS_OUT : 20 |
| 63 |
``` |
| 64 |
|
| 65 |
If you see this message on the client-side (version3), |
| 66 |
you may want to make sure you add these lines to your oauth configuration file |
| 67 |
|
| 68 |
<table> |
| 69 |
<thead><tr><td>env/sysconfig configuration</td></tr></thead> |
| 70 |
<tbody><tr><td> |
| 71 |
|
| 72 |
```ini |
| 73 |
OPENVPN_AUTH_OAUTH2_OAUTH2_REFRESH_ENABLED=true |
| 74 |
OPENVPN_AUTH_OAUTH2_OAUTH2_REFRESH_EXPIRES=24h |
| 75 |
OPENVPN_AUTH_OAUTH2_OAUTH2_REFRESH_SECRET=... # 16 or 24 characters |
| 76 |
``` |
| 77 |
</td></tr></tbody> |
| 78 |
<thead><tr><td>yaml configuration</td></tr></thead> |
| 79 |
<tbody><tr><td> |
| 80 |
|
| 81 |
```yaml |
| 82 |
oauth2: |
| 83 |
refresh: |
| 84 |
enabled: true |
| 85 |
expires: 24h |
| 86 |
secret: "..." # 16 or 24 characters |
| 87 |
``` |
| 88 |
</td></tr></tbody> |
| 89 |
</table> |
| 90 |
|
| 91 |
For reference, you can read more about these properties in the wiki at this [link](https://github.com/jkroepke/openvpn-auth-oauth2/wiki/Configuration#non-interactive-session-refresh) |
| 92 |
|
| 93 |
|
| 94 |
## Mobile clients: OpenVPN connect won't be reconnecting after unless App is opened |
| 95 |
|
| 96 |
If you are using the OpenVPN Connect app on your mobile device, you may have noticed that the app won't reconnect after a connection loss unless you open the app. |
| 97 |
This is a known issue and is caused by the app being put to sleep by the operating system. To fix this, configure |
| 98 |
|
| 99 |
**OpenVPN Server Configuration** |
| 100 |
``` |
| 101 |
auth-token-gen [lifetime] external-auth |
| 102 |
``` |
| 103 |
|
| 104 |
**openvpn-auth-oauth2 Configuration** |
| 105 |
|
| 106 |
<table> |
| 107 |
<thead><tr><td>env/sysconfig configuration</td></tr></thead> |
| 108 |
<tbody><tr><td> |
| 109 |
|
| 110 |
```ini |
| 111 |
OPENVPN_AUTH_OAUTH2_OAUTH2_REFRESH_ENABLED=true |
| 112 |
OPENVPN_AUTH_OAUTH2_OAUTH2_REFRESH_EXPIRES=8h |
| 113 |
OPENVPN_AUTH_OAUTH2_OAUTH2_REFRESH_SECRET=... # a static secret to encrypt token. Must be 16, 24 or 32 |
| 114 |
OPENVPN_AUTH_OAUTH2_OAUTH2_REFRESH_USE_SESSION_ID=true |
| 115 |
``` |
| 116 |
</td></tr></tbody> |
| 117 |
<thead><tr><td>yaml configuration</td></tr></thead> |
| 118 |
<tbody><tr><td> |
| 119 |
|
| 120 |
```yaml |
| 121 |
oauth2: |
| 122 |
refresh: |
| 123 |
enabled: true |
| 124 |
expires: 8h |
| 125 |
secret: "..." # 16 or 24 characters |
| 126 |
use-session-id: true |
| 127 |
``` |
| 128 |
</td></tr></tbody> |
| 129 |
</table> |
| 130 |
|
| 131 |
For reference, you can read more about these properties in the wiki at this [link](https://github.com/jkroepke/openvpn-auth-oauth2/wiki/Configuration#non-interactive-session-refresh) |