test kerberos sso with "save ticket in memory" enabled

This commit is contained in:
Robin Appelman 2022-01-20 14:09:23 +01:00
commit 8cfc847166
2 changed files with 55 additions and 0 deletions

View file

@ -203,6 +203,38 @@ jobs:
run: |
docker logs apache
kerberos-sso-memory:
runs-on: ubuntu-20.04
name: Kerberos SSO tests - Save ticket in memory
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
- name: Composer
run: composer install
- name: Pull images
run: |
docker pull icewind1991/samba-krb-test-dc
docker pull icewind1991/samba-krb-test-apache
docker pull icewind1991/samba-krb-test-client
- name: Setup AD-DC
run: |
tests/setup-krb.sh
- name: Test kerberos auth
run: |
DC_IP=$(docker inspect dc --format '{{.NetworkSettings.IPAddress}}')
LIST=$(docker run --rm --name client -v /tmp/shared:/shared --dns $DC_IP --hostname client.domain.test icewind1991/samba-krb-test-client \
curl -s --negotiate -u testuser@DOMAIN.TEST: --delegation always http://httpd.domain.test/example-apache-kerberos-memory.php)
echo $LIST
LIST=$(echo $LIST | tr -d '[:space:]')
[[ $LIST == "test.txt" ]]
- name: Apache logs
if: always()
run: |
docker logs apache
static-psalm-analysis:
runs-on: ubuntu-latest
name: Psalm static analysis

View file

@ -0,0 +1,23 @@
<?php
require('vendor/autoload.php');
if (php_sapi_name() == "cli") {
echo "Note: this example shouldn't be called from cli as it expects apache to setup the keberos ticket\n";
}
// dfs paths not working
$host = 'krb.domain.test';
$share = 'netlogon';
$auth = new \Icewind\SMB\KerberosApacheAuth(true);
$serverFactory = new \Icewind\SMB\ServerFactory();
$server = $serverFactory->createServer($host, $auth);
$share = $server->getShare($share);
$files = $share->dir('/');
foreach ($files as $file) {
echo $file->getName() . "\n";
}