Skip to content

Commit e512996

Browse files
icewind1991blizzz
authored andcommitted
kerberos sso ci fixes
Signed-off-by: Robin Appelman <[email protected]>
1 parent 07a9200 commit e512996

File tree

9 files changed

+97
-44
lines changed

9 files changed

+97
-44
lines changed

.github/workflows/smb-kerberos.yml

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,48 +27,26 @@ jobs:
2727
submodules: true
2828
- name: Pull images
2929
run: |
30-
docker pull icewind1991/samba-krb-test-dc
31-
docker pull icewind1991/samba-krb-test-apache
32-
docker pull icewind1991/samba-krb-test-client
30+
docker pull ghcr.io/icewind1991/samba-krb-test-dc
31+
docker pull ghcr.io/icewind1991/samba-krb-test-apache
32+
docker pull ghcr.io/icewind1991/samba-krb-test-client
33+
docker tag ghcr.io/icewind1991/samba-krb-test-dc icewind1991/samba-krb-test-dc
34+
docker tag ghcr.io/icewind1991/samba-krb-test-apache icewind1991/samba-krb-test-apache
35+
docker tag ghcr.io/icewind1991/samba-krb-test-client icewind1991/samba-krb-test-client
3336
- name: Setup AD-DC
3437
run: |
35-
cp apps/files_external/tests/*.sh .
36-
mkdir data
37-
sudo chown -R 33 data apps config
38-
DC_IP=$(./start-dc.sh)
39-
./start-apache.sh $DC_IP $PWD
38+
DC_IP=$(apps/files_external/tests/sso-setup/start-dc.sh)
39+
apps/files_external/tests/sso-setup/start-apache.sh $DC_IP $PWD
4040
echo "DC_IP=$DC_IP" >> $GITHUB_ENV
4141
- name: Set up Nextcloud
4242
run: |
43-
docker exec --user 33 apache ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
44-
docker exec --user 33 apache ./occ config:system:set trusted_domains 1 --value 'httpd.domain.test'
45-
46-
# setup user_saml
47-
docker exec --user 33 apache ./occ app:enable user_saml --force
48-
docker exec --user 33 apache ./occ config:app:set user_saml type --value 'environment-variable'
49-
docker exec --user 33 apache ./occ saml:config:create
50-
docker exec --user 33 apache ./occ saml:config:set 1 --general-uid_mapping=REMOTE_USER
51-
52-
# setup external storage
53-
docker exec --user 33 apache ./occ app:enable files_external --force
54-
docker exec --user 33 apache ./occ files_external:create smb smb smb::kerberosapache
55-
docker exec --user 33 apache ./occ files_external:config 1 host krb.domain.test
56-
docker exec --user 33 apache ./occ files_external:config 1 share netlogon
57-
docker exec --user 33 apache ./occ files_external:list
43+
apps/files_external/tests/sso-setup/setup-sso-nc.sh
5844
- name: Test SSO
5945
run: |
60-
mkdir /tmp/shared/cookies
61-
chmod 0777 /tmp/shared/cookies
62-
63-
echo "SAML login"
64-
./client-cmd.sh ${{ env.DC_IP }} curl -c /shared/cookies/jar -s --negotiate -u [email protected]: --delegation always http://httpd.domain.test/index.php/apps/user_saml/saml/login
65-
echo "Check we are logged in"
66-
CONTENT=$(./client-cmd.sh ${{ env.DC_IP }} curl -b /shared/cookies/jar -s --negotiate -u [email protected]: --delegation always http://httpd.domain.test/remote.php/webdav/smb/test.txt)
67-
CONTENT=$(echo $CONTENT | head -n 1 | tr -d '[:space:]')
68-
[[ $CONTENT == "testfile" ]]
46+
apps/files_external/tests/sso-setup/test-sso-smb.sh ${{ env.DC_IP }}
6947
- name: Show logs
7048
if: failure()
7149
run: |
72-
docker exec --user 33 apache ./occ log:file
7350
FILEPATH=$(docker exec --user 33 apache ./occ log:file | grep "Log file:" | cut -d' ' -f3)
51+
echo "$FILEPATH:"
7452
docker exec --user 33 apache cat $FILEPATH
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
$CONFIG = [
3+
"apps_paths" => [
4+
[
5+
"path" => "/var/www/html/apps",
6+
"url" => "/apps",
7+
"writable" => false,
8+
],
9+
[
10+
"path" => "/var/www/html/extra-apps",
11+
"url" => "/extra-apps",
12+
"writable" => true,
13+
],
14+
],
15+
];
File renamed without changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env sh
2+
set -e
3+
4+
SCRIPT_DIR="${0%/*}"
5+
6+
DC_IP=$("$SCRIPT_DIR"/start-dc.sh)
7+
"$SCRIPT_DIR"/start-apache.sh "$DC_IP" "$PWD"
8+
"$SCRIPT_DIR"/setup-sso-nc.sh
9+
"$SCRIPT_DIR"/test-sso-smb.sh "$DC_IP"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
docker exec --user 33 apache ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
5+
docker exec --user 33 apache ./occ config:system:set trusted_domains 1 --value 'httpd.domain.test'
6+
7+
# setup user_saml
8+
docker exec --user 33 apache ./occ app:enable user_saml --force
9+
docker exec --user 33 apache ./occ config:app:set user_saml type --value 'environment-variable'
10+
docker exec --user 33 apache ./occ saml:config:create
11+
docker exec --user 33 apache ./occ saml:config:set 1 --general-uid_mapping=REMOTE_USER
12+
13+
# create user
14+
docker exec -e OC_PASS=test --user 33 apache ./occ user:add '[email protected]' --password-from-env
15+
16+
# setup external storage
17+
docker exec --user 33 apache ./occ app:enable files_external --force
18+
docker exec --user 33 apache ./occ files_external:create smb smb smb::kerberosapache
19+
docker exec --user 33 apache ./occ files_external:config 1 host krb.domain.test
20+
docker exec --user 33 apache ./occ files_external:config 1 share netlogon
21+
docker exec --user 33 apache ./occ files_external:list
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
SCRIPT_DIR="${0%/*}"
5+
6+
docker rm -f apache 2>/dev/null > /dev/null
7+
8+
docker run -d --name apache -v $2:/var/www/html -v /var/www/html/data -v /var/www/html/config -v /var/www/html/extra-apps -v /tmp/shared:/shared --dns $1 --hostname httpd.domain.test icewind1991/samba-krb-test-apache 1>&2
9+
APACHE_IP=$(docker inspect apache --format '{{.NetworkSettings.IPAddress}}')
10+
docker exec apache chown 33 /var/www/html/config /var/www/html/data /var/www/html/extra-apps
11+
docker cp "$SCRIPT_DIR/apps.config.php" apache:/var/www/html/config/apps.config.php
12+
13+
# add the dns record for apache
14+
docker exec dc samba-tool dns add krb.domain.test domain.test httpd A $APACHE_IP -U administrator --password=passwOrd1 1>&2
15+
16+
echo $APACHE_IP

apps/files_external/tests/start-dc.sh renamed to apps/files_external/tests/sso-setup/start-dc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
set -e
23

34
function getContainerHealth {
45
docker inspect --format "{{.State.Health.Status}}" $1
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
DC_IP="$1"
5+
SCRIPT_DIR="${0%/*}"
6+
7+
echo -n "Checking that we can authenticate using kerberos: "
8+
LOGIN_CONTENT=$("$SCRIPT_DIR/client-cmd.sh" $DC_IP curl -i -s --negotiate -u [email protected]: --delegation always http://httpd.domain.test/index.php/apps/user_saml/saml/login?originalUrl=success)
9+
if [[ "$LOGIN_CONTENT" =~ "Location: success" ]]; then
10+
echo "✔️"
11+
else
12+
echo ""
13+
exit 1
14+
fi
15+
echo -n "Getting test file: "
16+
CONTENT=$("$SCRIPT_DIR/client-cmd.sh" $DC_IP curl -s --negotiate -u [email protected]: --delegation always http://httpd.domain.test/remote.php/webdav/smb/test.txt)
17+
CONTENT=$(echo $CONTENT | head -n 1 | tr -d '[:space:]')
18+
19+
if [[ $CONTENT == "testfile" ]]; then
20+
echo "✔️"
21+
else
22+
echo ""
23+
exit 1
24+
fi

apps/files_external/tests/start-apache.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)