oauth.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta name="viewport" content="width=device-width,initial-scale=1">
  7. <meta http-equiv="x-ua-compatible" content="ie=edge">
  8. <meta name="lang:clipboard.copy" content="Copy to clipboard">
  9. <meta name="lang:clipboard.copied" content="Copied to clipboard">
  10. <meta name="lang:search.language" content="en">
  11. <meta name="lang:search.pipeline.stopwords" content="True">
  12. <meta name="lang:search.pipeline.trimmer" content="True">
  13. <meta name="lang:search.result.none" content="No matching documents">
  14. <meta name="lang:search.result.one" content="1 matching document">
  15. <meta name="lang:search.result.other" content="# matching documents">
  16. <meta name="lang:search.tokenizer" content="[\s\-]+">
  17. <link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
  18. <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
  19. <style>
  20. body,
  21. input {
  22. font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
  23. }
  24. code,
  25. kbd,
  26. pre {
  27. font-family: "Roboto Mono", "Courier New", Courier, monospace
  28. }
  29. </style>
  30. <link rel="stylesheet" href="_static/stylesheets/application.css"/>
  31. <link rel="stylesheet" href="_static/stylesheets/application-palette.css"/>
  32. <link rel="stylesheet" href="_static/stylesheets/application-fixes.css"/>
  33. <link rel="stylesheet" href="_static/fonts/material-icons.css"/>
  34. <meta name="theme-color" content="#3f51b5">
  35. <script src="_static/javascripts/modernizr.js"></script>
  36. <title>Integrating OAuth &#8212; Netmaker 0.10.0 documentation</title>
  37. <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
  38. <link rel="stylesheet" type="text/css" href="_static/material.css" />
  39. <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
  40. <script src="_static/jquery.js"></script>
  41. <script src="_static/underscore.js"></script>
  42. <script src="_static/doctools.js"></script>
  43. <link rel="author" title="About these documents" href="about.html" />
  44. <link rel="index" title="Index" href="genindex.html" />
  45. <link rel="search" title="Search" href="search.html" />
  46. <link rel="next" title="External Guides" href="usage.html" />
  47. <link rel="prev" title="Advanced Client Installation" href="client-installation.html" />
  48. </head>
  49. <body dir=ltr
  50. data-md-color-primary=indigo data-md-color-accent=light-blue>
  51. <svg class="md-svg">
  52. <defs data-children-count="0">
  53. <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
  54. </defs>
  55. </svg>
  56. <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
  57. <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
  58. <label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
  59. <a href="#oauth" tabindex="1" class="md-skip"> Skip to content </a>
  60. <header class="md-header" data-md-component="header">
  61. <nav class="md-header-nav md-grid">
  62. <div class="md-flex navheader">
  63. <div class="md-flex__cell md-flex__cell--shrink">
  64. <a href="index.html" title="Netmaker 0.10.0 documentation"
  65. class="md-header-nav__button md-logo">
  66. <i class="md-icon">&#xe869</i>
  67. </a>
  68. </div>
  69. <div class="md-flex__cell md-flex__cell--shrink">
  70. <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
  71. </div>
  72. <div class="md-flex__cell md-flex__cell--stretch">
  73. <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
  74. <span class="md-header-nav__topic">Netmaker Docs</span>
  75. <span class="md-header-nav__topic"> Integrating OAuth </span>
  76. </div>
  77. </div>
  78. <div class="md-flex__cell md-flex__cell--shrink">
  79. <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
  80. <div class="md-search" data-md-component="search" role="dialog">
  81. <label class="md-search__overlay" for="__search"></label>
  82. <div class="md-search__inner" role="search">
  83. <form class="md-search__form" action="search.html" method="get" name="search">
  84. <input type="text" class="md-search__input" name="q" placeholder="Search"
  85. autocapitalize="off" autocomplete="off" spellcheck="false"
  86. data-md-component="query" data-md-state="active">
  87. <label class="md-icon md-search__icon" for="__search"></label>
  88. <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
  89. &#xE5CD;
  90. </button>
  91. </form>
  92. <div class="md-search__output">
  93. <div class="md-search__scrollwrap" data-md-scrollfix>
  94. <div class="md-search-result" data-md-component="result">
  95. <div class="md-search-result__meta">
  96. Type to start searching
  97. </div>
  98. <ol class="md-search-result__list"></ol>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="md-flex__cell md-flex__cell--shrink">
  106. <div class="md-header-nav__source">
  107. <a href="https://github.com/gravitl/netmaker/" title="Go to repository" class="md-source" data-md-source="github">
  108. <div class="md-source__icon">
  109. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
  110. <use xlink:href="#__github" width="24" height="24"></use>
  111. </svg>
  112. </div>
  113. <div class="md-source__repository">
  114. Netmaker
  115. </div>
  116. </a>
  117. </div>
  118. </div>
  119. <script src="_static/javascripts/version_dropdown.js"></script>
  120. <script>
  121. var json_loc = ""versions.json"",
  122. target_loc = "../",
  123. text = "Versions";
  124. $( document ).ready( add_version_dropdown(json_loc, target_loc, text));
  125. </script>
  126. </div>
  127. </nav>
  128. </header>
  129. <div class="md-container">
  130. <nav class="md-tabs" data-md-component="tabs">
  131. <div class="md-tabs__inner md-grid">
  132. <ul class="md-tabs__list">
  133. <li class="md-tabs__item"><a href="index.html" class="md-tabs__link">Netmaker 0.10.0 documentation</a></li>
  134. </ul>
  135. </div>
  136. </nav>
  137. <main class="md-main">
  138. <div class="md-main__inner md-grid" data-md-component="container">
  139. <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
  140. <div class="md-sidebar__scrollwrap">
  141. <div class="md-sidebar__inner">
  142. <nav class="md-nav md-nav--primary" data-md-level="0">
  143. <label class="md-nav__title md-nav__title--site" for="__drawer">
  144. <a href="index.html" title="Netmaker 0.10.0 documentation" class="md-nav__button md-logo">
  145. <i class="md-icon">&#xe869</i>
  146. </a>
  147. <a href="index.html"
  148. title="Netmaker 0.10.0 documentation">Netmaker Docs</a>
  149. </label>
  150. <div class="md-nav__source">
  151. <a href="https://github.com/gravitl/netmaker/" title="Go to repository" class="md-source" data-md-source="github">
  152. <div class="md-source__icon">
  153. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
  154. <use xlink:href="#__github" width="24" height="24"></use>
  155. </svg>
  156. </div>
  157. <div class="md-source__repository">
  158. Netmaker
  159. </div>
  160. </a>
  161. </div>
  162. <ul class="md-nav__list">
  163. <li class="md-nav__item">
  164. <a href="about.html" class="md-nav__link">About</a>
  165. </li>
  166. <li class="md-nav__item">
  167. <a href="architecture.html" class="md-nav__link">Architecture</a>
  168. </li>
  169. <li class="md-nav__item">
  170. <a href="install.html" class="md-nav__link">Install</a>
  171. </li>
  172. <li class="md-nav__item">
  173. <a href="quick-start.html" class="md-nav__link">Quick Install</a>
  174. </li>
  175. <li class="md-nav__item">
  176. <a href="getting-started.html" class="md-nav__link">Getting Started</a>
  177. </li>
  178. <li class="md-nav__item">
  179. <a href="external-clients.html" class="md-nav__link">Ingress + External Clients</a>
  180. </li>
  181. <li class="md-nav__item">
  182. <a href="egress-gateway.html" class="md-nav__link">Egress Gateway</a>
  183. </li>
  184. <li class="md-nav__item">
  185. <a href="relay-server.html" class="md-nav__link">Relay Servers</a>
  186. </li>
  187. <li class="md-nav__item">
  188. <a href="https://k8s.netmaker.org" class="md-nav__link">Kubernetes</a>
  189. </li>
  190. <li class="md-nav__item">
  191. <a href="server-installation.html" class="md-nav__link">Advanced Server Installation</a>
  192. </li>
  193. <li class="md-nav__item">
  194. <a href="client-installation.html" class="md-nav__link">Advanced Client Installation</a>
  195. </li>
  196. <li class="md-nav__item">
  197. <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
  198. <label class="md-nav__link md-nav__link--active" for="__toc"> Integrating OAuth </label>
  199. <a href="#" class="md-nav__link md-nav__link--active">Integrating OAuth</a>
  200. <nav class="md-nav md-nav--secondary">
  201. <label class="md-nav__title" for="__toc">Contents</label>
  202. <ul class="md-nav__list" data-md-scrollfix="">
  203. <li class="md-nav__item"><a href="#oauth--page-root" class="md-nav__link">Integrating OAuth</a><nav class="md-nav">
  204. <ul class="md-nav__list">
  205. <li class="md-nav__item"><a href="#introduction" class="md-nav__link">Introduction</a>
  206. </li>
  207. <li class="md-nav__item"><a href="#configuring-your-provider" class="md-nav__link">Configuring your provider</a>
  208. </li>
  209. <li class="md-nav__item"><a href="#configuring-netmaker" class="md-nav__link">Configuring Netmaker</a>
  210. </li>
  211. <li class="md-nav__item"><a href="#configuring-user-permissions" class="md-nav__link">Configuring User Permissions</a>
  212. </li></ul>
  213. </nav>
  214. </li>
  215. </ul>
  216. </nav>
  217. <ul class="md-nav__list">
  218. <li class="md-nav__item">
  219. <a href="#introduction" class="md-nav__link">Introduction</a>
  220. </li>
  221. <li class="md-nav__item">
  222. <a href="#configuring-your-provider" class="md-nav__link">Configuring your provider</a>
  223. </li>
  224. <li class="md-nav__item">
  225. <a href="#configuring-netmaker" class="md-nav__link">Configuring Netmaker</a>
  226. </li>
  227. <li class="md-nav__item">
  228. <a href="#configuring-user-permissions" class="md-nav__link">Configuring User Permissions</a>
  229. </li></ul>
  230. </li>
  231. <li class="md-nav__item">
  232. <a href="usage.html" class="md-nav__link">External Guides</a>
  233. </li>
  234. <li class="md-nav__item">
  235. <a href="ui-reference.html" class="md-nav__link">UI Reference</a>
  236. </li>
  237. <li class="md-nav__item">
  238. <a href="api.html" class="md-nav__link">API Reference</a>
  239. </li>
  240. <li class="md-nav__item">
  241. <a href="upgrades.html" class="md-nav__link">Upgrades</a>
  242. </li>
  243. <li class="md-nav__item">
  244. <a href="troubleshoot.html" class="md-nav__link">Troubleshooting</a>
  245. </li>
  246. <li class="md-nav__item">
  247. <a href="support.html" class="md-nav__link">Support</a>
  248. </li>
  249. <li class="md-nav__item">
  250. <a href="conduct.html" class="md-nav__link">Code of Conduct</a>
  251. </li>
  252. <li class="md-nav__item">
  253. <a href="license.html" class="md-nav__link">License</a>
  254. </li>
  255. </ul>
  256. </nav>
  257. </div>
  258. </div>
  259. </div>
  260. <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
  261. <div class="md-sidebar__scrollwrap">
  262. <div class="md-sidebar__inner">
  263. <nav class="md-nav md-nav--secondary">
  264. <label class="md-nav__title" for="__toc">Contents</label>
  265. <ul class="md-nav__list" data-md-scrollfix="">
  266. <li class="md-nav__item"><a href="#oauth--page-root" class="md-nav__link">Integrating OAuth</a><nav class="md-nav">
  267. <ul class="md-nav__list">
  268. <li class="md-nav__item"><a href="#introduction" class="md-nav__link">Introduction</a>
  269. </li>
  270. <li class="md-nav__item"><a href="#configuring-your-provider" class="md-nav__link">Configuring your provider</a>
  271. </li>
  272. <li class="md-nav__item"><a href="#configuring-netmaker" class="md-nav__link">Configuring Netmaker</a>
  273. </li>
  274. <li class="md-nav__item"><a href="#configuring-user-permissions" class="md-nav__link">Configuring User Permissions</a>
  275. </li></ul>
  276. </nav>
  277. </li>
  278. </ul>
  279. </nav>
  280. </div>
  281. </div>
  282. </div>
  283. <div class="md-content">
  284. <article class="md-content__inner md-typeset" role="main">
  285. <h1 id="oauth--page-root">Integrating OAuth<a class="headerlink" href="#oauth--page-root" title="Permalink to this headline">¶</a></h1>
  286. <h2 id="introduction">Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
  287. <p>As of v0.8.5, Netmaker offers integration with the following OAuth providers:</p>
  288. <ul class="simple">
  289. <li><p>GitHub</p></li>
  290. <li><p>Google</p></li>
  291. <li><p>Microsoft Azure AD</p></li>
  292. </ul>
  293. <p>By integrating with an OAuth provider, your Netmaker users can log in via the provider, rather than the default simple auth.</p>
  294. <h2 id="configuring-your-provider">Configuring your provider<a class="headerlink" href="#configuring-your-provider" title="Permalink to this headline">¶</a></h2>
  295. <p>In order to use OAuth, configure your OAuth provider (GitHub, Google, Azure AD).</p>
  296. <p>You must configure your provider (except for Azure AD) to use the Netmaker Dashboard URI dashboard.&lt;netmaker.base.domain&gt; as the origin URL.</p>
  297. <p>For example: <cite>https://dashboard.netmaker.mydomain.com</cite></p>
  298. <p>You must configure your provider to use the Netmaker API URI redirect route with the following format: <a class="reference external" href="https://api">https://api</a>.&lt;netmaker base domain&gt;/api/oauth/callback.</p>
  299. <p>For example: <cite>https://api.netmaker.mydomain.com/api/oauth/callback</cite></p>
  300. <p>General provider instructions can be found with the following links:</p>
  301. <p>Instructions for GitHub: <a class="reference external" href="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider/#github-auth-provider">https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider/#github-auth-provider</a>
  302. Instructions for Google: <a class="reference external" href="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider/#google-auth-provider">https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider/#google-auth-provider</a>
  303. Instructions for Microsoft Azure AD: <a class="reference external" href="https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider/#microsoft-azure-ad-provider">https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider/#microsoft-azure-ad-provider</a></p>
  304. <h2 id="configuring-netmaker">Configuring Netmaker<a class="headerlink" href="#configuring-netmaker" title="Permalink to this headline">¶</a></h2>
  305. <p>After you have configured your OAuth provider, take note of the CLIENT_ID and CLIENT_SECRET. If you are using Azure for oauth, you may also want to note down the Azure tenant ID you wish to use.</p>
  306. <p>Next, Configure Netmaker with the following environment variables. If any are left blank, OAuth will fail.</p>
  307. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">AUTH_PROVIDER</span><span class="p">:</span> <span class="s2">"&lt;azure-ad|github|google&gt;"</span>
  308. <span class="n">CLIENT_ID</span><span class="p">:</span> <span class="s2">"&lt;client id of your oauth provider&gt;"</span>
  309. <span class="n">CLIENT_SECRET</span><span class="p">:</span> <span class="s2">"&lt;client secret of your oauth provider&gt;"</span>
  310. <span class="n">SERVER_HTTP_HOST</span><span class="p">:</span> <span class="s2">"api.&lt;netmaker base domain&gt;"</span>
  311. <span class="n">FRONTEND_URL</span><span class="p">:</span> <span class="s2">"https://dashboard.&lt;netmaker base domain&gt;"</span>
  312. <span class="n">AZURE_TENANT</span><span class="p">:</span> <span class="s2">"&lt;only for azure, you may optionally specify the tenant for the OAuth&gt;"</span>
  313. </pre></div>
  314. </div>
  315. <p>After restarting your server, the Netmaker logs will indicate if the OAuth provider was successfully initialized:</p>
  316. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">docker</span> <span class="n">logs</span> <span class="n">netmaker</span>
  317. </pre></div>
  318. </div>
  319. <p>Once successful, users can click the key symbol on the login page to sign-in with your configured OAuth provider.</p>
  320. <a class="reference internal image-reference" href="_images/oauth1.png"><img alt="Login Oauth" class="align-center" src="_images/oauth1.png" style="width: 80%;"/></a>
  321. <h2 id="configuring-user-permissions">Configuring User Permissions<a class="headerlink" href="#configuring-user-permissions" title="Permalink to this headline">¶</a></h2>
  322. <p>All users logging in will have zero permissions on first sign-in. An admin must configure all user permissions.</p>
  323. <p>Admins must navigate to the “Users” screen to configure permissions.</p>
  324. <p>For each user, an admin must specify which networks that user has access to configure. Additionally, an Admin can elevate a user to Admin permissions.</p>
  325. <a class="reference internal image-reference" href="_images/oauth3.png"><img alt="Edit User 2" class="align-center" src="_images/oauth3.png" style="width: 80%;"/></a>
  326. <a class="reference internal image-reference" href="_images/oauth2.png"><img alt="Edit User" class="align-center" src="_images/oauth2.png" style="width: 80%;"/></a>
  327. </article>
  328. </div>
  329. </div>
  330. </main>
  331. </div>
  332. <footer class="md-footer">
  333. <div class="md-footer-nav">
  334. <nav class="md-footer-nav__inner md-grid">
  335. <a href="client-installation.html" title="Advanced Client Installation"
  336. class="md-flex md-footer-nav__link md-footer-nav__link--prev"
  337. rel="prev">
  338. <div class="md-flex__cell md-flex__cell--shrink">
  339. <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
  340. </div>
  341. <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
  342. <span class="md-flex__ellipsis">
  343. <span
  344. class="md-footer-nav__direction"> Previous </span> Advanced Client Installation </span>
  345. </div>
  346. </a>
  347. <a href="usage.html" title="External Guides"
  348. class="md-flex md-footer-nav__link md-footer-nav__link--next"
  349. rel="next">
  350. <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
  351. class="md-flex__ellipsis"> <span
  352. class="md-footer-nav__direction"> Next </span> External Guides </span>
  353. </div>
  354. <div class="md-flex__cell md-flex__cell--shrink"><i
  355. class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
  356. </div>
  357. </a>
  358. </nav>
  359. </div>
  360. <div class="md-footer-meta md-typeset">
  361. <div class="md-footer-meta__inner md-grid">
  362. <div class="md-footer-copyright">
  363. <div class="md-footer-copyright__highlight">
  364. &#169; Copyright 2021, Alex Feiszli.
  365. </div>
  366. Created using
  367. <a href="http://www.sphinx-doc.org/">Sphinx</a> 4.3.0.
  368. and
  369. <a href="https://github.com/bashtage/sphinx-material/">Material for
  370. Sphinx</a>
  371. </div>
  372. </div>
  373. </div>
  374. </footer>
  375. <script src="_static/javascripts/application.js"></script>
  376. <script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
  377. </body>
  378. </html>