diff --git a/.gitignore b/.gitignore index 166cceaa..8dc02ff1 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ Configuration.schema.json users_database.test.yml .suite +.kube diff --git a/.travis.yml b/.travis.yml index f71f06bc..debdccbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,18 +15,16 @@ addons: hosts: - admin.example.com - login.example.com - - single_factor.example.com + - singlefactor.example.com - dev.example.com - home.example.com - mx1.mail.example.com - mx2.mail.example.com - public.example.com + - secure.example.com - authelia.example.com - admin.example.com - -before_install: -- npm install -g npm@'>=2.13.5' -- pushd client && npm install && popd + - mail.example.com before_script: - export DISPLAY=:99.0 diff --git a/README.md b/README.md index 59107576..d98936e3 100644 --- a/README.md +++ b/README.md @@ -41,14 +41,18 @@ For more details about the features, follow [Features](./docs/features.md). ## Getting Started -If you want to quickly test Authelia with Docker, we recommend you read -[Getting Started](./docs/getting-started.md). +You can start off with + + source bootstrap.sh + +If you want to go further, please read [Getting Started](./docs/getting-started.md). ## Deployment -Now that you have tested **Authelia** and you want to try it out in your own infrastructure, you can learn how to deploy and use it with -[Deployment](./docs/deployment-production.md). This guide will show you how to deploy -it on bare metal as well as on Kubernetes. +Now that you have tested **Authelia** and you want to try it out in your own infrastructure, +you can learn how to deploy and use it with [Deployment](./docs/deployment-production.md). +This guide will show you how to deploy it on bare metal as well as on +[Kubernetes](https://kubernetes.io/). ## Security diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 00000000..4c92e6a5 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,49 @@ + +export PATH=$(pwd)/scripts:/tmp:$PATH + +export PS1="(authelia) $PS1" + +echo "[BOOTSTRAP] Installing npm packages..." +npm i + +pushd client +npm i +popd + +echo "[BOOTSTRAP] Checking if Docker is installed..." +if [ ! -x "$(command -v docker)" ]; +then + echo "[ERROR] You must install docker on your machine."; + return +fi + +echo "[BOOTSTRAP] Checking if docker-compose is installed..." +if [ ! -x "$(command -v docker-compose)" ]; +then + echo "[ERROR] You must install docker-compose on your machine."; + return; +fi + +echo "[BOOTSTRAP] Checking if example.com domain is forwarded to your machine..." +cat /etc/hosts | grep "login.example.com" > /dev/null +if [ $? -ne 0 ]; +then + echo "[ERROR] Please add those lines to /etc/hosts: + +127.0.0.1 home.example.com +127.0.0.1 public.example.com +127.0.0.1 secure.example.com +127.0.0.1 dev.example.com +127.0.0.1 admin.example.com +127.0.0.1 mx1.mail.example.com +127.0.0.1 mx2.mail.example.com +127.0.0.1 singlefactor.example.com +127.0.0.1 login.example.com" + return; +fi + +echo "[BOOTSTRAP] Running additional bootstrap steps..." +authelia-scripts bootstrap + +echo "[BOOTSTRAP] Run 'authelia-scripts suites start dockerhub' to start Authelia and visit https://home.example.com:8080." +echo "[BOOTSTRAP] More details at https://github.com/clems4ever/authelia/blob/master/docs/getting-started.md" diff --git a/client/src/App.tsx b/client/src/App.tsx index f35684a4..fa17b1f6 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -3,14 +3,14 @@ import './App.scss'; import { Route, Switch } from "react-router-dom"; import { routes } from './routes/index'; -import { createBrowserHistory } from 'history'; +import { createHashHistory } from 'history'; import { createStore, applyMiddleware, compose } from 'redux'; import reducer from './reducers'; import { Provider } from 'react-redux'; import thunk from 'redux-thunk'; import { routerMiddleware, ConnectedRouter } from 'connected-react-router'; -const history = createBrowserHistory(); +const history = createHashHistory(); const store = createStore( reducer(history), compose( diff --git a/client/src/behaviors/SafelyRedirectBehavior.ts b/client/src/behaviors/SafelyRedirectBehavior.ts deleted file mode 100644 index 0d683456..00000000 --- a/client/src/behaviors/SafelyRedirectBehavior.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Dispatch } from "redux"; -import * as AutheliaService from '../services/AutheliaService'; - -export default async function(url: string) { - try { - // Check the url against the backend before redirecting. - await AutheliaService.checkRedirection(url); - window.location.href = url; - } catch (e) { - console.error( - 'Cannot redirect since the URL is not in the protected domain.' + - 'This behavior could be malicious so please the issue to an administrator.'); - throw e; - } -} \ No newline at end of file diff --git a/client/src/components/AlreadyAuthenticated/AlreadyAuthenticated.tsx b/client/src/components/AlreadyAuthenticated/AlreadyAuthenticated.tsx index d73d636d..6b1d549a 100644 --- a/client/src/components/AlreadyAuthenticated/AlreadyAuthenticated.tsx +++ b/client/src/components/AlreadyAuthenticated/AlreadyAuthenticated.tsx @@ -7,7 +7,7 @@ import CircleLoader, { Status } from "../CircleLoader/CircleLoader"; export interface OwnProps { username: string; - redirectionUrl: string; + redirectionUrl: string | null; } export interface DispatchProps { @@ -27,7 +27,7 @@ class AlreadyAuthenticated extends Component {
- {this.props.redirectionUrl} + {(this.props.redirectionUrl) ? {this.props.redirectionUrl} : null}