provision

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

Provision service

Provision service provides an HTTP API to interact with Magistrala. Provision service is used to setup initial applications configuration i.e. things, channels, connections and certificates that will be required for the specific use case especially useful for gateway provision.

For gateways to communicate with Magistrala configuration is required (mqtt host, thing, channels, certificates...). To get the configuration gateway will send a request to Bootstrap service providing <external_id> and <external_key> in request. To make a request to Bootstrap service you can use Agent service on a gateway.

To create bootstrap configuration you can use Bootstrap or Provision service. Magistrala UI uses Bootstrap service for creating gateway configurations. Provision service should provide an easy way of provisioning your gateways i.e creating bootstrap configuration and as many things and channels that your setup requires.

Also you may use provision service to create certificates for each thing. Each service running on gateway may require more than one thing and channel for communication. Let's say that you are using services Agent and Export on a gateway you will need two channels for Agent (data and control) and one for Export and one thing. Additionally if you enabled mtls each service will need its own thing and certificate for access to Magistrala. Your setup could require any number of things and channels this kind of setup we can call provision layout.

Provision service provides a way of specifying this provision layout and creating a setup according to that layout by serving requests on /mapping endpoint. Provision layout is configured in config.toml.

Configuration

The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values.

Variable Description Default
MG_PROVISION_LOG_LEVEL Service log level debug
MG_PROVISION_USER User (email) for accessing Magistrala user@example.com
MG_PROVISION_PASS Magistrala password user123
MG_PROVISION_API_KEY Magistrala authentication token
MG_PROVISION_CONFIG_FILE Provision config file config.toml
MG_PROVISION_HTTP_PORT Provision service listening port 9016
MG_PROVISION_ENV_CLIENTS_TLS Magistrala SDK TLS verification false
MG_PROVISION_SERVER_CERT Magistrala gRPC secure server cert
MG_PROVISION_SERVER_KEY Magistrala gRPC secure server key
MG_PROVISION_USERS_LOCATION Users service URL http://users:9002
MG_PROVISION_THINGS_LOCATION Things service URL http://things:9000
MG_PROVISION_BS_SVC_URL Magistrala Bootstrap service URL http://bootstrap:9013/things
MG_PROVISION_BS_SVC_WHITELIST_URL Magistrala Bootstrap service whitelist URL http://bootstrap:9013/things/state
MG_PROVISION_CERTS_SVC_URL Certificates service URL http://certs:9019/certs
MG_PROVISION_X509_PROVISIONING Should X509 client cert be provisioned false
MG_PROVISION_BS_CONFIG_PROVISIONING Should thing config be saved in Bootstrap service true
MG_PROVISION_BS_AUTO_WHITELIST Should thing be auto whitelisted true
MG_PROVISION_BS_CONTENT Bootstrap service configs content, JSON format {}
MG_PROVISION_CERTS_RSA_BITS Certificate RSA bits parameter 4096
MG_PROVISION_CERTS_HOURS_VALID Number of hours that certificate is valid "2400h"
MG_SEND_TELEMETRY Send telemetry to magistrala call home server true

By default, call to /mapping endpoint will create one thing and two channels (control and data) and connect it. If there is a requirement for different provision layout we can use config file in addition to environment variables.

For the purposes of running provision as an add-on in docker composition environment variables seems more suitable. Environment variables are set in .env.

Configuration can be specified in config.toml. Config file can specify all the settings that environment variables can configure and in addition /mapping endpoint provision layout can be configured.

In config.toml we can enlist array of things and channels that we want to create and make connections between them which we call provision layout.

Metadata can be whatever suits your needs except that at least one thing needs to have external_id (which is populated with value from request). Thing that has external_id will be used for creating bootstrap configuration which can be fetched with Agent. For channels metadata type is reserved for control and data which we use with Agent.

Example of provision layout below

[[things]]
  name = "thing"

  [things.metadata]
    external_id = "xxxxxx"


[[channels]]
  name = "control-channel"

  [channels.metadata]
    type = "control"

[[channels]]
  name = "data-channel"

  [channels.metadata]
    type = "data"

[[channels]]
  name = "export-channel"

  [channels.metadata]
    type = "data"

Authentication

In order to create necessary entities provision service needs to authenticate against Magistrala. To provide authentication credentials to the provision service you can pass it in an environment variable or in a config file as Magistrala user and password or as API token that can be issued on /users/tokens/issue.

Additionally users or API token can be passed in Authorization header, this authentication takes precedence over others.

  • username, password - (MG_PROVISION_USER, MG_PROVISION_PASSWORD in .env, mg_user, mg_pass in config.toml)
  • API Key - (MG_PROVISION_API_KEY in .env or config.toml)
  • Authorization: Bearer Token - request authorization header containing either users token.

Running

Provision service can be run as a standalone or in docker composition as addon to the core docker composition.

Standalone:

MG_PROVISION_BS_SVC_URL=http://localhost:9013/things \
MG_PROVISION_THINGS_LOCATION=http://localhost:9000 \
MG_PROVISION_USERS_LOCATION=http://localhost:9002 \
MG_PROVISION_CONFIG_FILE=docker/addons/provision/configs/config.toml \
build/magistrala-provision

Docker composition:

docker-compose -f docker/addons/provision/docker-compose.yml up

For the case that credentials or API token is passed in configuration file or environment variables, call to /mapping endpoint doesn't require Authentication header:

curl -s -S  -X POST  http://localhost:<MG_PROVISION_HTTP_PORT>/mapping  -H 'Content-Type: application/json' -d '{"external_id": "33:52:77:99:43", "external_key": "223334fw2"}'

In the case that provision service is not deployed with credentials or API key or you want to use user other than one being set in environment (or config file):

curl -s -S  -X POST  http://localhost:<MG_PROVISION_HTTP_PORT>/mapping -H "Authorization: Bearer <token|api_key>" -H 'Content-Type: application/json' -d '{"external_id": "<external_id>", "external_key": "<external_key>"}'

Or if you want to specify a name for thing different than in config.toml you can specify post data as:

{
  "name": "<name>",
  "external_id": "<external_id>",
  "external_key": "<external_key>"
}

Response contains created things, channels and certificates if any:

{
  "things": [
    {
      "id": "c22b0c0f-8c03-40da-a06b-37ed3a72c8d1",
      "name": "thing",
      "key": "007cce56-e0eb-40d6-b2b9-ed348a97d1eb",
      "metadata": {
        "external_id": "33:52:79:C3:43"
      }
    }
  ],
  "channels": [
    {
      "id": "064c680e-181b-4b58-975e-6983313a5170",
      "name": "control-channel",
      "metadata": {
        "type": "control"
      }
    },
    {
      "id": "579da92d-6078-4801-a18a-dd1cfa2aa44f",
      "name": "data-channel",
      "metadata": {
        "type": "data"
      }
    }
  ],
  "whitelisted": {
    "c22b0c0f-8c03-40da-a06b-37ed3a72c8d1": true
  }
}

Certificates

Provision service has /certs endpoint that can be used to generate certificates for things when mTLS is required:

  • users_token - users authentication token or API token
  • thing_id - id of the thing for which certificate is going to be generated
curl -s  -X POST  http://localhost:8190/certs -H "Authorization: Bearer <users_token>" -H 'Content-Type: application/json'   -d '{"thing_id": "<thing_id>", "ttl":"2400h" }'
{
  "thing_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XFUqU2QyZGUs7VPO0QOrekOtYb4LCrxNbEXyPGicX3f2YTbqDJEFYL0OR\n74PV1ly7cR/1dA8e8oH6/O3SQMwXdYXIRqhn1Wq1TGyXc4KYNe3o6CH8qFLo+fWR\nBq3T/MopS0coWGGcYY5sR5PQts8aPY9jp67W40UkfkFYV5dHEEaLttn7uJzjd1ug\n1Waj1VjypnqMKNcQ9xKQSl21mohVc+IXXPsgA16o51iIiVm4DAeXFp6ebUsIOWDY\nHOWYw75XYV7rn5TwY8Qusi2MTw5nUycCggEAB/45U0LW7ZGpks/aF/BeGaSWiLIG\nodBWUjRQ4w+Le/pTC8Ci9fiidxuCDH6TQbsUTGKOk7GsfncWHTQJogaMyO26IJ1N\nmYGgK2JJvs7PKyIkocPDVD/Yh0gIzQIE92ZdyXUT21pIYKDUB9e3p0fy/+E0pyeI\nsmsV8oaLr4tZRY1cMogI+pvtUUferbLQmZHhFd9X3m3RslR43Dl1qpYQyzE3x/a3\nWA2NJZbJhh+LiAKzqk7swXOqrTrmXuzLcjMG+T/3lizrbLLuKjQrf+eehlpw0db0\nHVVvkMLOP5ZH/ImkmvOZJY7xxup89VV7LD7TfMKwXafOrjMDdvTAYPtgxw==\n-----END RSA PRIVATE KEY-----\n"
}

Documentation

Overview

Package provision contains domain concept definitions needed to support Provision service feature, i.e. automate provision process.

Index

Constants

View Source
const (
	Active = 1
)

Variables

View Source
var (
	ErrUnauthorized             = errors.New("unauthorized access")
	ErrFailedToCreateToken      = errors.New("failed to create access token")
	ErrEmptyThingsList          = errors.New("things list in configuration empty")
	ErrThingUpdate              = errors.New("failed to update thing")
	ErrEmptyChannelsList        = errors.New("channels list in configuration is empty")
	ErrFailedChannelCreation    = errors.New("failed to create channel")
	ErrFailedChannelRetrieval   = errors.New("failed to retrieve channel")
	ErrFailedThingCreation      = errors.New("failed to create thing")
	ErrFailedThingRetrieval     = errors.New("failed to retrieve thing")
	ErrMissingCredentials       = errors.New("missing credentials")
	ErrFailedBootstrapRetrieval = errors.New("failed to retrieve bootstrap")
	ErrFailedCertCreation       = errors.New("failed to create certificates")
	ErrFailedBootstrap          = errors.New("failed to create bootstrap config")
	ErrFailedBootstrapValidate  = errors.New("failed to validate bootstrap config creation")
	ErrGatewayUpdate            = errors.New("failed to updated gateway metadata")
)

Functions

func Save

func Save(c Config, file string) error

Save - store config in a file.

Types

type Bootstrap

type Bootstrap struct {
	X509Provision bool                   `toml:"x509_provision" env:"MG_PROVISION_X509_PROVISIONING"      envDefault:"false"`
	Provision     bool                   `toml:"provision"      env:"MG_PROVISION_BS_CONFIG_PROVISIONING" envDefault:"true"`
	AutoWhiteList bool                   `toml:"autowhite_list" env:"MG_PROVISION_BS_AUTO_WHITELIST"      envDefault:"true"`
	Content       map[string]interface{} `toml:"content"`
}

Bootstrap represetns the Bootstrap config.

type Cert

type Cert struct {
	TTL string `json:"ttl" toml:"ttl" env:"MG_PROVISION_CERTS_HOURS_VALID" envDefault:"2400h"`
}

Cert represetns the certificate config.

type Config

type Config struct {
	LogLevel      string             `toml:"log_level" env:"MG_PROVISION_LOG_LEVEL" envDefault:"info"`
	File          string             `toml:"file"      env:"MG_PROVISION_CONFIG_FILE" envDefault:"config.toml"`
	Server        ServiceConf        `toml:"server"    mapstructure:"server"`
	Bootstrap     Bootstrap          `toml:"bootstrap" mapstructure:"bootstrap"`
	Things        []mgclients.Client `toml:"things"    mapstructure:"things"`
	Channels      []groups.Group     `toml:"channels"  mapstructure:"channels"`
	Cert          Cert               `toml:"cert"      mapstructure:"cert"`
	BSContent     string             `env:"MG_PROVISION_BS_CONTENT" envDefault:""`
	SendTelemetry bool               `env:"MG_SEND_TELEMETRY"           envDefault:"true"`
	InstanceID    string             `env:"MG_MQTT_ADAPTER_INSTANCE_ID" envDefault:""`
}

Config struct of Provision.

func Read

func Read(file string) (Config, error)

Read - retrieve config from a file.

type Gateway

type Gateway struct {
	Type            string `toml:"type" json:"type"`
	ExternalID      string `toml:"external_id" json:"external_id"`
	ExternalKey     string `toml:"external_key" json:"external_key"`
	CtrlChannelID   string `toml:"ctrl_channel_id" json:"ctrl_channel_id"`
	DataChannelID   string `toml:"data_channel_id" json:"data_channel_id"`
	ExportChannelID string `toml:"export_channel_id" json:"export_channel_id"`
	CfgID           string `toml:"cfg_id" json:"cfg_id"`
}

Gateway represetns the Gateway config.

type Result

type Result struct {
	Things      []sdk.Thing       `json:"things,omitempty"`
	Channels    []sdk.Channel     `json:"channels,omitempty"`
	ClientCert  map[string]string `json:"client_cert,omitempty"`
	ClientKey   map[string]string `json:"client_key,omitempty"`
	CACert      string            `json:"ca_cert,omitempty"`
	Whitelisted map[string]bool   `json:"whitelisted,omitempty"`
	Error       string            `json:"error,omitempty"`
}

Result represent what is created with additional info.

type Service

type Service interface {
	// Provision is the only method this API specifies. Depending on the configuration,
	// the following actions will can be executed:
	// - create a Thing based on external_id (eg. MAC address)
	// - create multiple Channels
	// - create Bootstrap configuration
	// - whitelist Thing in Bootstrap configuration == connect Thing to Channels
	Provision(token, name, externalID, externalKey string) (Result, error)

	// Mapping returns current configuration used for provision
	// useful for using in ui to create configuration that matches
	// one created with Provision method.
	Mapping(token string) (map[string]interface{}, error)

	// Certs creates certificate for things that communicate over mTLS
	// A duration string is a possibly signed sequence of decimal numbers,
	// each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m".
	// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
	Cert(token, thingID, duration string) (string, string, error)
}

Service specifies Provision service API.

func New

func New(cfg Config, mgsdk sdk.SDK, logger *slog.Logger) Service

New returns new provision service.

type ServiceConf

type ServiceConf struct {
	Port           string `toml:"port"          env:"MG_PROVISION_HTTP_PORT"            envDefault:"9016"`
	LogLevel       string `toml:"log_level"     env:"MG_PROVISION_LOG_LEVEL"            envDefault:"info"`
	TLS            bool   `toml:"tls"           env:"MG_PROVISION_ENV_CLIENTS_TLS"      envDefault:"false"`
	ServerCert     string `toml:"server_cert"   env:"MG_PROVISION_SERVER_CERT"          envDefault:""`
	ServerKey      string `toml:"server_key"    env:"MG_PROVISION_SERVER_KEY"           envDefault:""`
	ThingsURL      string `toml:"things_url"    env:"MG_PROVISION_THINGS_LOCATION"      envDefault:"http://localhost"`
	UsersURL       string `toml:"users_url"     env:"MG_PROVISION_USERS_LOCATION"       envDefault:"http://localhost"`
	HTTPPort       string `toml:"http_port"     env:"MG_PROVISION_HTTP_PORT"            envDefault:"9016"`
	MgUser         string `toml:"mg_user"       env:"MG_PROVISION_USER"                 envDefault:"test@example.com"`
	MgPass         string `toml:"mg_pass"       env:"MG_PROVISION_PASS"                 envDefault:"test"`
	MgDomainID     string `toml:"mg_domain_id"  env:"MG_PROVISION_DOMAIN_ID"            envDefault:""`
	MgAPIKey       string `toml:"mg_api_key"    env:"MG_PROVISION_API_KEY"              envDefault:""`
	MgBSURL        string `toml:"mg_bs_url"     env:"MG_PROVISION_BS_SVC_URL"           envDefault:"http://localhost:9000/things/configs"`
	MgWhiteListURL string `toml:"mg_white_list" env:"MG_PROVISION_BS_SVC_WHITELIST_URL" envDefault:"http://localhost:9000/things/state"`
	MgCertsURL     string `toml:"mg_certs_url"  env:"MG_PROVISION_CERTS_SVC_URL"        envDefault:"http://localhost:9019"`
}

ServiceConf represents service config.

Directories

Path Synopsis
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL