smb-kerberos.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. name: Samba Kerberos SSO
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - stable*
  7. paths:
  8. - 'apps/files_external/**'
  9. - '.github/workflows/smb-kerberos.yml'
  10. pull_request:
  11. paths:
  12. - 'apps/files_external/**'
  13. - '.github/workflows/smb-kerberos.yml'
  14. jobs:
  15. smb-kerberos-tests:
  16. runs-on: ubuntu-latest
  17. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  18. name: smb-kerberos-sso
  19. steps:
  20. - name: Checkout server
  21. uses: actions/checkout@v3
  22. with:
  23. submodules: true
  24. - name: Pull images
  25. run: |
  26. docker pull icewind1991/samba-krb-test-dc
  27. docker pull icewind1991/samba-krb-test-apache
  28. docker pull icewind1991/samba-krb-test-client
  29. - name: Setup AD-DC
  30. run: |
  31. cp apps/files_external/tests/*.sh .
  32. mkdir data
  33. sudo chown -R 33 data apps config
  34. DC_IP=$(./start-dc.sh)
  35. ./start-apache.sh $DC_IP $PWD
  36. echo "DC_IP=$DC_IP" >> $GITHUB_ENV
  37. - name: Set up Nextcloud
  38. run: |
  39. 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
  40. docker exec --user 33 apache ./occ config:system:set trusted_domains 1 --value 'httpd.domain.test'
  41. # setup user_saml
  42. docker exec --user 33 apache ./occ app:enable user_saml --force
  43. docker exec --user 33 apache ./occ config:app:set user_saml type --value 'environment-variable'
  44. docker exec --user 33 apache ./occ saml:config:create
  45. docker exec --user 33 apache ./occ saml:config:set 1 --general-uid_mapping=REMOTE_USER
  46. # setup external storage
  47. docker exec --user 33 apache ./occ app:enable files_external --force
  48. docker exec --user 33 apache ./occ files_external:create smb smb smb::kerberosapache
  49. docker exec --user 33 apache ./occ files_external:config 1 host krb.domain.test
  50. docker exec --user 33 apache ./occ files_external:config 1 share netlogon
  51. docker exec --user 33 apache ./occ files_external:list
  52. - name: Test SSO
  53. run: |
  54. mkdir /tmp/shared/cookies
  55. chmod 0777 /tmp/shared/cookies
  56. echo "SAML login"
  57. ./client-cmd.sh ${{ env.DC_IP }} curl -c /shared/cookies/jar -s --negotiate -u testuser@DOMAIN.TEST: --delegation always http://httpd.domain.test/index.php/apps/user_saml/saml/login
  58. echo "Check we are logged in"
  59. CONTENT=$(./client-cmd.sh ${{ env.DC_IP }} curl -b /shared/cookies/jar -s --negotiate -u testuser@DOMAIN.TEST: --delegation always http://httpd.domain.test/remote.php/webdav/smb/test.txt)
  60. CONTENT=$(echo $CONTENT | head -n 1 | tr -d '[:space:]')
  61. [[ $CONTENT == "testfile" ]]
  62. - name: Show logs
  63. if: failure()
  64. run: |
  65. docker exec --user 33 apache ./occ log:file
  66. FILEPATH=$(docker exec --user 33 apache ./occ log:file | grep "Log file:" | cut -d' ' -f3)
  67. docker exec --user 33 apache cat $FILEPATH