You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+84-54Lines changed: 84 additions & 54 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# SAML local development environment guide
1
+
# SAML & Shibboleth dev setup guide
2
2
3
3
This guide explains how to install and configure:
4
4
@@ -622,13 +622,13 @@ Create (or copy from this repo):
622
622
623
623
TODO /etc/apache2/sites-available/spmellon.conf
624
624
625
-
TODO /var/www/pyinfo.py
625
+
TODO /var/www/sp/sp.py
626
626
627
-
TODO /var/www/spmellon/index.html
628
-
629
-
TODO /var/www/spmellon/secret/index.html
627
+
> [!NOTE]
628
+
> Since both SP and IdP run on the same virtual machine, for convenience, I directly use the path to idp-metadata.xml in the SP config. In production, this XML file would, of course, be copied to the other machine.
630
629
631
-
(Since both SP and IdP run on the same virtual machine, for convenience, I directly use the path to idp-metadata.xml. In production, this XML file would, of course, be copied to the other machine.)
630
+
> [!NOTE]
631
+
> This config uses mod_wsgi and a small Python website, but that's just an example. Python just prints the request variables and does not handle any auth. PHP with `phpinfo();`, or just static `secret/index.html`, would work just as well.
632
632
633
633
Edit both `/opt/idp4/conf/metadata-providers.xml` and `/opt/idp5/conf/metadata-providers.xml` and add the following at the bottom (just above the last line `</MetadataProvider>`):
634
634
@@ -661,14 +661,6 @@ Create (or copy from this repo):
661
661
662
662
TODO /etc/apache2/sites-available/spmellon2.conf
663
663
664
-
TODO /var/www/pyinfo.py
665
-
666
-
TODO /var/www/spmellon2/index.html
667
-
668
-
TODO /var/www/spmellon2/secret/index.html
669
-
670
-
(Since both SP and IdP run on the same virtual machine, for convenience, I directly use the path to idp-metadata.xml. In production, this XML file would, of course, be copied to the other machine.)
671
-
672
664
Edit both `/opt/idp4/conf/metadata-providers.xml` and `/opt/idp5/conf/metadata-providers.xml` and add the following at the bottom (just above the last line `</MetadataProvider>`):
673
665
674
666
```xml
@@ -707,11 +699,7 @@ Create (or copy from this repo):
707
699
708
700
TODO /etc/apache2/sites-available/spshib.conf
709
701
710
-
TODO /var/www/pyinfo.py
711
-
712
-
TODO /var/www/spshib/index.html
713
-
714
-
TODO /var/www/spshib/secret/index.html
702
+
TODO /var/www/sp/sp.py
715
703
716
704
Edit `/etc/apache2/conf-available/shib.conf` as follows: change `ShibCompatValidUser Off` to `ShibCompatValidUser On`.
717
705
@@ -794,6 +782,37 @@ Edit both `/opt/idp4/conf/idp.properties` and `/opt/idp5/conf/idp.properties` as
Edit `/opt/idp4/metadata/idp-metadata.xml` as follows: uncomment the 4 lines which start with `<SingleLogoutService`.
793
+
794
+
Edit `/opt/idp5/metadata/idp-metadata.xml` as follows:
795
+
796
+
- Delete the line `<md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://idp.unibatest.internal/idp/profile/SAML2/SOAP/ArtifactResolution" />`, if present. (I think it is a bug in IdP 5.1.3, because `SAML2/SOAP/ArtifactResolution` should be `<ArtifactResolutionService>`, not `<SingleLogoutService>`.)
797
+
- Add these lines between the last `</md:KeyDescriptor>` and the first `<md:SingleSignOnService...>` (mod_shib cares about element order):
I have no idea how anyone is supposed to discover this. The official docs did not even mention editing IdP metadata. At least for IdP 4 the installer wrote that comment. In IdP 5 there is not even that.
806
+
807
+
Restart the services again. At this point you should be able to log out. If you are logged in to multiple SPs, the IdP will show a "Logout Locally" and "Logout Globally" button.
808
+
809
+
It has a few unexpected quirks:
810
+
811
+
- The IdP does not redirect the user back to the initiating SP. It shows a logout message and stays there. A SAML logout response is sent to the SP's logout service handler inside a hidden iframe.
812
+
- If you press "Logout Locally" and later try to logout from some other service which did not log out, it will fail with an error because the IdP session does not exist anymore.
813
+
814
+
815
+
797
816
## Andrvotr development
798
817
799
818
This section is specific to working on the [Andrvotr](https://github.com/fmfi-svt/andrvotr) plugin.
Follow the procedure in the Andrvotr README to create a GPG key.
830
+
Follow [the procedure in the Andrvotr README](https://github.com/fmfi-svt/andrvotr/blob/idp5/README.md#building-from-source) to create a GPG key.
812
831
813
832
Run this so that `plugin.sh` is able read the plugin file.
814
833
@@ -836,11 +855,11 @@ time PATH=/usr/lib/jvm/java-11-amazon-corretto/bin:$PATH GNUPGHOME=../gpgdir MAV
836
855
837
856
The long command builds the plugin, installs it, restarts the IdP, and waits for it to start.
838
857
839
-
Always remember to build from the correct branch, and to run `git clean -fdX` when you switch.
858
+
Always remember to build from the correct branch, and to run `git clean -fdX` when you switch, because Maven gets confused by stale build outputs.
840
859
841
-
Edit both `/opt/idp4/conf/attribute-resolver.xml` and `/opt/idp5/conf/attribute-resolver.xml` as described in the Andrvotr README.
860
+
Edit both `/opt/idp4/conf/attribute-resolver.xml` and `/opt/idp5/conf/attribute-resolver.xml` as described in the [Andrvotr README](https://github.com/fmfi-svt/andrvotr/blob/idp5/README.md#building-from-source).
842
861
843
-
Edit both `/opt/idp4/conf/attribute-filter.xml` and `/opt/idp5/conf/attribute-filter.xml` as described in the Andrvotr README.
862
+
Edit both `/opt/idp4/conf/attribute-filter.xml` and `/opt/idp5/conf/attribute-filter.xml` as described in the [Andrvotr README](https://github.com/fmfi-svt/andrvotr/blob/idp5/README.md#building-from-source).
844
863
845
864
Edit both `/opt/idp4/conf/idp.properties` and `/opt/idp5/conf/idp.properties` and append this:
846
865
@@ -864,54 +883,63 @@ Edit `/etc/shibboleth/attribute-map.xml` and add this line just before `</Attrib
(Editing `/etc/hosts` wasn't needed until now, for normal SAML flows. But Andrvotr requires it.)
886
895
896
+
Run:
887
897
898
+
```shell
899
+
curl -LsSf https://astral.sh/uv/install.sh | sh
900
+
```
888
901
902
+
Sign in to spmellon.unibatest.internal in a browser. Find the value of `'MELLON_tag:fmfi-svt.github.io,2024:andrvotr-authority-token'` in the WSGI environment. Run:
It should print the "spshib SECRET, logged IN" page.
891
911
912
+
Now try with `'https://spmellon2.unibatest.internal/secret/'` instead of `'https://spshib.unibatest.internal/secret/'`. It should print an error because spmellon to spmellon2 is not in andrvotr.allowedConnections. The message should contain `@AllowedConnectionCheckFailure`.
892
913
893
-
## Unsorted
914
+
Sign in to spshib.unibatest.internal in a browser. Find the value of `'ANDRVOTR_AUTHORITY_TOKEN'` in the WSGI environment. Run:
When needed, you can enable maximum logging in `idp.properties` with this:
908
927
909
-
```shell
910
-
curl -LsSf https://astral.sh/uv/install.sh | sh
928
+
```ini
929
+
idp.loglevel.idp=TRACE
930
+
idp.loglevel.ldap=TRACE
931
+
idp.loglevel.messages=TRACE
932
+
idp.loglevel.encryption=TRACE
933
+
idp.loglevel.opensaml=TRACE
934
+
idp.loglevel.shared=TRACE
935
+
idp.loglevel.props=TRACE
936
+
idp.loglevel.httpclient=TRACE
937
+
idp.loglevel.spring=TRACE
938
+
idp.loglevel.container=TRACE
939
+
idp.loglevel.xmlsec=TRACE
940
+
idp.loglevel.root=TRACE
911
941
```
912
942
913
-
TODO: maximum logging in idp.properties
914
-
915
943
916
944
917
945
## Miscellaneous SAML debugging commands
@@ -966,13 +994,15 @@ For example, they appear as opaque NameID values, as entries in `localStorage` i
966
994
If you have the private keys of the IdP, you can decrypt them like this:
967
995
968
996
```shell
969
-
sudo -u idp /opt/idp5/bin/runclass.sh -Didp.home=/opt/idp5 net.shibboleth.idp.cli.DataSealerCLI --verbose net/shibboleth/idp/conf/sealer.xml dec "$str"
997
+
sudo -u idp JAVA_OPTS=-Didp.home=/opt/idp5 /opt/idp5/bin/sealer.sh --verbose net/shibboleth/idp/conf/sealer.xml dec "$str"
970
998
```
971
999
972
1000
If decrypting fails (e.g., because the timestamp inside the encrypted value has expired), it will display a misleading error: "Unable to access DataSealer from Spring context". You need the `--verbose` option to show the real error.
973
1001
974
-
`bin/sealer.sh`only works if it's installed in the default path `/opt/shibboleth-idp`. That's why we must use `runclass.sh ... DataSealerCLI` as a workaround.
1002
+
IdP 4 `sealer.sh`does not know `JAVA_OPTS`, so if it's installed in a custom path other than `/opt/shibboleth-idp`, you must run:
975
1003
976
-
TODO: `JAVA_OPTS=-Didp.home=/opt/idp5` should work. But only on IdP 5. :(
1004
+
```shell
1005
+
sudo -u idp /opt/idp4/bin/runclass.sh -Didp.home=/opt/idp4 net.shibboleth.idp.cli.DataSealerCLI --verbose net/shibboleth/idp/conf/sealer.xml dec "$str"
1006
+
```
977
1007
978
1008
The value `net/shibboleth/idp/conf/sealer.xml` is undocumented; it was discovered via grepping. It won’t work without it.
0 commit comments