Aller au contenu
NimbusNexus

Groupes de sécurité

Les groupes de sécurité sont des ensembles de règles de pare-feu avec état. Vous attachez un ou plusieurs groupes à l’interface réseau d’une VM ; c’est l’union des règles de tous les groupes qui s’applique. Comportement par défaut : tout refuser en entrée, tout autoriser en sortie — liste d’autorisation explicite pour le trafic entrant, sortie ouverte jusqu’à ce que vous en décidiez autrement.

Ce que signifie « avec état »

Vous n’écrivez de règles que pour le sens qui initie la connexion. Si vous autorisez le TCP entrant sur le port 443, les paquets de réponse vers le client sont autorisés automatiquement — aucune règle sortante séparée n’est nécessaire pour le trafic de retour.

À comparer avec une ACL sans état (par exemple les Network ACLs d’AWS), où il faudrait des règles symétriques dans les deux sens. Les groupes de sécurité sont plus simples à appréhender pour le filtrage au niveau applicatif ; les ACL sans état sont plus simples à appréhender pour une politique de réseau tenant, à une couche sous la VM.

Format des règles

Chaque règle comporte :

  • Direction — ingress ou egress
  • Type Ethernet — ether : IPv4 ou IPv6
  • Protocole — any, un nom comme tcp, udp, icmp, ipv6-icmp ou sctp, ou custom avec un numéro de protocole (0–255) dans protocol_custom
  • Plage de ports — port_min et port_max, chacun entre 0 et 65535. Indiquez port_min seul pour un port unique (80), les deux pour une plage (8000 à 9000), ou aucun des deux pour n’importe quel port
  • Source / destination — un bloc CIDR dans remote_cidr (0.0.0.0/0, 10.0.0.0/8), un autre groupe de sécurité dans remote_sec_grp, ou un groupe d’adresses dans remote_addr_grp

Le mode « la source est un autre groupe de sécurité » est celui qu’il est le plus utile de connaître. Une règle comme « autoriser le port 5432 depuis web-tier-sg » permet à chaque VM du groupe web-tier-sg d’atteindre votre VM Postgres sur le port 5432 — sans avoir à énumérer les IP, et la règle continue de fonctionner à mesure que des VM entrent dans web-tier-sg ou en sortent lors des mises à l’échelle.

Un schéma courant

Pour une application web à 3 tiers :

  1. web-tier-sg — autorise en entrée tcp/80 et tcp/443 depuis 0.0.0.0/0 (public)
  2. app-tier-sg — autorise en entrée tcp/8080 depuis web-tier-sg (seul le tier web peut atteindre le tier applicatif)
  3. db-tier-sg — autorise en entrée tcp/5432 depuis app-tier-sg (seul le tier applicatif peut atteindre la base de données)

Ce schéma est composable ; vous pouvez ajouter un 4e groupe pour un VPN d’exploitation qui autorise SSH depuis les IP de votre bureau, et l’attacher à côté de db-tier-sg sur les VM de base de données sans toucher aux règles applicatives.

Étapes suivantes

Reference

GET/api/v1/security_group/

Groups List

Lists security groups visible to the project, including their rules.

Parameters

NameInTypeDescription
admin_domainquerystring | null—
admin_projectquerystring | null—
projectquerystring | null—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/security_group/" \
  -H "Authorization: Bearer $NIMBUS_KEY"
POST/api/v1/security_group/

Group Create

Creates a new security group in the scoped project.

Request body

FieldTypeDescription
admin_domainstring | null—
admin_projectstring | null—
projectstring | null—
name*string—
descriptionstring | null—

Responses

  • 201Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X POST "https://api.nimbusnexus.net/api/v1/security_group/" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Example"
  }'
DELETE/api/v1/security_group/

Group Delete

Deletes a security group, rejecting the request when it is still in use.

Request body

FieldTypeDescription
id*string—

Responses

  • 204Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X DELETE "https://api.nimbusnexus.net/api/v1/security_group/" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "example"
  }'
GET/api/v1/security_group/instance

Instance Groups List

Lists security groups annotated with whether they are linked to a given instance.

Parameters

NameInTypeDescription
admin_domainquerystring | null—
admin_projectquerystring | null—
projectquerystring | null—
id*querystring—
show_allqueryboolean—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/security_group/instance?id=example" \
  -H "Authorization: Bearer $NIMBUS_KEY"
PUT/api/v1/security_group/instance

Instance Groups Update

Synchronizes an instance attached security groups with the supplied desired set.

Request body

FieldTypeDescription
instance_id*string—
desired_group_ids*array of string—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X PUT "https://api.nimbusnexus.net/api/v1/security_group/instance" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instance_id": "<instance_id>",
    "desired_group_ids": [
      "<desired_group_id>"
    ]
  }'
POST/api/v1/security_group/rule

Rule Create

Adds an ingress or egress rule to an existing security group.

Request body

FieldTypeDescription
security_group_id*string—
direction*Directions—
ether*Ethers—
protocol*integer | Protocols—
protocol_custominteger | string | null—
port_mininteger | null—
port_maxinteger | null—
icmp_typeinteger | null—
icmp_codeinteger | null—
remote_cidrstring | null—
remote_sec_grpstring | null—
remote_addr_grpstring | null—
descriptionstring | null—

Responses

  • 201Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X POST "https://api.nimbusnexus.net/api/v1/security_group/rule" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "security_group_id": "<security_group_id>",
    "direction": "ingress",
    "ether": "IPv4",
    "protocol": 1
  }'
DELETE/api/v1/security_group/rule/delete

Rule Delete

Deletes one or more security group rules by ID.

Request body

FieldTypeDescription
ids*array of string—

Responses

  • 204Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X DELETE "https://api.nimbusnexus.net/api/v1/security_group/rule/delete" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": [
      "example"
    ]
  }'
PUT/api/v1/security_group/{security_group_id}

Group Update

Updates a security group in the scoped project.

Parameters

NameInTypeDescription
security_group_id*pathstring—

Request body

FieldTypeDescription
namestring | null—
descriptionstring | null—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X PUT "https://api.nimbusnexus.net/api/v1/security_group/<security_group_id>" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Need to make a real call? Try these endpoints in the live Swagger UI →