Report this

What is the reason for this report?

How to restrict token use withint applications of specific IP address?

Posted on November 17, 2019

I am using digital ocean’s python api. I generated a token and successfully created a couple of droplets using snapshots. In order to make the use of the token safer, is there a way to restrict the use of the token from specific ip addresses? In other words,is it possible to add the ip addresses of the machines allowed to use the token? Thanks in advance



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

I don’t think that this is currently possible. You could share your idea here:

https://ideas.digitalocean.com/ideas/

What I could suggest in the meantime, is keeping your API key in a separate file, for example, use config.py and then add that config.py file to your gitignore so that the file only gets uploaded to your server.

Regards, Bobby

Hi there,

A quick update here, custom scopes for DigitalOcean API Tokens is now in beta!

This API token enhancement provides additional flexibility in protecting your cloud resources by letting you select only the necessary scopes.

Please fill out this form if you are interested in participating in the beta..

Custom scopes introduce more specific permissions, like creating Droplets or updating cloud firewalls. Using custom scopes lets you secure your workflows by granting only the permissions the token needs and restricting access to other resources and actions.

Generally, the CRUD scopes map to equivalent actions on the associated kind of resource:

  • Create scope lets you create the resource type and perform additive actions within that resource type. For example, database:create lets you create database clusters and create new users or databases within that cluster.

  • Read scope lets you view information about a resource by type and also view information that the resource returns. For example, app:read lets you view App Platform apps and their logs.

  • Update scope allows you modify a resource type and perform actions that would otherwise modify a resource. For example, droplet:update lets you power a Droplet on or off.

  • Delete scope lets you delete a resource by type and perform actions that delete information about the resource type. For example, database:delete lets you delete databases from a database cluster and remove existing users from a database.

Each custom scope correlates to one public API endpoint.

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.