outline / outline

The fastest knowledge base for growing teams. Beautiful, realtime collaborative, feature packed, and markdown compatible.
https://www.getoutline.com
Other
26.25k stars 2.1k forks source link

Local Authentication #1881

Open iojanis opened 3 years ago

iojanis commented 3 years ago

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.

matbrgz commented 3 years ago

1183

arjunv commented 3 years ago

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 commented 3 years ago

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:

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 commented 3 years ago

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

Frontend

slurdge commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

This is good to ask! Feels like filing a draft Pull Request against this repository seemed a good use of GitHubs discussion features around code changes.

Given we are in good exchange here, what is it that concerns you?

On Fri, 30 Apr 2021 at 18:29, slurdge @.***> wrote:

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 ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/outline/outline/issues/1881#issuecomment-830212624, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMRV7EBRNI5HHTFZYTSFELTLLLIFANCNFSM4XQW4LZQ .

slurdge commented 3 years ago

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 commented 3 years ago

Hi there! Any news?

solarkraft commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Ah ok. It gets quite confusing, there are several tickets referencing it, and most closed, and it's not clear whether things were closed as duplicates, consolidated, or something was finished and merged in.

But that makes sense, thanks for clarifying. Is there a roadmap (if so, is this on it?), or is this goin to be something only in the paid enterprise version, like LDAP support?

Thanks!

On Fri, Jun 4, 2021 at 11:41 AM Tom Moor @.***> wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/outline/outline/issues/1881#issuecomment-854823536, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ445H7U57LH4LEMJIC5ZDTRDXYZANCNFSM4XQW4LZQ .

soulteary commented 3 years ago

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 commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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.

https://github.com/outline/outline/issues/2308

slurdge commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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.

n-rodriguez commented 2 years ago

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.

A very disappointing answer, a very disappointing project...

umdstu commented 2 years ago

I totally understand not wanting to have a built in user system. It supports oauth I'm an indirect way I'm told, set up an oauth server?

On Fri, Jul 23, 2021 at 8:30 AM Nicolas Rodriguez @.***> wrote:

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.

A very disappointing answer, a very disappointing project...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/outline/outline/issues/1881#issuecomment-885604774, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ445B5LOT5YSAWZHN5WQTTZFOGJANCNFSM4XQW4LZQ .

n-rodriguez commented 2 years ago

A very disappointing answer, a very disappointing project...

What's wrong with this... it's the sad reality

slurdge commented 2 years ago

What's wrong with this... it's the sad reality

I think a lot of people would disagree with that. Outline is a great product and even more, it's open source which is totally not a given when you see the level of dedication devs have to put into it. Also, from a pure "issue tracking" point of view, your comment didn't add anything. The issue is so see the feasibility and implementation of local auth, and you'll notice the devs didn't close it.

When I have more time, I'll try to do another shot at it to have a solution that would please most people (myself included, after all, itch scratiching & all that).

n-rodriguez commented 2 years ago

it's open source

It's your vision of open source, see https://github.com/outline/outline/issues/1881#issuecomment-885195057

when you see the level of dedication devs have to put into it

No doubt about it, the screenshots speak for themselves

The point is : I dont think installing keycloak is a good solution especialy for small teams and saying

Outline must never implement a local auth.

Is just... disappointing

slurdge commented 2 years ago

I have made some progress in the implementation of passport-local.

However, after the initial passport authenticate , I'm having a hard time passing the user to the signIn method. I suppose that in outline, we should use signIn and not session or log in through the context.

I'm doing something like this (putting async with ctx & next doesn't change anything, we can call auth directly):

router.post("local", async (ctx, next) => {
    return passport.authenticate(providerName,
{
    session:false,
    failureRedirect: '/',
    failureMessage: true,
})(ctx, next)},  function(req, ctx) {
    log(`req : ${JSON.stringify(req, null, 4)}, ctx: ${ctx}`);
    signIn(
          ctx,
          req.user,
          req.team,
          providerName,
          true,
          true
        );
});

But req.user is always empty. I also tried to have a successRedirect but in that case passport tries to serialize the user and outline does not define the serializeUser functions.

Questions:

JokerQyou commented 2 years ago

Is it feasible to support JWT authentication like how grafana does? From the perspective of a user with multiple self-hosting services, this workflow seems reasonable, as all user identities are managed via a unified provider, and all authentication policies are managed via a single source. It works like this:

Of course, I know this could be too complicated for Outline for now. After all, you still need the user identity (username or email addres) locally stored and known to Outline.

soulteary commented 2 years ago

have not “seen” you for a long time @JokerQyou .

In fact, this problem can be solved very well. Either adjust the authentication strategy of the outline, whether it is adding a local strategy or adding a remote verification flag. The amount of code changes is actually not particularly large.

Taking into account the feelings of the official maintenance team and the goal of commercialization, in order not to affect this software, I made a single-user sso authorization docker image.

https://github.com/soulteary/docker-sso-server

In the next two versions/ weeks, I will submit some code to enable outline to run smoothly in single-player stand-alone mode ( just for self-hosted user uses).

I think this is a better choice for everyone than fork or hack it.

Respect the creative team, @tommoor , This software is so COOOOOOOL!

JokerQyou commented 2 years ago

@soulteary That's really exciting! I roughly read the README of your sso server, looks like a lightweight pomerium alternative to me, except that it does not require an external OAuth provider (like Keycloak). Is that correct? Also I did not find the source code and detailed example usage for now. I'll check again later, and discuss related issues in your repository.

soulteary commented 2 years ago

Yes, it can be understood as a simple login agent tool, responsible for docking the login function of the Homelab software, solving login-related problems in personal use scenarios, and allowing related software to run offline (including itself).

There are many similar software(KeyClock, Gluu, Authelia, FusionAuth), this one should be the simplest and use the least resources.

But the difference is that I will do some additional things to support software that does not originally support OAuth and other logins. A simple example: Ghost. During the update process, I will continue to update login methods such as SAML and LDAP.

The original purpose of writing this software was. Earlier, my friend invited me to write a set of software for sale to enterprises, so I did not plan to open source the source code, just like FusionAuth. And this docker image was originally provided only for my blog readers and readers' WeChat group.

Welcome to continue the discussion, whether it is about outline or this login tool. @JokerQyou

almereyda commented 2 years ago

Please note that generic OAuth2 support #2388 has been merged meanwhile and usage of self-deployed IDPs should now be more easy with the solutions named above.

In general for pluggable authentication mechanisms #1945 that do not impose a maintenance burden and can be built independently from Outline core, it seems a good idea to find answers about a good plugin architecture in #2219 first, before having to merge all various imaginable providers here, including a passport-local one.

JWT tokens are also used by GitLab pages and GitLab for validating permissions to display a site through oauth2-proxy, and are useful and lightweight alternative to implementing more wholesome identity protocols (which we rightly find in Outline enterprise).

@slurdge Did you find some time to progress on your implementation, or would you like someone to review a draft PR?

soulteary commented 2 years ago

have not “seen” you for a long time @JokerQyou .

In fact, this problem can be solved very well. Either adjust the authentication strategy of the outline, whether it is adding a local strategy or adding a remote verification flag. The amount of code changes is actually not particularly large.

Taking into account the feelings of the official maintenance team and the goal of commercialization, in order not to affect this software, I made a single-user sso authorization docker image.

https://github.com/soulteary/docker-sso-server

In the next two versions/ weeks, I will submit some code to enable outline to run smoothly in single-player stand-alone mode ( just for self-hosted user uses).

I think this is a better choice for everyone than fork or hack it.

Respect the creative team, @tommoor , This software is so COOOOOOOL!

I am back with a simple and usable plan: https://github.com/soulteary/docker-outline

The solution I used originally did a little patch on the outline.

After testing for about half a month, before the opening, I saw that #2388 mentioned by @almereyda has been merged into the main trunk, so I updated an example.

You can also replace SSO with solutions you are using, such as keyclock.

almereyda commented 2 years ago

When running Outline with the (new) GitLab provider, it also offers a "Continue with Email" button, which will send a magic link to login the application.

For local provisioning without SMTP provider, applications often output the emails on their console, in so an administrator could retrieve such confirmation and login links.

For the definition of the flows desribed by @tommoor in https://github.com/outline/outline/issues/1881#issuecomment-822030844 above, could we piggyback on this method here, and use it to also allow registration of users and creation of groups this way?

slurdge commented 2 years ago

@slurdge Did you find some time to progress on your implementation, or would you like someone to review a draft PR?

Not really, I'm still at the point where I don't understand how to massage the user so that passport-local is happy with the architecture in outline.

stale[bot] commented 2 years ago

Hey! The issue has been automatically marked as stale because it has not had recent activity. It will be closed soon if no further activity occurs. Please reply here if you wish for the issue to be kept open.

remram44 commented 2 years ago

Hey! The issue has been manually marked as relevant by me, because it is an important feature request that is going to stay desirable until it is implemented. It will be bumped again soon if further bot activity occurs. Please fix your configuration if you wish to avoid spam.

Bence98007 commented 2 years ago

Any OFFICIAL update guys? 😄

solarkraft commented 2 years ago

I've honestly given up the idea of ever using outline. There seems to be no intention to make this happen.

remram44 commented 2 years ago

Yeah it's one of those "technically-almost-open" tools that you can't actually use outside of the paid hosted offering. Thankfully there are lots of other apps in this space.

n-rodriguez commented 2 years ago

becareful, censorship is around :

https://github.com/outline/outline/issues/1881#issuecomment-885604774 https://github.com/outline/outline/issues/1881#issuecomment-885217828

vicalloy commented 2 years ago

I created a simple oidc server oidc-server to support authentication, and used in my self-host project outline-docker-compose.

benjaminhaeberli commented 2 years ago

I am also waiting for email authentication to switch from Notion to Outline 😇

proactive-kebab commented 2 years ago

Will you prioritize Sign in with TikTok over this?

umdstu commented 2 years ago

Will you prioritize Sign in with TikTok over this?

That's a thing? Gosh I feel old.

throrin19 commented 2 years ago

Outline seems nice but We can't easilly made this as self hosted. In our case we need and email authentication. It's bad to force use google (over google cloud, not with SAML application ?!) or slack but many of tiny enterprises or other users have no slack part or google workspace.

I've try to configure gitlab but I have an empty outline connection page :

image

almereyda commented 2 years ago

@throrin19 Would you like to create a separate GitHub discussion about your OpenID configuration issue?

That way we can reduce the noise here, and keep this issue around to the original subject.

Quick emoji reactions are also a great way to support previous statements in a conversation that equal yours.

badihi commented 2 years ago

I'm sorry, but having no local authentication is SILLY! So silly that I feel it is done deliberately to discourage using self hosted versions. Or maybe Slack is your sponsor?!