SAML with Jumpcloud - Users and Admins
ThisThe documentfollowing describesexample theassumes necessary configuration work required to makeyour Knocknoc (optionally) use a JumpCloud SAML Identity Provider ("IdP") as an authentication mechanism for Knocknoc. It assumes that you already have administrative access to an operational JumpCloud tenant, and that Knocknocinstance is installed,located configured, and running onat https://access.example.comdemo.knoc.cloud.
KnocknocWherever supportsyou havingsee 2that, IdPs,please onesubstitute it for users,your andown oneinstance for admins. Please see the later section for Admins Click here for Admin setupURL.
First
Setting setup users, and then we can setup admins.
Generate SAML Service Provider keypair
SAML uses X.509 certificates and RSA key pairs to authenticateUp the IdP
(JumpCloud) and the Service Provider ("SP", ie Knocknoc) to each other, and make sure that nobody's doing any lying about the whole operation. JumpCloud will sort out the cert/key for its end, so we just need to issue a self-signed certificate for Knocknoc for a key that we generate.
Create a self-signed certificate and RSA private key for Knocknoc, by running the following command:cd /opt/knocknoc/etc/ openssl req -new -x509 -days 3650 -nodes -subj /CN=Knocknoc/ -out user-idp.crt -keyout user-idp.keyFor your admin SAML, you need a seperate keycd /opt/knocknoc/etc/ openssl req -new -x509 -days 3650 -nodes -subj /CN=Knocknoc/ -out admin-idp.crt -keyout admin-idp.keySet the permissions to be correct for the knocknoc user to access the key:
chown knocknoc:knocknoc *.key
chown knocknoc:knocknoc *.crt
Download a copy of the certificate (justthe certificate) to your local workstation, as you'll need to upload it to JumpCloud in the next phase of configuration.
JumpCloudCreating ConfigurationAn for User SAML
Application
-
Login to your JumpCloud tenant as an administrator.
-
From the left-hand menu, select the "SSO" option (under "User Authentication").
-
Click the "Get Started" button.
-
Click Select on Custom Application in the bottom right of the Featured Applications pane and click Next.
-
Click
Next ChooseManage Single Sign-On, and then Configure SSO with SAMLthenand click Next.-
Enter a Name for your
application, like Demo Knocknoc, andapplication underAdvancedDisplaySettings,Labeldrop(e.g Knocknoc) -
Scroll down and
enterclick Advanced Settings -
Enter a
URL that soundssemi-uniqueenough,URL for the SSO IdPURL:URLlike(e.gdemoknocknocpapercompany-knocknoc) -
ThenClickchooseSaveConfigure Application and we are onto the hard bitApplication. - Click Configure Application.
-
In the "Single Sign-OnConfiguration"Configurationsection,Settings;and- Set the
public URL of your Knocknoc service.- IdP Entity
ID:ID to "Knocknoc" Note: this is agooddefault,butifthere'syoumoreintendthantoonerunKnocknocmultiplein the JumpCloud tenant,instances, choose somethingelse that sounds good.unique. - Set the SP Entity
ID:IDto https://
access.example.com/demo.knoc.cloud/api/saml/metadata - Set the ACS URL to https://demo.knoc.cloud/api/saml/acs
- Generate a new certificate and key, this can be done on a Linux host using the below command.
openssl req -new -x509 -days 3650 -nodes -subj /CN=Knocknoc/ -out user-demo-knoc-cloud.crt -keyout user-demo-knoc-cloud.key
ACS URL:https://access.example.com/api/saml/acsSP Certificate:Click 'Upload SP Certificate',and choose the certificateyou(.crt)generatedjustin the previous section. If all goes well, you'll get a little pop-up saying "successfully read SP certificate".generated.SAMLSubjectSetNameID:username- SAMLSubject NameID
Format:to"username"
- Set the SAMLSubject NameID Format to "urn:oasis:names:tc:SAML:2.0:nameid-format:
persistentpersistent" - Leave the Signature
Algorithm:Algorithmas RSA-SHA256
(should already be set to that) - Check Sign
Assertion:tick this boxAssertion - Leave Default
RelayState:leaveRelayState blank - Enter the Login
URL:URLas https://
access.example.com/demo.knoc.cloud/api/login/saml - Check Declare Redirect
Endpoint:tick this boxEndpoint - Set IDP
URL:URL tohttps://sso.jumpcloud.com/saml2/knocknoc
(canNote:bethis is a default, if you intend to run multiple instances, choose somethingelseuniqueif there's more than one Knocknocas inthestepJumpCloud tenant)11.1. - Under User
AttributeAttributesMapping:click Add Attribute.TellSetJumpCloud to tell Knocknoc the real name of the user:
- Service Provider Attribute
Name:Name
to "realName"realName - Set JumpCloud Attribute
Name:Name
to "fullname"fullname
- IdP Entity
start filling out form items. Remember to replacehttps://access.example.comwith - Set the
- Under Constant
Attributes:Attributes click Add Attribute.TellSetJumpCloud to tell Knocknoc how long to keep sessions open:
- Service Provider Attribute
Name:Name
to "sessionDuration"sessionDuration Value:Set Value to however many minutes SAML users' sessions should last (e.g 480 for 8 hours)
TellJumpCloudChange memberOf topass the list ofgroupsto Knocknoc:
Include group attribute:tick this boxUnlabelledClicktext box:groups(the boilerplate saysmemberOf, which is naughty)
After that fairly massive effort, you can now click "save". Phew!
If all goes well, you'll get a pleasant "SSO application created" pop-up.
Finally, goGo back into the newly-created SSO application,application.
Knocknoc
Group and User Configuration
Upload the IdP metadata you downloaded in the previous sectionLogin tothe Knocknoc server in a location that Knocknoc can access, You might want to move the keys you made earlier to above location:Upload the cert and key you created
If all has gone according to plan, the Knocknoc login page should now have a new "SSO Login" link on it. This is the magic button to login with SAML. However, at present it won't work for anyone because they don't have the necessary JumpCloud magicks to work. That'll be sorted out in the next section.
JumpCloud Group / User Configuration
Back into the JumpCloud admin panel now. First off, we'll create some groups for our Knocknoc-capable users to be a part of.
- panel.
-
Select "User Groups" from the left-hand menu
(under"User Management"). Create zero or more groups to hold Knocknoc-capable JumpCloud users. For the most part, there's nothing special about them, and you canin theoryuse existing JC groups. However, the caveats are:The name of the group in JumpCloud must matchexactly(capitalisation, spaces and all) the name of the corresponding group in Knocknoc, if you want that group to grant access to the ACLs of the corresponding Knocknoc group.The same "strict match" rule applies to the JC group name for theSAMLAdminGroupyou configured.The groupmustbe bound to the JumpCloud application you configured previously (it must be ticked in the list under the "Applications" tab of the group) otherwise the group won't be sent to Knocknoc.
Finally, assign users to the groups you've bound to the Knocknoc application -- probably by going to the "Users" tab of the group and ticking away like a dog running through the bush.
JumpCloud Configuration for Admin SAML
Login to your JumpCloud tenant as an administrator. Note this can be a seperate Jumpcloud to yourUsertenant.From the left-hand menu, select the "SSO" option (under "User Authentication").Management.-
Click the
"GetGreenStarted" button or Add Application if you already have some. Click Select on Custom Application in the bottom right of the Featured Applications paneClick NextChoose Manage Single Sign-On, and then Configure SSO with SAML then Next.Enter a Name for your application, like Demo Knocknoc, and under Advanced Settings, drop down and enter a URL that sounds unique enough, for the SSO IdP URL: like demoknocknocThen choose Configure Application and we are onto the hard bitIn the "Single Sign-On Configuration" section, and start filling out form items. Remember+ toreplacehttps://access.example.comwith the public URL of your Knocknoc service.IdP Entity ID: "Knocknoc" is a good default, but if there's more than one Knocknoc in the JumpCloud tenant, choose something else that sounds good.SP Entity ID:https://access.example.com/api/admin/saml/metadataACS URL:https://access.example.com/api/admin/saml/acsSP Certificate: Click 'Upload SP Certificate', and choose the certificate you generated foradminin the previous section. If all goes well, you'll get a little pop-up saying "successfully read SP certificate".SAMLSubject NameID:usernameSAMLSubject NameID Format:urn:oasis:names:tc:SAML:2.0:nameid-format:persistentSignature Algorithm:RSA-SHA256(should already be set to that)Sign Assertion:tick this boxDefault RelayState:leave blankLogin URL:https://access.example.com/api/admin/login/samlDeclare Redirect Endpoint:tick this boxIDP URL:https://sso.jumpcloud.com/saml2/knocknocadmin(can be something else if there's more than one Knocknoc in the JumpCloud tenant)User Attribute Mapping:Tell JumpCloud to tell Knocknoc the real name of the user:
Service Provider Attribute Name:realNameJumpCloud Attribute Name:fullname
Constant Attributes:Tell JumpCloud to tell Knocknoc how long to keep sessions open:
Service Provider Attribute Name:sessionDurationValue:however many minutes SAML users' sessions should last
Group Attributes:Tell JumpCloud to pass the list of groups to Knocknoc:
Include group attribute:tick this boxUnlabelled text box:groups(the boilerplate saysmemberOf, which is naughty)
After that fairly massive effort, you can now click "save".Phew!If all goes well, you'll get a pleasant "SSO application created" pop-up.Finally, go back into the newly-created SSO application, scroll down, expand the "SSO" heading, and click "Export Metadata". Save this file locally somewhere, we'll use it shortly. This is an XML file full of the details that Knocknoc needs to use the IdP.
Knocknoc Configuration for Admins
Upload the IdP metadata you downloaded in the previous section to the Knocknoc serverUpload the admin certs
Your knocknoc admin section is at https://access.example.com/admin, or whatever you called your site. If all has gone according to plan, the Knocknoc login page should now havecreate a new "SSO Login" link on it. This is the magic button to login with SAML. However, at present it won't work for anyone because they don't have the necessary JumpCloud magicks to work. That'll be sorted out in the next section.
JumpCloud Group / User Configuration
Back into the JumpCloud admin panel now. First off, we'll create some groups for our Knocknoc-capable users to be a part of. Admins can't be part of groups, and hence can't have ACLs assigned to them. I suppose you could make your /admin URL be only accessible after a user auths to knocknoc, which we will cover later.
Select "User Groups" from the left-hand menu (under "User Management").Create zero or more groups to hold Knocknoc-capable JumpCloud admins. For the most part, there's nothing special about them, and you canin theoryuse existing JC groups. However, the caveats are:The name of the group in JumpCloud must matchexactly(capitalisation, spaces and all) the name of the corresponding group in Knocknoc, if you want that group to grant access to the ACLs of the corresponding Knocknocgroup.- Under
TheName enter the group name (e.g ConfluenceUsers). Note: The name must match group name in Knocknoc to allow ACL assignment to beboundautomated. - Click Users and Check the
JumpCloudappropriateapplicationusers. - Click Applications and check the newly created Application (e.g Knocknoc)
- Click Save.
to
Knocknoc SAML Config
- Login In the Knocknoc admin interface.
- Click on Settings on the left.
- Under Public URL enter your knocknoc url. Note: do not add a / at the end of the URL.
- For the SAMLMetaDataFile, upload the xml file you
configureddownloadedpreviouslyfrom JumpCloud. - For the SAMLCertFile, upload the certificate (
it.crt)mustfilebe tickedcreated in thelistCreatingunderan Application section. - For the
"Applications"SAMLKeyFile,tabupload the key (.key) file created in the Creating an Application section. - For the SAMLMetadataUrl, paste the Metadata URL copied in Step 21 of the
group)CreatingotherwiseantheApplicationgroup won't be sent to Knocknoc. - Click Save.
Finally, assign users to the groups you've bound to the Knocknoc application -- probably by going to the "Users" tab of the group and ticking away like a dog running through the bush.
Final Testing
Assuming you granted your own user permission to one or more Knocknoc groups in JumpCloud, you should now be able to login to Knocknoc using SSO.
To
- Browse to
yourhttps://demo.knoc.cloud - There
servershouldinnowabebrowser and click on thean "SSO Login" button. - Click
may be prompted to login to JumpCloud (your user account, not an admin account), butthis, if youloggedareintonotJumpCloudalreadyrecently,authenticatedyoushouldjust be dropped into a logged-in Knocknoc session, either as a Knocknoc admin (ifto yourJC user is in theSAMLAdminGroupgroup) or otherwise as an ordinary user. In either event,IdP you shouldhavenowallbe directed to theACLsIdPassociatedloginwithpage.theNote: If you are already authenticated you'll simply be redirected to an authenticated Knocknocgroupssession. - If
aACLsmemberhaveofalreadyinbeenJC.added you should also see these now say Granted.
If this all works, congratulations! You've successfully run the SAML gauntlet.