Skip to content
2023 API Summit Hackathon: Experiment with AI for APIs (August 28 - September 27) Learn More →
Kong Logo | Kong Docs Logo
search
  • We're Hiring!
  • Docs
    • Kong Gateway
      Lightweight, fast, and flexible cloud-native API gateway
      Kong Konnect
      Single platform for SaaS end-to-end connectivity
      Kong Mesh
      Enterprise service mesh based on Kuma and Envoy
      decK
      Helps manage Kong’s configuration in a declarative fashion
      Kong Ingress Controller
      Works inside a Kubernetes cluster and configures Kong to proxy traffic
      Insomnia
      Collaborative API development platform
      Kuma
      Open-source distributed control plane with a bundled Envoy Proxy integration
      Docs Contribution Guidelines
      Want to help out, or found an issue in the docs and want to let us know?
  • API Specs
  • Plugin Hub
    • Explore the Plugin Hub
      View all plugins View all plugins View all plugins arrow image
    • Functionality View all View all arrow image
      View all plugins
      Authentication's icon
      Authentication
      Protect your services with an authentication layer
      Security's icon
      Security
      Protect your services with additional security layer
      Traffic Control's icon
      Traffic Control
      Manage, throttle and restrict inbound and outbound API traffic
      Serverless's icon
      Serverless
      Invoke serverless functions in combination with other plugins
      Analytics & Monitoring's icon
      Analytics & Monitoring
      Visualize, inspect and monitor APIs and microservices traffic
      Transformations's icon
      Transformations
      Transform request and responses on the fly on Kong
      Logging's icon
      Logging
      Log request and response data using the best transport for your infrastructure
  • Support
  • Community
  • Kong Academy
Get a Demo Start Free Trial
Kong Gateway
3.3.x
  • Home icon
  • Kong Gateway
  • Production Deployment
  • Access Control
  • Start Kong Gateway Securely
github-edit-pageEdit this page
report-issueReport an issue
  • Kong Gateway
  • Kong Konnect
  • Kong Mesh
  • Plugin Hub
  • decK
  • Kong Ingress Controller
  • Insomnia
  • Kuma

  • Docs contribution guidelines
  • 3.4.x (latest)
  • 3.3.x
  • 3.2.x
  • 3.1.x
  • 3.0.x
  • 2.8.x
  • 2.7.x
  • 2.6.x
  • Archive (pre-2.6)
enterprise-switcher-icon Switch to OSS
On this pageOn this page
  • Prerequisites
  • Step 1
  • Step 2
  • Step 3
  • Step 4
You are browsing documentation for an outdated version. See the latest documentation here.

Start Kong Gateway Securely

To secure the Admin API or Kong Manager, a Super Admin account is required.

The Super Admin has the ability to invite other Admins and restrict their access based on Permissions of Roles within Workspaces.

The first Super Admin account is created during database migrations following the guide below. It may only be added once.

Prerequisites

After installing Kong Gateway, either modify the configuration file or set environment variables for the following properties:

  • enforce_rbac will force all Admin API requests to require a Kong-Admin-Token. The Admin associated with the Kong-Admin-Token must have adequate Permissions in order for the request to succeed.

  • If using Kong Manager, select the type of authentication that Admins should use to log in. For the purpose of this guide, admin_gui_auth may be set to basic-auth. See Securing Kong Manager for other types of authentication.

Configure RBAC with basic authentication:

Important: The settings below are intended for non-production use only, as they override the default admin_listen setting to listen for requests from any source. Do not use these settings in environments directly exposed to the internet.


If you need to expose the admin_listen port to the internet in a production environment,

secure it with authentication.

enforce_rbac = on
admin_gui_auth = basic-auth
admin_gui_session_conf = {"secret":"secret","storage":"kong","cookie_secure":false}
admin_listen = 0.0.0.0:8001, 0.0.0.0:8444 ssl

Kong Manager uses the Sessions plugin in the background. This plugin (configured with admin_gui_session_conf) requires a secret and is configured securely by default.

  • Under all circumstances, the secret must be manually set to a string.
  • If using HTTP instead of HTTPS, cookie_secure must be manually set to false.
  • If using different domains for the Admin API and Kong Manager, cookie_same_site must be set to Lax.

Learn more about these properties in Session Security in Kong Manager, and see example configurations.

Step 1

Set a password for the Super Admin. This environment variable must be present in the environment where database migrations will run.

Important: Setting your Kong password (KONG_PASSWORD) using a value containing four ticks (for example, KONG_PASSWORD="a''a'a'a'a") causes a PostgreSQL syntax error on bootstrap. To work around this issue, do not use special characters in your password.

export KONG_PASSWORD=<password-only-you-know>

This automatically creates a user, kong_admin, and a password that can be used to log in to Kong Manager. This password may also be used as a Kong-Admin-Token to make Admin API requests.

Note: only one Super Admin may be created using this method, and only on a fresh installation with an empty database. If one is not created during migrations, follow this guide to remediate.

Future migrations will not update the password or create additional Super Admins. To add additional Super Admins it is necessary to invite a new user as a Super Admin in Kong Manager.

Step 2

Issue the following command to prepare your data store by running the Kong migrations:

kong migrations bootstrap [-c /path/to/kong.conf]

Step 3

Start Kong:

kong start [-c /path/to/kong.conf]

Note: the CLI accepts a configuration option (-c /path/to/kong.conf) allowing you to point to your own configuration.

Step 4

To test that Kong Gateway has successfully started with a Super Admin, visit Kong Manager’s URL. By default, it is on port :8002.

The username is kong_admin and the password is the one set in Step 1.

Thank you for your feedback.
Was this page useful?
Too much on your plate? close cta icon
More features, less infrastructure with Kong Konnect. 1M requests per month for free.
Try it for Free
  • Kong
    THE CLOUD CONNECTIVITY COMPANY

    Kong powers reliable digital connections across APIs, hybrid and multi-cloud environments.

    • Company
    • Customers
    • Events
    • Investors
    • Careers Hiring!
    • Partners
    • Press
    • Contact
  • Products
    • Kong Konnect
    • Kong Gateway
    • Kong Mesh
    • Get Started
    • Pricing
  • Resources
    • eBooks
    • Webinars
    • Briefs
    • Blog
    • API Gateway
    • Microservices
  • Open Source
    • Install Kong Gateway
    • Kong Community
    • Kubernetes Ingress
    • Kuma
    • Insomnia
  • Solutions
    • Decentralize
    • Secure & Govern
    • Create a Dev Platform
    • API Gateway
    • Kubernetes
    • Service Mesh
Star
  • Terms•Privacy
© Kong Inc. 2023