-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
281 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
include ../_common/Makefile.common | ||
|
||
wait_start: | ||
for x in $$(seq $(STARTUPWAIT)); do \ | ||
if [ $$(docker compose logs | grep "failed=" | grep -v "failed=0" | wc -l) -gt 0 ]; then $(MAKE) wait_start_failed; exit 1; fi; \ | ||
if [ $$(curl -ks http://127.0.0.3:60080/demo/thruk/cgi-bin/remote.cgi | grep -c OK) -gt 0 ]; then break; else sleep 1; fi; \ | ||
if [ $$x -eq $(STARTUPWAIT) ]; then $(MAKE) wait_start_failed; exit 1; fi; \ | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
== OAuth Setup | ||
|
||
to manually reproduce things here you can: | ||
|
||
- open firefox and connect to: https://192.168.105.2/demo/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
networks: | ||
default: | ||
ipam: | ||
config: | ||
- subnet: 192.168.105.0/24 | ||
|
||
services: | ||
omd: | ||
build: omd/ | ||
ports: | ||
- "127.0.0.3:60080:80" # apache | ||
- "127.0.0.3:60557:6557" # livestatus | ||
- "127.0.0.3:8003:8003" # grafana | ||
- "127.0.0.3:4444:4444" # oauth server | ||
volumes: | ||
- ../../../:/thruk:ro | ||
- .:/scenario:ro | ||
networks: | ||
default: | ||
ipv4_address: 192.168.105.2 | ||
depends_on: | ||
- mock-oauth2-server | ||
|
||
mock-oauth2-server: | ||
image: ghcr.io/navikt/mock-oauth2-server:2.1.8 | ||
ports: | ||
- 8080:8080 | ||
environment: | ||
JSON_CONFIG: '{ "interactiveLogin": false }' | ||
networks: | ||
default: | ||
ipv4_address: 192.168.105.3 | ||
healthcheck: | ||
test: ["CMD", "curl", "-kf", "http://localhost:8080/default/.well-known/openid-configuration"] | ||
interval: 10s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 5m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM local/thruk-labs-rocky:nightly | ||
|
||
COPY playbook.yml /root/ansible_dropin/ | ||
ENV ANSIBLE_ROLES_PATH /thruk/t/scenarios/_common/ansible/roles | ||
COPY thruk_local.conf /root/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
- hosts: all | ||
roles: | ||
- role: common | ||
- role: thruk_developer | ||
tasks: | ||
- name: "omd config change" | ||
shell: "omd config demo change" | ||
args: | ||
stdin: | | ||
APACHE_MODE=own | ||
- copy: | ||
src: /omd/sites/demo/share/doc/naemon/example.cfg | ||
dest: /omd/sites/demo/etc/naemon/conf.d/example.cfg | ||
owner: demo | ||
group: demo | ||
- copy: | ||
src: /root/thruk_local.conf | ||
dest: /omd/sites/demo/etc/thruk/thruk_local.conf | ||
owner: demo | ||
group: demo | ||
- name: "wait for oauth server to come up" | ||
uri: | ||
url: "http://192.168.105.3:8080/default/.well-known/openid-configuration" | ||
validate_certs: False | ||
status_code: 200 | ||
register: result | ||
until: result.status == 200 | ||
retries: 180 | ||
delay: 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<auth_oauth> | ||
<provider> | ||
name = Login with OAuth | ||
client_id = clientö | ||
client_secret = secret | ||
scopes = openid profile email | ||
# get urls from http://192.168.105.3:8080/default/.well-known/openid-configuration | ||
auth_url = http://192.168.105.3:8080/default/authorize | ||
token_url = http://192.168.105.3:8080/default/token | ||
api_url = http://192.168.105.3:8080/default/userinfo | ||
login_field = azp | ||
enable_pkce = 1 | ||
</provider> | ||
</auth_oauth> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use warnings; | ||
use strict; | ||
use Test::More; | ||
use utf8; | ||
|
||
BEGIN { | ||
use lib('t'); | ||
require TestUtils; | ||
import TestUtils; | ||
plan tests => 58; | ||
} | ||
|
||
############################################################################### | ||
TestUtils::test_page( | ||
'url' => '/thruk/cgi-bin/login.cgi?logout', | ||
'like' => ['Login with OAuth'], | ||
'code' => 401, | ||
'follow' => 1, | ||
); | ||
|
||
############################################################################### | ||
TestUtils::test_page( | ||
'url' => '/thruk/cgi-bin/login.cgi', | ||
'like' => ['Login with OAuth'], | ||
'code' => 401, | ||
); | ||
|
||
############################################################################### | ||
TestUtils::test_page( | ||
'url' => '/thruk/cgi-bin/login.cgi', | ||
'post' => { 'oauth' => 0, submit => 'login' }, | ||
'like' => ['tac.cgi'], | ||
'follow' => 1, | ||
); | ||
|
||
############################################################################### | ||
TestUtils::test_page( | ||
'url' => '/thruk/cgi-bin/tac.cgi', | ||
'like' => ['>User<.*?>clientö<'], | ||
); | ||
|
||
############################################################################### | ||
TestUtils::test_page( | ||
'url' => '/thruk/cgi-bin/login.cgi?logout', | ||
'like' => ['Login with OAuth'], | ||
'code' => 401, | ||
'follow' => 1, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Component Thruk::Backend> | ||
<peer> | ||
name = naemon | ||
id = abcd | ||
type = livestatus | ||
<options> | ||
peer = 192.168.105.2:6557 | ||
</options> | ||
</peer> | ||
</Component> | ||
|
||
<auth_oauth> | ||
<provider> | ||
name = Login with OAuth | ||
client_id = clientö | ||
client_secret = secret | ||
scopes = openid profile email | ||
# get urls from http://192.168.105.3:8080/default/.well-known/openid-configuration | ||
auth_url = http://192.168.105.3:8080/default/authorize | ||
token_url = http://192.168.105.3:8080/default/token | ||
api_url = http://192.168.105.3:8080/default/userinfo | ||
login_field = azp | ||
enable_pkce = 1 | ||
</provider> | ||
</auth_oauth> | ||
|
||
slow_page_log_threshold = 45 |