Giter VIP home page Giter VIP logo

infra's Introduction

logo

Infra provides authentication and access management to servers, clusters, and databases.

Getting Started

macOS

brew install infrahq/tap/infra

Windows

scoop bucket add infrahq https://github.com/infrahq/scoop.git
scoop install infra

Linux

Download the latest packages from GitHub and install it with dpkg, apt, rpm, or dnf.

sudo dpkg -i infra_*.deb

sudo apt install ./infra_*.deb

sudo rpm -i infra-*.rpm

sudo dnf install infra-*.rpm

Create an access key

Log in to Infra. If you don't have a self-hosted Infra configured, you can sign up for a free Infra instance to get started.

Set the INFRA_SERVER variable to your Infra URL:

export INFRA_SERVER=<org>.infrahq.com
infra login

You'll be prompted for the Infra URL you created when you signed up. (e.g. <org>.infrahq.com).

Then, create an access key:

INFRA_ACCESS_KEY=$(infra keys add --connector -q)

Connect Kubernetes cluster

Install Infra connector via helm:

helm repo add infrahq https://infrahq.github.io/helm-charts
helm repo update
helm install infra infrahq/infra --set config.server.url=$INFRA_SERVER --set config.accessKey=$INFRA_ACCESS_KEY --set config.name=example

Access your cluster

Give yourself permission to access the cluster:

infra grants add <your user email> example --role view

Use infra list to verify access.

Run kubectl to switch to your newly connected cluster.

kubectl config use-context infra:example

Alternatively, you can switch clusters via infra use command.

infra use example

Lastly, try running a command on the Kubernetes cluster:

kubectl get pods -A

Next steps

Congratulations. You've successfully connected your first cluster.

Infra works best when used with a team. Next, configure how users authenticate by connecting an identity provider, or add users directly by inviting them.

Community

  • Community Forum Best for: help with building, discussion about infrastructure access best practices.
  • GitHub Issues Best for: bugs and errors you encounter using Infra.

infra's People

Contributors

brucemacd avatar cr1cr1 avatar dependabot[bot] avatar dkulchinsky avatar dnephin avatar fsdaniel avatar fsha avatar hemachandarv avatar hoyyeva avatar infrahq-ci avatar j-sneh avatar jmorganca avatar kimskimchi avatar mchiang0610 avatar mugli avatar mxyng avatar pdevine avatar ssoroka avatar technovangelist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

infra's Issues

Helm Chart

Add a helm chart for installing Infra (both server and per-cluster engine).

Helm charts will provide several benefits for the setup experience:

  • Install in one line (e.g. helm install infra)
  • Ability to upgrade / cleanup all resources in one go
  • Runtime flags vs editing yaml files (e.g. helm install infra --set engine=true --set server=infra.example.com --set token=n8ap78n1p27dn127dn91
  • Waiting & output so users know what to to do next. For example:
$ helm repo add infrahq https://helm.infrahq.com
$ helm install infra infrahq/infra

Waiting for load balanacer to be ready...

Run "infra login 35.181.19.128" to continue

infra user create should prompt for password rather than taking it as an argument

If the admin creates a user the password they specify is preserved in their command history. We should prompt for the password separately similarly to the initial admin flow.

Proposed flow:

$ infra user create [email protected]
? Password *********
✓ User created

Another option to remove all personal info from the command history:

$ infra user create
? Email [email protected]
? Password *********
✓ User created

Groups

Group support. For IDPs that support groups, groups should be synchronized into Infra.

Per-field API errors

Currently the API only returns a single error string. It should return a series of errors for endpoints with multiple parameters.

Option to limit Lets Encrypt certifcates to specific domain

Currently, Infra will generate certificates for any domain verified by ACME. However, this can lead to a denial of service if users continually try different domains for the same Infra registry.

Infra should support limiting certificate generation to a specific domain.

CLI Flag

infra registry --domain=infra.example.com

Tip: the domain would need to be provided to the autocert manager https://github.com/infrahq/infra/blob/main/internal/registry/registry.go#L134

Token formats

Currently, infra already supports two kinds of tokens to authenticate with infra registry, and the grpc interceptor (middleware) authenticates based on the length of the token. This is poor practice and is not backwards compatible.

The two kinds of tokens currently used to authenticate with Infra Registry:

  • token: a random string of length 36 (12 bytes for ID, 24 bytes for secret ID) – to be used by Infra CLI to log in and generate short-lived credentials, and later the Web Client, etc.
  • apikey: a random string of length 24 – to be used by infra engine to authenticate

Specific line where this occurs: https://github.com/infrahq/infra/blob/main/internal/registry/grpc.go#L81

Instead, we should instead:

  • Strictly separate API endpoints used by Infra CLI (and later the Web UI) and Infra Engine
  • Adopt a backwards-compatible format for tokens and api keys (similar to GitHub)

Integration tests

Add integration tests to test interactions between the different components:

High-level areas to cover:

  • Registry <> Engine
  • CLI <> Registry
  • CLI <> Engine

Automatically detect cluster name

Currently, when installing the engine on a cluster, specifying a cluster name is required. However, for many clusters this can be determined automatically.

For cases where it can't be determined, we can use a fallback that can later be edited by users.

Example of how DataDog does this: DataDog/datadog-agent#8225

Pin self-signed certificates on first login

Currently, users need to pass -i or --insecure to every command if using self-signed certs. Instead, we should allow them to verify and pin a certificate, similar as browsers. This is exactly what logging into a node via ssh does as well.

$ infra login infra.example.com
Cannot verify certificate (fingerprint: 18:40:a9:b8:1c:18:40:a9:b8:1c:18:40:a9:b8:1c)
Are you sure you want to continue connecting (yes/no)? yes

Automatically re-prompt login

When a user's session with Infra server expires, they should be automatically prompted (via kubectl or infra commands) automatically to re-log in.

Login method should not be added list of valid sources if the create command fails

Expected behavior:
If the infra source create command fails the source is not added to the list of available sources.

Current behavior:
If the infra source create command returns an error on an rpc call the source is still added to the list of available sources.

Ex:

$ infra source create okta \
    --api-token AAA \
    --domain dev-123456-admin.okta.com \
    --client-id BBB \
    --client-secret CCC
Error: rpc error: code = Unknown desc = your Okta domain should not contain -admin. Current value: https://dev-123456-admin.okta.com. You can copy your domain from the Okta Developer Console. Follow these instructions to find it: https://bit.ly/finding-okta-domain

$  infra login localhost

Could not verify certificate for host localhost
? Are you sure you want to continue (yes/no)? Yes
? Choose a login method:  [Use arrows to move, type to filter]
> Okta [dev-123456.okta.com]
  Okta [example.okta.com]
  Okta [dev-123456-admin.okta.com]
  Username & password

dev-123456-admin.okta.com should not have been added.

Infra Login Fails 1/2 times

Not sure what is causing this yet, for about every 1 in 3 Okta authentications my log in fails with an rpc error after a callback with the code.

$ infra login localhost

Could not verify certificate for host localhost
? Are you sure you want to continue (yes/no)? Yes

Welcome to Infra. Get started by creating your admin user:
? Email [email protected]
? Password *********
✓ Creating admin user...
✓ Logged in
✓ Kubeconfig updated

$ infra login localhost

Could not verify certificate for host localhost
? Are you sure you want to continue (yes/no)? Yes
? Email [email protected]
? Password *********
✓ Logging in with username & password...
✓ Logged in
Error: rpc error: code = Unauthenticated desc = unauthorized

$ infra login localhost

Could not verify certificate for host localhost
? Are you sure you want to continue (yes/no)? Yes
? Email [email protected]
? Password *********
✓ Logging in with username & password...
✓ Logged in

$ infra login localhost

Could not verify certificate for host localhost
? Are you sure you want to continue (yes/no)? Yes
? Email [email protected]
? Password *********
✓ Logging in with username & password...
✓ Logged in
Error: rpc error: code = Unauthenticated desc = unauthorized

Filter infra resources

Infra should be hidden from end-users when connecting to a cluster via Infra.

This will help users in two ways:

  1. Infra will be invisible to end-users connecting via kubectl
  2. It will stop users from accidentally deleting or modifying infra - creating a chicken & egg problem to reconnect

A few alternative ideas:

  1. Remove infra resources from any rbac rules provided by infra – this will solve point number 2. above
  2. Put infra in the kube-system namespace, where these kinds of tools usually live

Sign binaries & docker images

Currently, published binaries and Docker images are unsigned. To help customers verify their integrity we should sign them:

  • Binaries: sign with goreleaser (see this)
  • Docker: sign with Docker Content Trust

infra version command

For debugging and upgrading users should be able to check which version of infra they have

$ infra version
0.1.0

Some example Go projects with versioning:

A stretch goal: Infra also attempts to contact the current server and prints what version the server is running:

$ infra version
Client: 0.1.0
Server: 0.1.0

infra.yaml permissions revokes database permissions on first load

Currently, specifying permissions via -c infra.yaml will revoke existing permissions that aren't specified in the config file. Instead, it should only replace permissions previously specified in the config, and overlay this with permissions managed via the API.

Live config updates

Currently a kubectl rollout restart -n infra deployment/infra is required to update a config - this isn't obvious to users. Infra should watch the config file and automatically apply it on the fly.

Sign up on first login

For new installs, we should allow users to sign up as the first admin. This will help first time setups. For security, this needs to be easy to disable via a command line flag or config file.

An alternative would be to print a randomly generated password – but this would require addl' copying from the user, and some might miss it or clear their terminal, leaving Infra locked.

Homebrew tap

Installing CLI tools on Mac is best done via brew. This way, users on macOS can install the infra CLI via brew install infrahq/tap/infra

Require password confirmation on user registration

When a user sets their password (either the initial admin login or subsequent user creation) they should be required to confirm their password before the user is created/updated. If the password and confirmation do not match the user should be required to re-type both fields (repeat this state until they match).

Easy Okta integration

Currently users need to set up Okta manually and provide infra four values:

  • Client ID
  • Client Secret
  • Api token <- especially hard to generate, requires creating a user, scoping access and logging in as them
  • Domain

an alternative would be to programatically create the Okta app via an Api Token:

$ infra providers create --okta --okta-api-token=xxxxxxx --okta-domain=example.okta.com

Benefits:

  • No extra read-only user (can use Okta's machine to machine identity - only available via their API)
  • One command

Downsides:

  • "Magic" - less visibility for teams who want to configure Okta manually.

Better input for "infra users create"

Currently users need to provide a password as an argument: infra users create EMAIL PASSWORD

If a parameter is not specified we should interactively ask for a password:

$ infra users create
? Email [email protected]
? Password *****************

Custom CLI help with categorized commands

Currently, all commands are shown in one big list:

Infrastructure Identity & Access Management (IAM)

Usage:
  infra [command]

Available Commands:
  list        List resources
  grant       Grant access to a resource
  revoke      Revoke access to a resource
  inspect     Inspect access for a resource or user
  users       Manage users
  providers   Manage identity providers
  login       Log in to Infra server
  logout      Log out of Infra server
  server      Start Infra server
  engine      Start Infra engine
  help        Help about any command

However this makes it difficult to discover related or advanced commands. Many CLI tools like kubectl, gh and docker properly separate commands to help discovery & organization. For example with gh:

Work seamlessly with GitHub from the command line.

USAGE
  gh <command> <subcommand> [flags]

CORE COMMANDS
  gist:       Manage gists
  issue:      Manage issues
  pr:         Manage pull requests
  release:    Manage GitHub releases
  repo:       Create, clone, fork, and view repositories

ACTIONS COMMANDS
  actions:    Learn about working with GitHub actions
  run:        View details about workflow runs
  workflow:   View details about GitHub Actions workflows

ADDITIONAL COMMANDS
  alias:      Create command shortcuts
  api:        Make an authenticated GitHub API request
  auth:       Login, logout, and refresh your authentication
  completion: Generate shell completion scripts
  config:     Manage configuration for gh
  help:       Help about any command
  secret:     Manage GitHub secrets
  ssh-key:    Manage SSH keys

FLAGS
  --help      Show help for command
  --version   Show gh version

EXAMPLES
  $ gh issue create
  $ gh repo clone cli/cli
  $ gh pr checkout 321

ENVIRONMENT VARIABLES
  See 'gh help environment' for the list of supported environment variables.

LEARN MORE
  Use 'gh <command> <subcommand> --help' for more information about a command.
  Read the manual at https://cli.github.com/manual

FEEDBACK
  Open an issue using 'gh issue create -R github.com/cli/cli'

Logging into Okta using Google does not send response code to Infra

Reproduction Steps:

  1. Create an Okta account that is linked to a Google account
  2. Sign out of the Okta portal
  3. Run infra login $HOST
  4. At the Okta login screen select Need help signing in? > Sign in with Google
  5. Authenticate with Google
  6. After logging in the response is not sent to the Infra client and it just waits forever
$ infra login localhost

Could not verify certificate for host localhost
? Are you sure you want to continue (yes/no)? Yes
? Choose a login method: Okta [dev-50966300.okta.com]
✓ Logging in with Okta...

Note:
I'll test this with a non-Google login flow too to make sure that is actually working as expected.

Automatically generate infrahq.dev domain for new installations

Currently, when setting up Infra for the first time, users need to choose between:

  1. Trusting self-signed certificates (skipping TLS verification)
  2. Assigning a domain name to their cluster

As a free service, Infra could provision a dev domain for the customer, for example:

<Random ID>.infrahq.dev -> 35.18.29.192

This would enable them to use Infra securely until they can assign their own domain name.

Namespace permissions

Currently, Infra can only map permissions to cluster-wide roles. Customers require the ability to map users to namespace-specific roles. For example:

# example infra.yaml

permissions:
  - user: [email protected]
    role: edit
    destination: production
    namespace: frontend       # Additional namespace key

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.