8000 Local Authentication · Issue #1881 · outline/outline · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Local Authentication #1881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
iojanis opened this issue Feb 12, 2021 · 108 comments
Open

Local Authentication #1881

iojanis opened this issue Feb 12, 2021 · 108 comments
Labels
self-hosted Issues related to self-hosting the code

Comments

@iojanis
Copy link
iojanis commented Feb 12, 2021

I don't like the fact that you need a Google or Slack account. I'm sure you'll scare off a lot of people with that. Have a lot of interest in this app, but would never think of hosting something myself, but still have the users go through another service.

@iojanis iojanis added the bug label Feb 12, 2021
@matbrgz
Copy link
Contributor
matbrgz commented Feb 12, 2021

#1183

@tommoor tommoor removed the bug label Feb 13, 2021
@tommoor tommoor added the self-hosted Issues related to self-hosting the code label Mar 11, 2021
@arjunv
Copy link
arjunv commented Apr 18, 2021

#1177

It should be as simple as :

  • Generate an admin user:password in the CLI while starting for the first time
  • When the admin logs into the web, have that password changed forcibly
  • Allow admin to setup whatever authentication methods he needs from the web console
  • Additionally, there should be a non smtp based adding of users too. ie the admin generates a user:pass pair which is given to a 3rd party in whatever secure channel he prefers to. On that user's first login, have that password forcibly changed so the admin cannot snoop in.

Voila, a fully self-hosted instance with no external dependencies like web-oauth or smtp.

@slurdge
Copy link
slurdge commented Apr 18, 2021

Looking at passport.js and the current providers, it seems a local datastore would be needed to store/validate the local users. Unfortunately, passport doesn't seem to provide this (only verification).
So the effort would be:

  • Create a schema for user credentials in the DB (with sequelize)
  • A command line for create & delete an user with optional admin rights.

From this point on, the community could test this functionality. The UI for password reset/change can then be added at a later step.

Allow admin to setup whatever authentication methods he needs from the web console

This is already done with env variables if I'm not mistaken.

@tommoor
Copy link
Member
tommoor commented Apr 18, 2021

I don't see the CLI as being needed, the first ever sign-in on self-hosted automatically creates the team and becomes admin already. I see something like this as a bare minimum set of functionality, you can't have password auth without the ability to reset passwords...

Backend

  • Allow for password auth to be turned on or off via ENV in the same way as all other authentication integrations
  • Add a new password column to user_authentications,
  • Create a new password strategy inline with the existing three for password auth, it will need to handle password being passed to accountProvisioner and userCreator commands
  • For user creator we'll need a reasonable default for a minimum password length validation
  • Add /auth/password.reset endpoint for requesting a password reset with email
  • Add rate limiting for signin and password reset endpoints
  • Add email for password reset with one-time use JWT
  • Tests for all of the above

Frontend

  • On the login screen password auth will be an exception and need it's own special-case UI component
  • Hook up login and password reset UI to API's from above
  • Ensure error cases are handled correctly in the UI, eg wrong user/password combo – as we've typically gone through SSO error handling has been different through return query params, in this case it'll be over XHR.

@slurdge
Copy link
slurdge commented Apr 18, 2021

Thank you for this nice explanation.

I was including command line as I was envisioning a scenario where email SMTP settings weren't provided and the person installing would just like to have a user account for himself or herself, and thus would create it using the command line (probably through docker).

However if using the existing SMTP/email infrastructure make it easier to create and maintain, this is probably much better.
Is there anything I can help with ?

@slurdge
Copy link
slurdge commented Apr 30, 2021

Hello,

I'm trying to have a take at making local auth a reality, but I stumble upon difficulties in the implementation. Is it best to ask it here or to open a discussion on Github ?

@almereyda
Copy link
almereyda commented Apr 30, 2021 via email

@slurdge
Copy link
slurdge commented Apr 30, 2021

I'm trying to follow the steps outlined by @tommoor above, but I'm not fluent in the framework used.
I've import passport-local (did not touch the DB yet), and tried to make a new "local" provider with the following rules:

// @flow
import passport from "@outlinewiki/koa-passport";
import { Strategy as LocalStrategy } from "passport-local";
import jwt from "jsonwebtoken";
import Router from "koa-router";
import passportMiddleware from "../../middlewares/passport";

const router = new Router();
const providerName = "local";

export const config = {
    name: "Local Account",
    enabled: true,
};

const strategy = new LocalStrategy(
    function(username, password, cb) {
        console.log("getting username...")
        return cb(null, { name: username });
    })
strategy.name = "local";
passport.use(strategy);

router.get("local", (ctx) => (ctx.body = "OK"))

router.post("local", passport.authenticate(providerName));

router.get("local.callback", passportMiddleware(providerName));

export default router;

I also modified Providers login to have a special case of form if the provider is "local", which post to "/auth/local"

However I can't hit the callback in the strategy, I always have an error when I hit the route router.post("local", passport.authenticate(providerName));

My plan was first to be able to have a fake user, then have a real user with a manual password in the DB, then go from there.

@n-rodriguez

This comment was marked as off-topic.

@solarkraft
Copy link
solarkraft commented Jun 2, 2021

Ugh. Guys. Sorry for the unproductive comment, but It's such a bummer that something with such great potential is essentially made obsolete by something so silly.

@slurdge
Copy link
slurdge commented Jun 2, 2021

I did a bit more try, but without a hint in how to go in the right direction, I fear it would take me quite a bit of time.

@umdstu
Copy link
umdstu commented Jun 3, 2021

I would also like to use this self-hosted with an authentication other than slack or google, but have seen zero documentation on it, just various issues referencing things, most of which are not clear whether they are in the current release or not (due to lack of documentation and examples).

If it's the intention to drive more people to use the hosted version, it isn't working, as it wouldn't work in my environment.

@tommoor
Copy link
Member
tommoor commented Jun 4, 2021

I would also like to use this self-hosted with an authentication other than slack or google, but have seen zero documentation on it

Hi – there's no documentation because it's not a feature that has ever existed in the product. This issue is a request for it to be built.

@umdstu
Copy link
umdstu commented Jun 4, 2021 via email

@soulteary
Copy link
Contributor

I saw in the project issue discussion that the custom authentication function may be launched as a commercial function. (Please also point out if I understand it wrong)

As a software developer, I think if this is true, it might be a good thing for the development team. After all, income can make the team survive and make the software develop better.

However, if the official permission is allowed, I think I can submit a pull request to allow outline to run completely offline, free from various third-party OAuth (slack, ms, google), and let it serve individuals or small teams.

I hope it will not affect the planning of the outline official team. If the official team has a clear plan, I also hope that it can be clearly stated in the issue what kind of functional implementation will be merged.

BTW I recently tried to complete the self-hosted deployment without changing the outline, and found that the software performed very well.

Thanks.

@slurdge
Copy link
slurdge commented Jul 16, 2021

@soulteary , I tried to have a local auth backend but hit a bump somewhere on the road. My understanding is that having a local backend is ok, just that developers have understandably other priorities.
Did you already progress on this ?

@soulteary
Copy link
Contributor

At the time of posting, I had finished and used this software for a week. In fact, there is no need to change much, especially for small teams or individuals. @slurdge

At present, I only use declarative configuration to solve authorization, and I have not developed an independent authorization management interface, deauthorization interface, and interface to modify specific member information.

I believe that after sharing, anyone can quickly develop the authentication functions they need, such as SAML, LDAP, ANY OAUTH, and independent mail login functions, but this may be related to the concerns mentioned in my previous post.

In the previous discussion, I saw the hard work, business planning and opinions of the official team for self-deployment and certification.

Therefore, I think in order to respect the development team and protect the future development of the outline, it is best to obtain authorization to do so.

@umdstu
Copy link
umdstu commented Jul 16, 2021

@soulteary It's exciting to hear about that you've done. I'm looking forward to being able to use this with a team I'm currently working with. Regarding the development team, per chain you linked to, specifically this comment, they are not opposed to the community developing such functionality, and in fact have encouraged it. Doing so should not take away from an Enterprise feature they offer, in my opinion. They likely have no plans to include it in outline's core code, and that's reasonable, but having it as an add on module, middleware, or whatever you'd like tocall it, seems like fair game both in spirit and and documented desires. I would say publish you're branch, let folks do with it what they wish, or go even further and make it more modular as a separate repo of just the non-outline base code. I'd be willing to help with this if you'd like.

But that's just my opinion of course. Happy coding.

@soulteary
Copy link
Contributor
soulteary commented Jul 16, 2021

Thank you for sharing your views. This week I used Outline to replace Confluence, which I have used for more than two years. It is very pleasant. I also hope that more people can easily use this great software.I believe that after more people use it, this software can develop better, and for users, they can get more benefits.

Regarding my concerns, I believe I have made it clear above, let us wait for the official response.

By the way, privatization deployment is actually only the first step, and the follow-up may also involve content migration, attachment management, some localization changes, more resource display, and so on. In the following post, I mentioned what I did during use and what I planned to solve.

#2308

@slurdge
Copy link
slurdge commented Jul 17, 2021

hello @tommoor , could you help us clarify the official position regarding this ?

only use declarative configuration to solve authorization

If it's only a matter of configuration files for individuals, it would be easier to integrate in the base IMHO.

@soulteary From what I understand the architecture is already pluggable with any auth you may want, it's just it will not be provided in then open source package (see Microsoft ticket).

@tommoor
Copy link
Member
tommoor commented Jul 18, 2021

only use declarative configuration to solve authorization

Honestly I'm not too interested in supporting a solution like this, it feels like a kludge that would end up being a perpetual maintenance burden. How are you handling passwords with this configuration-based setup?

@wpuckering
Copy link
wpuckering commented Jul 22, 2021

It's a real bummer that something as basic as local user authentication isn't there, especially since on the frontpage of the main website you see this:

"Outline’s source code is public, and the editor is open source so the community can help improve it too. Prefer to host on your own infrastructure? No problem."

Google Authentication isn't hosted on my own infrastructure. Not no problem. Big problem. We're not talking about a plugin here, but core functionality. Disappointing, I was really looking forward to self-hosting this, but I'll have to pass.

At the very least, the frontpage of the website should be updated to remove that last bit from under the "Open source" card, if local authentication will never be implemented, because it implies the solution in its base entirety can be self-hosted (which inherently means without external dependencies, right?).

@matbrgz
Copy link
Contributor
matbrgz commented Jul 22, 2021

It's a real bummer that something as basic as local user authentication isn't there, especially since on the frontpage of the main website you see this:

"Outline’s source code is public, and the editor is open source so the community can help improve it too. Prefer to host on your own infrastructure? No problem."

Google Authentication isn't hosted on my own infrastructure. Not no problem. Big problem. We're not talking about a plugin here, but core functionality. Disappointing, I was really looking forward to self-hosting this, but I'll have to pass.

At the very least, the frontpage of the website should be updated to remove that last bit from under the "Open source" card, if local authentication will never be implemented, because it implies the solution in its base entirety can be self-hosted (which inherently means without external dependencies, right?).

You can use RedHat KeyClock to create your own oauth server, then you can use passport to implement your own strategy.

In my opinion, Outline must never implement a local auth.

@troplin
Copy link
troplin commented Nov 16, 2023

i started looking to set up outline but then gave up and went to bookstack when i found you had to set up a completely separate login method, and having to check my email every time i want to log into something local is hilarious. didnt even bother giving outline a try.

I see it more as a documentation issue. I was struggling with the setup too and nearly gave up, but for different reasons: For me it was the setup of minio, which I later found out isn't even necessary anymore because there is now the option of local file storage.
The application already has other similar external dependencies like postgres and redis, which doesn't seem to be a problem.
I'm sure there is a way to also include a simple authentication server in the docker compose example.

Unfortunately, the current documentation is written in a way that assumes that you are already familiar with all those systems which makes it difficult to follow if you're not. Also it doesn't seem to be completely up to date with the latest development (c.f local file storage).
But I also understand that I'm not the target audience and documentation for self-hosting is probably not the highest priority.

@isc30
Copy link
isc30 commented Nov 18, 2023

This is a pain, I wanted to give Outline a try but the amount of complication to simply get something working for a single user is too much. Sad.

@nsauter
Copy link
nsauter commented Nov 20, 2023

This is a pain, I wanted to give Outline a try but the amount of complication to simply get something working for a single user is too much. Sad.

Jup, i went through this too and i dont unserstand why there is such a highlevel configuration which needt to get setup fully until you have a running instance. After all this was done i thin outline is one of the best Open Source Tools out there. Its a shame that its so complicated to setup.

@hwcltjn
Copy link
hwcltjn commented Nov 20, 2023

I cannot speak on behalf of the devs, and I get that deploying Outline isn't as easy as spinning up one docker container but based on it's architecture, Outline was first and foremost built to scale-up so that it could be a viable, succesful, commercial product that can sustain itself and it's creators.

Just because it's open source doesn't mean it needs to be easy to use, or not have some (pretty low) "barriers" to entry in order to remain commercially viable.

This product is still incredible and free - as in $0!
I'm sure you all know how difficult it is to keep some open source projects alive and well maintained.

So what if not having local auth perhaps encourages some to use the hosted version?
I'm sure it could easily be implemented, but this issue has been open for 2 years and so many don't get it and still come here to complain.

See it instead as an opportunity to learn more about implemeting your own self-hosted authentication (Keycloak, Authelia, Authentik), integrating with the many hosted options that are available (also for free!), or actually reading through some of the comments and realising that someone has done the work for you!

There's a reason this project has ~21k stars.

TL;DR stop complaining and use something like:
https://github.com/vicalloy/outline-docker-compose

@isc30
Copy link
isc30 commented Nov 20, 2023

So what if not having local auth perhaps encourages some to use the hosted version?

Frustration isn't driving sales, it's getting people away from the project.

TL;DR stop complaining and use something like:
https://github.com/vicalloy/outline-docker-compose

Why not document something like this in the main documentation?

@disgustipated
Copy link

Frustration isn't driving sales, it's getting people away from the project.

I agree with this. I was going to use outline for my work as well but went to bookstack because of no local login. I dont need the server to communicate with external pieces.

@hwcltjn
Copy link
hwcltjn commented Nov 20, 2023

Frustration isn't driving sales, it's getting people away from the project.

21k stars says otherwise.
There are plenty of other widely used self-hosted projects that don't have half this following.

TL;DR stop complaining and use something like:
https://github.com/vicalloy/outline-docker-compose

Why not document something like this in the main documentation?

Why should it be? It's a third party, independent project!
You all have access to search engines, and the author took the time to share it with the community here.

I agree with this. I was going to use outline for my work as well but went to bookstack because of no local login. I dont need the server to communicate with external pieces.

If that's more suitable for you, great! That's the whole point of having a choice.

@nsauter
Copy link
nsauter commented Nov 20, 2023

Frustration isn't driving sales, it's getting people away from the project.

21k stars says otherwise. There are plenty of other widely used self-hosted projects that don't have half this following.

Can u tell how many of the 21K Stars use this Project or maybe just starred it to follow up on the development? I wouldnt use this benchmark to proof your point.

TL;DR stop complaining and use something like:
https://github.com/vicalloy/outline-docker-compose

Why not document something like this in the main documentation?

Why should it be? It's a third party, independent project! You all have access to search engines, and the author took the time to share it with the community here.

I agree with this. I was going to use outline for my work as well but went to bookstack because of no local login. I dont need the server to communicate with external pieces.

If that's more suitable for you, great! That's the whole point of having a choice.

Why are you even complaining about the complaints if you have nothing to do with the project or nothing really to say?

@mxmilkiib
Copy link

Why should it be? It's a third party, independent project!

Altruism? The spirit of Free software? The example of other free/open source software projects? Free advertising and spreading product familiarity through co-operation? (e.g. the like of "Oh, I or my friend uses this personally and really likes it, I'll recommend to my friend/boss to use it")

I mean, the real question is; if someone creates a PR to add such to the docs, would it be accepted? Would an easy individual login PR be accepted?

@almereyda
Copy link

Outline is not free software in the literal sense.

The BSL in use dictates that the source code becomes free two years after release.

Maybe in this case, assuming you are accepting the license conditions and want to use it within the accepted restrictions, it is fair not to use the same evaluation criteria as, for example, when compared to GNU software?

@vicalloy is certainly a talented programmer, and deserves all the credit due. Yet as a third-party project, why should it be documented in the original documentation? It is sufficient for many already, but how can it be made more accessible to the rest? From that point of view Outline is not a classical self-hosting project as in "Fire up the LAMP!", but a more sophisticated mid-range, say collaboration-friendly, SME-oriented writing platform.

I think the answer to your questions lies in trying it out: (1) to refresh the documentation and to offer some paragraphs about how people have answered the authentication requirement, plus (2) to answer the question, why the total LoC should be amended with a section to support an additional secure and reliable (password reset, enabling/disabling) authentication mechanism, if a widely tested and supported option already exists?

Maybe it's like with the law: just because you are not aware about the option to deploy your own minimal identity provider (IdP), does not mean it does not exist/apply. It's a sufficient condition to running Outline, and there are plenty examples on how to achieve this. We have all the faith in the world that you are able to replicate them. Else:

  • Why should the maintainers of Outline add parts to the code base which they will have to maintain, if a viable option to meet the requirement of authentication is already present?

And please note that other software such as gristlabs/grist-core, here FLOSS, also comes without local authentication, and relies completely on an IdP. This is the cloud-native, microservice era of application design, which somewhat reflects the UNIX philosophy of small tools that do one thing well in running web services.

From my perspective, I'm already happy that Outline doesn't depend on commercial services, like Firebase in pubpub pubpub/pubpub#1470, and that I can use it without limitation in our not-for-profit communities. In return I'm providing technical feedback and participation in the support community. For me it's a fair deal. It may not be for others.

@nsauter
Copy link
nsauter commented Nov 21, 2023

I dont like how this thread is all about thinking in black and white. I think everybody would be perfectly fine if the dev would say "Im not doing this". Yes, its may be the new "cloud native" way and yes, it may be easier to maintain and its perfectly fine if the dev decides not to implement basic LDAP or local auth. But also - since this is open source - its perfectly fine to ask for such things and i guess you guys need to get over it and accept that some people want this and ask for it.

@Limezy
Copy link
Contributor
Limezy commented Nov 21, 2023

The problem is that these people complaining are just coming in to cry on that thread. We don't see them coming on the discussions and helping others. We don't see them sponsoring the repo. We don't see them opening new issues and track bugs. We don't see them contributing to the various translation works... And I could continue the list.

Do they need a quick setup just to try outline ? Then they could use the free trial on the cloud version. Do they need a setup to self host ? Most of the self hosting community already has a kind of centralized SSO for their various "apps" and don't use or like having a local auth anyway. Do they lack the knowledge to do so ? There is a complete Debian tutorial written by a member here, there are a few docker based scripts that you could find around and a one click installation script on Yunohost maintained by myself. Yes, their request is legit but honestly I don't see the point.

Finally, if this was a real need there would already be a PR made by a nice guy who needs it and has the knowledge of doing it. Should that PR exist and be properly done I'm sure it would be merged. It's not as if the dev was refusing or closing an existing proposed code for local auth. And even if that was the case you could always use a fork of some kind (provided you respect the licence).

@almereyda
Copy link

Yes, if the desire expressed in this issue would not be respected by the project maintainers, it would already be rejected and closed.

@jrussellfreelance
Copy link

""Most of the self hosting community already has a kind of centralized SSO for their various "apps" and don't use or like having a local auth anyway. Do they lack the knowledge to do so""

@Limezy This is honestly a very lazy answer, and I suspect you know it. It's not accurate and not fair to the self-hosting community.

@Limezy
Copy link
Contributor
Limezy commented Dec 26, 2023

I won't launch another useless anonymous debate but please think twice before qualifying as "lazy" and "unfair to the self hosting community" someone who has worked countless hours to create and maintain a one-click installation for Outline (through the Yunohost project) including a fully working local authentification (local = not dependent on external social networks since it goes through the Yunohost native user management)

@jrussellfreelance
Copy link
jrussellfreelance commented Dec 26, 2023

@Limezy I am in no way insulting any of that work. Thank you for your contributions. I am most thankful for a side project that integrates OIDC for a semi local auth feel: https://github.com/vicalloy/outline-docker-compose

I am only saying it in that tone due to the extreme generalizing statements you made about the community. Please poll or do your own research and supply that as a supporting argument if you plan to take such a strong tone and stance.

@magixus
Copy link
magixus commented Dec 26, 2023 via email

@Gr3q
Copy link
Gr3q commented Dec 27, 2023

My personal opinion as someone who was put off using outline partially because of this issue is that:

  • I can respect the Dev's wishes for not implementing a fully local Auth, it is a pain, both DB and in UI it adds another level of complexity
  • Still, you should assume absolutely 0 things about people's existing deployments, there can be so many reasons for someone not running SSO yet (including setting up migration paths to existing users/services or other services not supporting it at all)
  • I was mainly put off by the implicit hostility (not personal! Simply lack of docs and the way outline is usually deployed) towards non-corporate self-hosted setups that stem from the fact that outline is geared towards corporate environments. Still this improved a lot where it makes sense (local storage support etc).
  • I consider local SSO a form of Local authentication

In my opinion you could resolve this issue for a portion of users if you have example docker-compose files (or some kind of more extensive documentation) with local SSO deployment examples for users who just want to try/deploy this without:

  • Relying on Google/Microsoft etc
  • Having to read through this thread for examples of deployment configs
  • Having to read through this thread to find a good local SSO solution
  • Having to read through this thread at all

Those are the things that I'm against the most.

Take this with a grain of salt, my experience setting up outline is 2 months out of date at this point.

@kxhubs
Copy link
kxhubs commented Jan 11, 2024

I‘m also self-hosting and I‘m happy with the current state of authentication. Using an established authentication solution instead of a home-grown one increases security and frees up developer time to work on actual features.

Running your own OIDC/OAuth2 server is not that difficult and there are many alternatives to choose from: https://docs.google.com/spreadsheets/d/16Ya5KsmEpczTmoTk5J-1e2MOyuUqXIiPuj7rPfPrHAI/htmlview

Personally I‘m using „Synology SSO Server“ just because it‘s already integrated with the user management of my NAS. You only have to set it up once and then you can use it for pretty much anything you host (that supports OIDC) which is super convenient. You also get advanced features like 2FA basically for free.

How can I use Synology SSO Server to achieve single sign on?

@troplin
Copy link
troplin commented Jan 11, 2024

How can I use Synology SSO Server to achieve single sign on?

  1. Install the "Synology SSO Server" package:
    Bildschirmfoto 2024-01-11 um 18 40 56
    (Not "Synology OAuth Service", which confusingly sounds very similar)
  2. Open "Synology SSO Server", go to "Service" in the sidebar:
    Bildschirmfoto 2024-01-11 um 18 43 30
  3. Check "Enable OIDC Service" checkbox if it isn't already.
  4. Copy the URL and open it in another browser window. The URL might look different for you, because I'm using a subdomain for the SSO server. (Can be configured in Control Panel - Login Portal - Applications):
    Bildschirmfoto 2024-01-11 um 18 53 24
  5. Copy the 3 endpoint URLs to the respective Outline configuration variables in the .env file or directly in the compose.yaml:
    • authorization_endpoint -> OIDC_AUTH_URI
    • token_endpoint -> OIDC_TOKEN_URI
    • userinfo_endpoint -> OIDC_USERINFO_URI
  6. Open "Synology SSO Server", go to "Applications" in the sidebar
  7. Add a new Application, fill out the name and redirect URL (you can also change them later)
    • Application Name: E.g. "Outline" (just an informal descriptive name)
    • Redirect URI: https://outline.yourdomain.xx/auth/oidc.callback (The main URL of your outline installation with /auth/oidc.callback at the end). If you are using a reverse proxy, use the public URL.
  8. Open the newly created "Outline" application from the list:
    Bildschirmfoto 2024-01-11 um 19 09 45
  9. Copy the ID and secret to your Outline configuration (.env or compose.yaml)
    • Application ID -> OIDC_CLIENT_ID
    • Application secret -> OIDC_CLIENT_SECRET
  10. Add the following configuration variable to the Outline configuration (.env or compose.yaml):
    • OIDC_USERNAME_CLAIM=username (default is preferred_username which is not supported by Synology SSO Server)

And that should be it. Just make sure that all URLs are exactly as they appear in your browser address field, especially the redirect URI. If you want to support multiple URLs (e.g. HTTP and HTTPS) you can just add another redirect URI with "+ Add Field" in "Synology SSO Server".

Here's my entire compose.yaml that I use in Synology Container Manager, I'm not using the .env file:
version: "3.7"
services:

  outline:
    image: outlinewiki/outline:latest
    ports:
      - "3002:3000"
    depends_on:
      - postgres
      - redis
    volumes:
      - ./storage-data:/var/lib/outline/data
    environment:
      NODE_ENV: production
      SECRET_KEY: ### REDACTED ###
      UTILS_SECRET: ### REDACTED ###
      # HTTP
      URL: https://outline.example.com
      PORT: 3000
      FORCE_HTTPS: false
      WEB_CONCURRENCY: 1
      # Rate limiter
      RATE_LIMITER_ENABLED: true
      RATE_LIMITER_DURATION_WINDOW: 60
      RATE_LIMITER_REQUESTS: 600
      # Authentication
      OIDC_CLIENT_ID: ### REDACTED ###
      OIDC_CLIENT_SECRET: ### REDACTED ###
      OIDC_AUTH_URI: https://sso.example.com/webman/sso/SSOOauth.cgi
      OIDC_TOKEN_URI: https://sso.example.com/webman/sso/SSOAccessToken.cgi
      OIDC_USERINFO_URI: https://sso.example.com/webman/sso/SSOUserInfo.cgi
      OIDC_USERNAME_CLAIM: username
      OIDC_SCOPES: openid groups email  
      # Storage
      FILE_STORAGE: local
      FILE_STORAGE_LOCAL_ROOT_DIR: /var/lib/outline/data
      FILE_STORAGE_UPLOAD_MAX_SIZE: 26214400
      # Database
      DATABASE_URL: postgres://outline:***REDACTED***@postgres:5432/outline
      PGSSLMODE: disable
      # Redis
      REDIS_URL: redis://redis:6379
      # Other
      LOG_LEVEL: info
      ENABLE_UPDATES: true
      DEFAULT_LANGUAGE: de_DE

  redis:
    image: redis:7
    expose:
      - 6379
    command: redis-server

  postgres:
    image: postgres:16
    expose:
      - 5432
    environment:
      POSTGRES_USER: outline
      POSTGRES_PASSWORD: ### REDACTED ###
      POSTGRES_DB: outline
    volumes:
      - ./postgres-data:/var/lib/postgresql/data

@Sleepful
Copy link

Hi, you can use https://dexidp.io/ and use the local enablePasswordDB option. It hardly gets easier than that! 😁

Oh and if you are using NixOS, here's the easy walk-through: https://nixos.wiki/wiki/Outline

@almereyda
Copy link
almereyda commented Jan 31, 2024

Didn't know about enablePasswordDB until now, that seems very useful.

Given all the small- and medium-scale SSO options that exist for Outline, this issue shouldn't stop anyone from running it with minimal extra effort in contrast to the requirements of this issue.

Additionally, I was thinking, if in the mean time it would be possible to meet halfway. Outline already has some kind of local authentication with the magic email login link that is sent to collaborators, whose accounts will become just regular members in a team space. They will not differ in role or capabilities in comparison with SSO users.

This means what is left would be the bootstrap question of the first user. Django applications know the createsuperuser command for this. Would it be possible to implement a similar facility, in so the first admin user can be provisioned after setting up an instance without OIDC, but with email configured and email invites enabled?

In dream code, I would want to run the following commands, and be sent an invitation email to join my Outline instance as a super user:

# as a package.json script
docker compose exec outline npm run createsuperuser <username> <email>
# as an argument to the Outline CLI
docker compose exec outline npm start createsuperuser <username> <email>

The exact nomenclature is left to the person implementing the feature.

If it gave even more convenience, an euphoric programmer could provide an ./outline CLI wrapper in bin/ for npm start.

What do you think? This intervention should be minimally intrusive, and allow for self-hosted Outline instances without OIDC SSO configured.

Edit: This command is already here. As seen on:

under the headline Authentication:

For local development you can provision an admin user with email login by running the following command. The link for login will appear in the server logs, so there is no need to have SMTP setup for local development.

yarn build:server && node build/server/scripts/seed.js my@email.com

Someone interested in this feature should check if this is already enough to bootstrap an instance with an admin user that can then invite further users via email.


The main reason why there is no local authentication is to avoid handling passwords. The email magic link login provides a kind of local authentication, when SMTP is configured.

@ex3ndr
Copy link
ex3ndr commented Mar 20, 2024

It is still doesn't work on latest version, correct sequence of commands:

# Create a user
docker compose run --rm outline node build/server/scripts/seed.js your@email.com

# Start service
docker compose up -d 

# Fix database
docker compose exec postgres psql -d outline -U outline -c "insert into authentication_providers values ('00000000-0000-0000-0000-000000000001', 'fake', '1', true, (SELECT id FROM teams LIMIT 1), NOW());"

# Start service again
docker compose up -d 

@DerDennisOP
Copy link

It would still be nice if an additional service like dex wouldn't be necessary.

@nicopowa
Copy link
nicopowa commented Jun 6, 2024

A lot of reading later :)
I think it is stable, just starting to create pages and upload content.

Sources / Credits

#1881 (comment)
#6237 (comment)
https://github.com/outline/outline/blob/main/.env.sample

Steps

  • generate two random secrets
    openssl rand -hex 32

  • generate database password
    openssl rand -base64 15

  • create storage directory
    /path/to/persistent/wikidata/

  • edit docker compose file

    • user (if first run permission denied)
    • outline and postgres volumes
    • postgres user and password
  • edit docker env file

    • SECRET_KEY : first random secret
    • UTILS_SECRET : second random secret
    • DATABASE_URL / DATABASE_URL_TEST
      • POSTGRES_USER : database user
      • POSTGRES_PASSWORD : database password
    • URL : outline url
    • PORT : outline port
    • SMTP_NAME : mail conf
    • SMTP_HOST : ...
    • SMTP_PORT
    • SMTP_USERNAME
    • SMTP_PASSWORD
    • SMTP_FROM_EMAIL
    • SMTP_REPLY_EMAIL
  • SMTP must be configured to enable magic link login

  • run the stack

  • configure ports, reverse proxy etc if needed

  • create outline admin account
    docker exec -it outline_front node build/server/scripts/seed.js wiki@domain.tld

  • connect to outline via cmd output link or received email link

  • log out

  • restart outline_front and outline_postgres containers

  • read the outline_front database migration error message

  • don't run the authentication migration script

  • connect to outline_postgres bash
    docker exec -it outline_postgres bash

  • connect postgres account
    psql -d outline -U POSTGRES_USER

  • create fake provider entry
    insert into authentication_providers values ('00000000-0000-0000-0000-000000000001', 'fake', '1', true, (SELECT id FROM teams LIMIT 1), NOW());

  • restart outline container

  • is it running ?

  • configure outline instance

  • send invite mails to create accounts

  • start writing all the pages

  • backup outline database
    docker exec -i outline_postgres /bin/bash -c "PGPASSWORD=POSTGRES_PASSWORD pg_dump --username POSTGRES_USER outline" > /path/to/backup/outline_db.sql

  • backup outline storage
    tar -zcvf /path/to/backup/outline_data.tar.gz /path/to/persistent/wikidata/outline

  • or daily incremental backup cmd, use with care (scripts below)
    sh backup.sh BACKUP_NAME path/to/what/to/backup
    sh restore.sh BACKUP_NAME

  • create backup cron job

Docker compose file

services:

  outline:
	user: USERNAME
    container_name: outline_front
    image: outlinewiki/outline
    env_file: ./stack.env
    ports:
      - 127.0.0.1:23000:3000
    volumes:
      - /path/to/persistent/wikidata/outline/data:/var/lib/outline/data
    depends_on:
      - postgres
      - redis
    networks:
      - outline_net

  redis:
    container_name: outline_redis
    image: redis
    env_file: ./stack.env
    ports:
      - 127.0.0.1:26379:6379
    volumes:
      - ./redis.conf:/redis.conf
    command: [ "redis-server", "/redis.conf" ]
    healthcheck:
      test: [ "CMD", "redis-cli", "ping" ]
      interval: 10s
      timeout: 30s
      retries: 3
    networks:
      - outline_net

  postgres:
    container_name: outline_postgres
    image: postgres
    env_file: ./stack.env
    ports:
      - 127.0.0.1:25432:5432
    volumes:
      - /path/to/persistent/wikidata/postgresql/data:/var/lib/postgresql/data
    healthcheck:
      test: [ "CMD", "pg_isready" ]
      interval: 30s
      timeout: 20s
      retries: 3
    environment:
      POSTGRES_USER: 'POSTGRES_USER'
      POSTGRES_PASSWORD: 'POSTGRES_PASSWORD'
      POSTGRES_DB: 'outline'
    networks:
      - outline_net

networks:
  outline_net:

Docker env file

NODE_ENV=production
SECRET_KEY=SECRET_ONE
UTILS_SECRET=SECRET_TWO
DATABASE_URL=postgres://POSTGRES_USER:POSTGRES_PASSWORD@outline_postgres:5432/outline
DATABASE_URL_TEST=postgres://POSTGRES_USER:POSTGRES_PASSWORD@outline_postgres:5432/outline-test
PGSSLMODE=disable
DATABASE_CONNECTION_POOL_MIN=
DATABASE_CONNECTION_POOL_MAX=
REDIS_URL=redis://outline_redis:6379
URL=https://wiki.domain.tld
PORT=3000
COLLABORATION_URL=
FILE_STORAGE=local
FILE_STORAGE_LOCAL_ROOT_DIR=/var/lib/outline/data
FILE_STORAGE_UPLOAD_MAX_SIZE=26214400
FORCE_HTTPS=false
ENABLE_UPDATES=true
WEB_CONCURRENCY=1
FILE_STORAGE_IMPORT_MAX_SIZE=5120000
DEBUG=emails
LOG_LEVEL=debug
SMTP_NAME=domain.tld
SMTP_HOST=domain.tld
SMTP_PORT=465
SMTP_USERNAME=noreply@domain.tld
SMTP_PASSWORD=MAIL_PASSWORD
SMTP_FROM_EMAIL=noreply@domain.tld
SMTP_REPLY_EMAIL=noreply@domain.tld
SMTP_TLS_CIPHERS=TLS_AES_256_GCM_SHA384
SMTP_SECURE=true
DEFAULT_LANGUAGE=en_US
RATE_LIMITER_ENABLED=true
RATE_LIMITER_REQUESTS=1000
RATE_LIMITER_DURATION_WINDOW=60

backup.sh

NAME=${1:-"backup"}
DIR=${2}
DATE=`date '+%Y_%m_%d_%I_%M_%S'`
OUTPUT=${NAME}_${DATE}.tar
tar --create --file=$OUTPUT --listed-incremental="${NAME}.snar" $DIR

restore.sh

for i in `ls -v *.tar`; do tar --extract --listed-incremental=backup.snar --file $i; done;

@lopar
Copy link
lopar commented Jul 19, 2024

So, even using custom SSO not every account works. I added SSO LDAP and.. nothing happened. Because "error":"An email field was not returned in the profile parameter, but is required." somewhere in the debris of stderr. Okay, but what if I use some intranet email, like SomeCorporateUser@Contoso.local? And.. nothing happened again. Just empty exclamation mark box on login page. So, not only email required, but active existing email required, even if it is not used.

Who said "teams don't use local, teams use sso\ldap"? Looks like its time to say "teams use exact email authentification, not a single step aside". Looks like self-hosted \ enterprise on-premise SSO is also not an option and whole project is made for cloud-based setups only.

So to implement Outline in my organisation I need to change whole UPN logon generation policies to cloud-based Azure-style ones. Nope, It's not for "most teams" either. Pity.

@outline outline locked as off-topic and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
self-hosted Issues related to self-hosting the code
Projects
None yet
Development

No branches or pull requests

0