Skip to content

Conversation

@QuentinPerez
Copy link
Contributor

#179

Get security-groups

$> ./scw _security-groups  | jq . | anonuuid
{
  "security_groups": [
    {
      "description": "Auto generated security group.",
      "enable_default_security": false,
      "id": "00000000-0000-1000-0000-000000000000",
      "organization": "11111111-1111-1111-1111-111111111111",
      "name": "Default security group",
      "organization_default": true,
      "servers": [
        {
          "id": "22222222-2222-1222-2222-222222222222",
          "name": "loving-wilson"
        }
      ]
    },
    {
      "description": "toto",
      "enable_default_security": true,
      "id": "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb",
      "organization": "11111111-1111-1111-1111-111111111111",
      "name": "toto",
      "organization_default": false,
      "servers": []
    }
  ]
}

Get a specific security group

$> ./scw _security-groups "00000000-0000-1000-0000-000000000000"  | jq . | anonuuid
{
  "security_group": {
    "description": "toto",
    "enable_default_security": true,
    "id": "00000000-0000-1000-0000-000000000000",
    "organization": "11111111-1111-1111-1111-111111111111",
    "name": "toto",
    "organization_default": false,
    "servers": []
  }
}

New security-group

$> ./scw _security-groups --new "foo:bar"
$> ./scw _security-groups  | jq . | anonuuid
{
  "security_groups": [
    {
      "description": "Auto generated security group.",
      "enable_default_security": false,
      "id": "00000000-0000-1000-0000-000000000000",
      "organization": "11111111-1111-1111-1111-111111111111",
      "name": "Default security group",
      "organization_default": true,
      "servers": [
        {
          "id": "22222222-2222-1222-2222-222222222222",
          "name": "loving-wilson"
        }
      ]
    },
    {
      "description": "bar",
      "enable_default_security": true,
      "id": "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb",
      "organization": "11111111-1111-1111-1111-111111111111",
      "name": "foo",
      "organization_default": false,
      "servers": []
    }
  ]
}

Update a security-group

$> ./scw _security-groups --update "newfoo:newbar" "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb"  
$>./scw _security-groups  | jq . | anonuuid
{
  "security_groups": [
    {
      "description": "Auto generated security group.",
      "enable_default_security": false,
      "id": "00000000-0000-1000-0000-000000000000",
      "organization": "11111111-1111-1111-1111-111111111111",
      "name": "Default security group",
      "organization_default": true,
      "servers": [
        {
          "id": "22222222-2222-1222-2222-222222222222",
          "name": "loving-wilson"
        }
      ]
    },
    {
      "description": "newbar",
      "enable_default_security": true,
      "id": "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb",
      "organization": "11111111-1111-1111-1111-111111111111",
      "name": "newfoo",
      "organization_default": false,
      "servers": []
    }
  ]
}

Delete a security-group

$> ./scw _security-groups --delete "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb" 
$> ./scw _security-groups  | jq . | anonuuid
{
  "security_groups": [
    {
      "description": "Auto generated security group.",
      "enable_default_security": false,
      "id": "00000000-0000-1000-0000-000000000000",
      "organization": "11111111-1111-1111-1111-111111111111",
      "name": "Default security group",
      "organization_default": true,
      "servers": [
        {
          "id": "22222222-2222-1222-2222-222222222222",
          "name": "loving-wilson"
        }
      ]
    }
  ]
}

Display Rules

$> ./scw _security-groups --rules "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb" | jq . | anonuuid
{
  "rules": [
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 25,
      "action": "drop",
      "position": 1,
      "dest_port_to": "",
      "editable": false,
      "id": "00000000-0000-1000-0000-000000000000"
    },
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 465,
      "action": "drop",
      "position": 2,
      "dest_port_to": "",
      "editable": false,
      "id": "11111111-1111-1111-1111-111111111111"
    },
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 587,
      "action": "drop",
      "position": 3,
      "dest_port_to": "",
      "editable": false,
      "id": "22222222-2222-1222-2222-222222222222"
    },
    {
      "direction": "inbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "action": "drop",
      "position": 1,
      "dest_port_to": "",
      "editable": true,
      "id": "33333333-3333-1333-3333-333333333333"
    }
  ]
}

Display one rule

$> ./scw _security-groups --rule-id "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb:33333333-3333-1333-3333-333333333333"  | jq . | anonuuid
{
  "rule": {
    "direction": "inbound",
    "protocol": "TCP",
    "ip_range": "0.0.0.0/0",
    "action": "drop",
    "position": 1,
    "dest_port_to": "",
    "editable": false,
    "id": "33333333-3333-1333-3333-333333333333"
  }
}

Delete one rule

$> ./scw _security-groups --rule-delete "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb:33333333-3333-1333-3333-333333333333"  | jq . | anonuuid
$> ./scw _security-groups --rules "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb"   | jq .| anonuuid
{
  "rules": [
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 25,
      "action": "drop",
      "position": 1,
      "dest_port_to": "",
      "editable": false,
      "id": "00000000-0000-1000-0000-000000000000"
    },
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 465,
      "action": "drop",
      "position": 2,
      "dest_port_to": "",
      "editable": false,
      "id": "11111111-1111-1111-1111-111111111111"
    },
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 587,
      "action": "drop",
      "position": 3,
      "dest_port_to": "",
      "editable": false,
      "id": "22222222-2222-1222-2222-222222222222"
    }
  ]
}

Add a new rule

$> ./scw _security-groups --rule-new "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb:drop:inbound:0.0.0.0/0:TCP:4242"
$> ./scw _security-groups --rules "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbb"   | jq .| anonuuid
{
  "rules": [
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 25,
      "action": "drop",
      "position": 1,
      "dest_port_to": "",
      "editable": false,
      "id": "00000000-0000-1000-0000-000000000000"
    },
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 465,
      "action": "drop",
      "position": 2,
      "dest_port_to": "",
      "editable": false,
      "id": "11111111-1111-1111-1111-111111111111"
    },
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 587,
      "action": "drop",
      "position": 3,
      "dest_port_to": "",
      "editable": false,
      "id": "22222222-2222-1222-2222-222222222222"
    },
    {
      "direction": "inbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 4242,
      "action": "drop",
      "position": 1,
      "dest_port_to": "",
      "editable": true,
      "id": "33333333-3333-1333-3333-333333333333"
    }
  ]
}

Update a rule

$>./scw _security-groups --rule-update "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbbb:33333333-3333-1333-3333-333333333333:drop:inbound:0.0.0.0/0:TCP:8484"
$> ./scw _security-groups --rules "bbbbbbbb-bbbb-1bbb-bbbb-bbbbbbbbbbbbb"   | jq .| anonuuid
{
  "rules": [
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 25,
      "action": "drop",
      "position": 1,
      "dest_port_to": "",
      "editable": false,
      "id": "00000000-0000-1000-0000-000000000000"
    },
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 465,
      "action": "drop",
      "position": 2,
      "dest_port_to": "",
      "editable": false,
      "id": "11111111-1111-1111-1111-111111111111"
    },
    {
      "direction": "outbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 587,
      "action": "drop",
      "position": 3,
      "dest_port_to": "",
      "editable": false,
      "id": "22222222-2222-1222-2222-222222222222"
    },
    {
      "direction": "inbound",
      "protocol": "TCP",
      "ip_range": "0.0.0.0/0",
      "dest_port_from": 8484,
      "action": "drop",
      "position": 1,
      "dest_port_to": "",
      "editable": true,
      "id": "33333333-3333-1333-3333-333333333333"
    }
  ]
}

@moul
Copy link
Contributor

moul commented Sep 16, 2015

Can you update the README.md file

README.md Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid markdown

@moul
Copy link
Contributor

moul commented Sep 21, 2015

LGTM

QuentinPerez pushed a commit that referenced this pull request Sep 21, 2015
@QuentinPerez QuentinPerez merged commit 079c926 into scaleway:master Sep 21, 2015
@moul moul mentioned this pull request Sep 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants