Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
Signed-off-by: Rajesh Jonnalagadda <[email protected]>
  • Loading branch information
rajesh-jonnalagadda authored Oct 1, 2024
2 parents 153a40a + 6cbfeca commit 611d8a4
Show file tree
Hide file tree
Showing 38 changed files with 1,413 additions and 504 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ tempo-data/
# docs
docs/node_modules/

oauth2.cfg


scripts/automatic_extraction_rules.py

Expand All @@ -209,3 +211,4 @@ ee/experimental/ai_temp/*

oauth2.cfg
scripts/keep_slack_bot.py
keepnew.db
32 changes: 32 additions & 0 deletions docs/deployment/authentication/oauth2proxy-auth.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: "OAuth2Proxy Authentication"
---

Delegate authentication to Oauth2Proxy.


### When to Use

- **oauth2-proxy user:** Use this authentication method if you want to delegate authentication to an external Oauth2Proxy service.

### Setup Instructions

To start Keep with Oauth2Proxy authentication, set the following environment variables:

#### Frontend Environment Variables

| Environment Variable | Description | Required | Default Value |
|--------------------|-----------|:--------:|:-------------:|
| AUTH_TYPE | Set to 'OAUTH2PROXY' for OAUTH2PROXY authentication | Yes | - |

#### Backend Environment Variables

| Environment Variable | Description | Required | Default Value |
|--------------------|-----------|:--------:|:-------------:|
| AUTH_TYPE | Set to 'OAUTH2PROXY' for OAUTH2PROXY authentication | Yes | - |
| KEEP_OAUTH2_PROXY_USER_HEADER | Header for the authenticated user's email | Yes | x-forwarded-email |
| KEEP_OAUTH2_PROXY_ROLE_HEADER | Header for the authenticated user's role | Yes | x-forwarded-groups |
| KEEP_OAUTH2_PROXY_AUTO_CREATE_USER | Automatically create user if not exists | No | true |
| KEEP_OAUTH2_PROXY_ADMIN_ROLE | Role name for admin users | No | admin |
| KEEP_OAUTH2_PROXY_NOC_ROLE | Role name for NOC (Network Operations Center) users | No | noc |
| KEEP_OAUTH2_PROXY_WEBHOOK_ROLE | Role name for webhook users | No | webhook |
14 changes: 8 additions & 6 deletions docs/deployment/authentication/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ Choosing the right authentication strategy depends on your specific use case, se

### Authentication Features Comparison

| Identity Provider | RBAC | SAML/OIDC | SSO | LDAP | Resource-based permission | User Management | Group Management | On Prem | License |
|:---:|:----:|:---------:|:---:|:----:|:-------------------------:|:----------------:|:-----------------:|:-------:|:-------:|
| **No Auth** ||||||||| **OSS** |
| **DB** | ✅ <br />(Predefiend roles) |||||||| **OSS** |
| **Auth0** | ✅ <br />(Predefiend roles) ||| 🚧 | 🚧 || 🚧 || **EE** |
| **Keycloak** | ✅ <br />(Custom roles) |||||||| **EE** |
| Identity Provider | RBAC | SAML/OIDC/SSO | LDAP | Resource-based permission | User Management | Group Management | On Prem | License |
|:---:|:----:|:---------:|:----:|:-------------------------:|:----------------:|:-----------------:|:-------:|:-------:|
| **No Auth** |||||||| **OSS** |
| **DB** | ✅ <br />(Predefiend roles) ||||||| **OSS** |
| **Auth0** | ✅ <br />(Predefiend roles) || 🚧 | 🚧 || 🚧 || **EE** |
| **Keycloak** | ✅ <br />(Custom roles) ||||||| **EE** |
| **Oauth2Proxy** | ✅ <br />(Predefiend roles) |||| N/A | N/A || **OSS** |
### How To Configure
<Tip>
Some authentication providers require additional environment variables. These will be covered in detail on the specific authentication provider pages.
Expand All @@ -39,5 +40,6 @@ The authentication scheme on Keep is controlled with environment variables both
| **DB** | `AUTH_TYPE=DB` | `KEEP_JWT_SECRET` |
| **Auth0** | `AUTH_TYPE=AUTH0` | `AUTH0_DOMAIN`, `AUTH0_CLIENT_ID`, `AUTH0_CLIENT_SECRET` |
| **Keycloak** | `AUTH_TYPE=KEYCLOAK` | `KEYCLOAK_URL`, `KEYCLOAK_REALM`, `KEYCLOAK_CLIENT_ID`, `KEYCLOAK_CLIENT_SECRET` |
| **Oauth2Proxy** | `AUTH_TYPE=OAUTH2PROXY` | `OAUTH2_PROXY_USER_HEADER`, `OAUTH2_PROXY_ROLE_HEADER`, `OAUTH2_PROXY_AUTO_CREATE_USER` |

For more details on each authentication strategy, including setup instructions and implications, refer to the respective sections.
3 changes: 2 additions & 1 deletion docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"deployment/authentication/no-auth",
"deployment/authentication/db-auth",
"deployment/authentication/auth0-auth",
"deployment/authentication/keycloak-auth"
"deployment/authentication/keycloak-auth",
"deployment/authentication/oauth2proxy-auth"
]
},
{
Expand Down
15 changes: 15 additions & 0 deletions examples/workflows/incident_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
workflow:
id: aks-example
description: aks-example
triggers:
- type: incident
events:
- updated
- created

actions:
- name: just-echo
provider:
type: console
with:
message: "Hey there! I am an incident!"
6 changes: 3 additions & 3 deletions keep-ui/app/alerts/alert-name.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ export default function AlertName({
}

return (
<div className="flex items-center justify-between">
<div className="truncate" title={alert.name}>
<div className="flex items-start justify-between">
<div className="truncate whitespace-pre-wrap" title={alert.name}>
{name}
</div>
<div>
<div className="flex-shrink-0">
{(url ?? generatorURL) && (
<a href={url || generatorURL} target="_blank">
<Icon
Expand Down
161 changes: 161 additions & 0 deletions keep-ui/app/incidents/[id]/incident-workflow-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
import { Fragment } from "react";
import { Dialog, Transition } from "@headlessui/react";
import { Text, Button, TextInput, Badge, Title, Card } from "@tremor/react";
import { IoMdClose } from "react-icons/io";
import { WorkflowExecution } from "app/workflows/builder/types";
import {
getIcon,
getTriggerIcon,
extractTriggerValue,
} from "app/workflows/[workflow_id]/workflow-execution-table";
import { useWorkflowExecution } from "utils/hooks/useWorkflowExecutions";

interface IncidentWorkflowSidebarProps {
isOpen: boolean;
toggle: VoidFunction;
selectedExecution: WorkflowExecution;
}

const IncidentWorkflowSidebar: React.FC<IncidentWorkflowSidebarProps> = ({
isOpen,
toggle,
selectedExecution,
}) => {
const { data: workflowExecutionData } = useWorkflowExecution(
selectedExecution.workflow_id,
selectedExecution.id
);

return (
<Transition appear show={isOpen} as={Fragment}>
<Dialog onClose={toggle}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black/30 z-20" aria-hidden="true" />
</Transition.Child>
<Transition.Child
as={Fragment}
enter="transition ease-in-out duration-300 transform"
enterFrom="translate-x-full"
enterTo="translate-x-0"
leave="transition ease-in-out duration-300 transform"
leaveFrom="translate-x-0"
leaveTo="translate-x-full"
>
<Dialog.Panel className="fixed right-0 inset-y-0 w-2/4 bg-white z-30 p-6 overflow-auto flex flex-col">
<div className="flex justify-between mb-4">
<div>
<Dialog.Title className="text-3xl font-bold" as={Title}>
Workflow Execution Details
<Badge
className="ml-4 capitalize"
color={
selectedExecution.status === "error"
? "red"
: selectedExecution.status === "success"
? "green"
: "orange"
}
>
{selectedExecution.status}
</Badge>
</Dialog.Title>
</div>
<div>
<Button onClick={toggle} variant="light">
<IoMdClose className="h-6 w-6 text-gray-500" />
</Button>
</div>
</div>

<div className="flex-grow space-y-4">
<Card>
<div className="space-y-4">
<div>
<Text className="block text-sm font-medium text-gray-700 mb-2">
Execution ID
</Text>
<TextInput value={selectedExecution.id} readOnly />
</div>
<div>
<Text className="block text-sm font-medium text-gray-700 mb-2">
Status
</Text>
<div className="flex items-center">
{getIcon(selectedExecution.status)}
<span className="ml-2 capitalize">
{selectedExecution.status}
</span>
</div>
</div>
<div>
<Text className="block text-sm font-medium text-gray-700 mb-2">
Triggered By
</Text>
<Button
className="px-3 py-0.5 bg-white text-black rounded-xl border-2 border-gray-400 inline-flex items-center gap-2 font-bold hover:bg-white border-gray-400"
variant="secondary"
tooltip={selectedExecution.triggered_by ?? ""}
icon={getTriggerIcon(
extractTriggerValue(selectedExecution.triggered_by)
)}
>
<div>
{extractTriggerValue(selectedExecution.triggered_by)}
</div>
</Button>
</div>
<div>
<Text className="block text-sm font-medium text-gray-700 mb-2">
Execution Time
</Text>
<TextInput
value={
selectedExecution.execution_time
? `${selectedExecution.execution_time} seconds`
: "N/A"
}
readOnly
/>
</div>
<div>
<Text className="block text-sm font-medium text-gray-700 mb-2">
Started At
</Text>
<TextInput value={selectedExecution.started} readOnly />
</div>
</div>
</Card>

<Card>
<Text className="block text-sm font-medium text-gray-700 mb-2">
Execution Logs
</Text>
<div className="bg-gray-100 p-4 rounded-md overflow-auto max-h-96">
<pre className="whitespace-pre-wrap">
{Array.isArray(workflowExecutionData?.logs)
? workflowExecutionData.logs.map((log, index) => (
<div key={index}>
{log.timestamp} - {log.message}
</div>
))
: workflowExecutionData?.logs || "No logs available"}
</pre>
</div>
</Card>
</div>
</Dialog.Panel>
</Transition.Child>
</Dialog>
</Transition>
);
};

export default IncidentWorkflowSidebar;
Loading

0 comments on commit 611d8a4

Please sign in to comment.