{"id":122,"date":"2023-12-14T21:19:39","date_gmt":"2023-12-15T04:19:39","guid":{"rendered":"https:\/\/eisaichen.com\/?p=122"},"modified":"2024-05-01T22:48:36","modified_gmt":"2024-05-02T05:48:36","slug":"how-to-integrate-tailscale-with-self-hosted-zitadal","status":"publish","type":"post","link":"https:\/\/eisaichen.com\/?p=122","title":{"rendered":"How to integrate Tailscale with self-hosted Zitadal"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">By doing this, You can use the official Tailscale VPN infrastructure and clients without creating an account on&nbsp;<a href=\"https:\/\/tailscale.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">tailscale.com<\/a><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><br>First, let&#8217;s assume some basic information<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You have a web server running at:<br><kbd>example.com<\/kbd><br>Your Zitadal running at:<br><kbd>login.example.com<\/kbd><br>Your admin account on Zitadal:<br><kbd>admin@example.com<\/kbd><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><br>Then, Create webfinger file point to your Zitadal server, this part may be slightly tricky.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1\uff09Go to the root directory of your web server and create the following folders<br>[your_wwwroot]\\.well-known\\webfinger<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2) Create &#8220;webfinger.jsonjrd&#8221; under &#8220;webfinger&#8221; folder<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3) Edit &#8220;webfinger.jsonjrd&#8221;, assuming you want to add an account for yourself and an account for your friends.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"subject\": \"acct:admin@example.com\",\n  \"links\": &#91;\n    {\n      \"rel\": \"http:\/\/openid.net\/specs\/connect\/1.0\/issuer\",\n      \"href\": \"https:\/\/login.example.com\"\n    }\n  ],\n  \"subject\": \"acct:friend@example.com\",\n  \"links\": &#91;\n    {\n      \"rel\": \"http:\/\/openid.net\/specs\/connect\/1.0\/issuer\",\n      \"href\": \"https:\/\/login.example.com\"\n    }\n  ]\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">(You have to put every account that will use VPN in this file)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4) Set the default document for this folder to &#8220;webfinger.jsonjrd&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5) <strong>IMPORTANT<\/strong> Set MIME for this folder.<br>Define <kbd>.jsonjrd<\/kbd> as <kbd>application\/jrd+json<\/kbd><br>If you don&#8217;t do this, Tailscale will reject your webfinger file.<br>(&#8220;application\/json&#8221; won&#8217;t work)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can easily find guides on Google for steps 4 and 5.<br>Here is my web.config file for IIS<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;configuration&gt;\n    &lt;system.webServer&gt;\n        &lt;defaultDocument enabled=\"true\"&gt;\n            &lt;files&gt;\n                &lt;remove value=\"index.html\" \/&gt;\n                &lt;remove value=\"index.php\" \/&gt;\n                &lt;add value=\"webfinger.jsonjrd\" \/&gt;\n            &lt;\/files&gt;\n        &lt;\/defaultDocument&gt;\n        &lt;staticContent&gt;\n            &lt;mimeMap fileExtension=\".jsonjrd\" mimeType=\"application\/jrd+json\" \/&gt;\n        &lt;\/staticContent&gt;\n    &lt;\/system.webServer&gt;\n&lt;\/configuration&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">6) Verify your webfinger with Tailscale<br><a href=\"https:\/\/login.tailscale.com\/start\/oidc\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/login.tailscale.com\/start\/oidc<\/a><br>Use your Zitadal account for the test, in this post is admin@example.com<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you didn&#8217;t encounter any error after clicking &#8220;Get OIDC Issuer&#8221; and Tailscale is asking for a client ID, then you are good to go.<\/li>\n\n\n\n<li>If you got 404, then probably check steps 1, 2, 3, 4<\/li>\n\n\n\n<li>If you got 406, then is the MIME problem, check step 5<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><br>Last, create the Tailscale application in Zitadal. This is the easy part.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1) Login to your Zitadal server with admin account<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2) Create a new project &#8220;TailScale&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3) Create a new app &#8220;TailScale&#8221;, with the following settings:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"460\" src=\"https:\/\/eisaichen.com\/wp-content\/uploads\/2023\/12\/32h6xy6ss86c1-1024x460.jpg\" alt=\"\" class=\"wp-image-124\" srcset=\"https:\/\/eisaichen.com\/wp-content\/uploads\/2023\/12\/32h6xy6ss86c1-1024x460.jpg 1024w, https:\/\/eisaichen.com\/wp-content\/uploads\/2023\/12\/32h6xy6ss86c1-300x135.jpg 300w, https:\/\/eisaichen.com\/wp-content\/uploads\/2023\/12\/32h6xy6ss86c1-768x345.jpg 768w, https:\/\/eisaichen.com\/wp-content\/uploads\/2023\/12\/32h6xy6ss86c1-1536x690.jpg 1536w, https:\/\/eisaichen.com\/wp-content\/uploads\/2023\/12\/32h6xy6ss86c1.jpg 1851w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>IMPORTANT<\/strong> Authentication method has to be set to &#8220;basic&#8221;<br>Redirect URL:<br>https:\/\/login.tailscale.com\/a\/oauth_responsecancel<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4) Copy your clientID and secret and go back to Tailscale<br><a href=\"https:\/\/login.tailscale.com\/start\/oidc\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/login.tailscale.com\/start\/oidc<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5) Put in the information accordingly, and check consent, login, select_account.<br><strong>WARNING<\/strong> Before clicking &#8220;next&#8221;, make sure your zitadal running on the URL you desired, you will have to contact the Tailscale support team to change your IdP once set.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6) Tailscale should transfer you to your Zitadal server for login, after login, you will back to Tailscale and your network is already created. ready to set up your first device.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><br>Congrats, now you are ready to go.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In the future, when you log in to Tailscale, just use your Zitadal account and Tailscale will automatically transfer you to your Zitadal server for login.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By doing this, You can use the official Tailscale VPN infrastructure and clients without creating an account on&nbsp;tailscale.com First, let&#8217;s assume some basic information You have a web server running at:example.comYour Zitadal running at:login.example.comYour admin account on Zitadal:admin@example.com Then, Create webfinger file point to your Zitadal server, this part may be slightly tricky. 1\uff09Go to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":130,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-122","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/eisaichen.com\/index.php?rest_route=\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eisaichen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eisaichen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eisaichen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eisaichen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=122"}],"version-history":[{"count":4,"href":"https:\/\/eisaichen.com\/index.php?rest_route=\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":129,"href":"https:\/\/eisaichen.com\/index.php?rest_route=\/wp\/v2\/posts\/122\/revisions\/129"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eisaichen.com\/index.php?rest_route=\/wp\/v2\/media\/130"}],"wp:attachment":[{"href":"https:\/\/eisaichen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eisaichen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eisaichen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}