0

DigitalOcean offers managed databases. From what I can understand, the advantages are:

  • You don't have to worry about management tasks such as set-up, updates (including security updates), and backups.
  • They store and move the data encrypted.
  • Certain redundancy options.

What I'm trying to understand is: From a security standpoint, compare these managed databases to simply using SQLite as the database, on the same machine (droplet) as the application. I know one difference is the fact that SQLite doesn't store data encrypted, unless you encrypt/unencrypt it manually. So suppose in this example that we do encrypt data before writing to SQLite and unencrypt it when reading, using symmetric encryption with a secret key.

I'm trying to understand if this SQLite application is less secure than the managed database version. In both cases, it seems that the risk is that an attacker would gain access to the droplet running the application. In the managed database case, the attacker might be able to gain access to the database connection string, at which point they could run their own queries against the database. In the SQLite case, the attacker could download the entire database, and if they knew the encryption key they could read the data.

In both cases it seems like the vulnerability is the same: attacker accessing the machine and accessing a secret string.

Am I missing something?

1
  • 1
    Honestly, its not even a question of security ... its a question of do you want to pay 3x the cost for them to manage it for you or do you have the expertise/time to do it yourself. Its $$$ vs Time plain and simple. Oct 2, 2023 at 20:57

2 Answers 2

2

How much security do Digital Ocean managed databases provide?

None?

Ok, lets back up and let me clarify some things.

First:

Trying to compare MySQL and SQLite is a non-starter because they are two diff pieces of tech w/ different usecases and diff feature sets. I am not even going to go down this path cause its comparing apples and curly fries.

Second:

Security. I have no beef w/ Digital Ocean, and would actualy recomend their setup guides on the topic. However, when it comes right down to it DO is not selling you anything you cant do yourself for 1/3rd the price on your own. Currently Managed MySQL through DO is 15$/mo but a Droplet w/ the same specs 5$/mo.

Third:

So ... what am I paying for? Well, thats a good question

  • DO is keeping your DB updated (if you do a setup via the instructions you can do this via apt-update && apt-upgrade you just have to remember to do so.
  • DO is providing backups ... you can achive this via mysqldump in a cron and even SCP the backup file offsite if you have another place to stash it
  • DO is providing "network security" so that you can lock down the DB to only nodes in DO ... you can do this too via setting it to listen on 127.0.0.1 or setup UFW to only allow SQL traffic from the external IPs of your other nodes.

So its not really a question of security at all ... its a question of skill and time. Do you have the ability to and time to follow a tutorial to install a MySQL DB on your own, setup firewall rules on your own, setup backup scripts on your own, perioticly do software updates on your own.

TLDR; Its more of a question of time vs money than it is anything to do with security.

2
  • Personal pref, but I switched from DO to Vultr a few years back have had nothing but good experiences. Oct 3, 2023 at 16:36
  • Thanks. Yes, I wasn't asking to compare SQLite vs. DO managed MySQL/PostgreSQL except on the issue of security. I'm basically hearing my assumption confirmed that with either arrangement, to see my data an attacker would have to get into the application droplet, and then figure out one string: either the managed database connection string, or the encryption key I use to manually encode the SQLite data fields. But I appreciate your detailed answer and have accepted it.
    – M Katz
    Oct 4, 2023 at 4:57
1

You have to compare like with like. Compare hosting your own PostgreSQL with that offered by DigitalOcean rather than SQLite. SQLite is not a good option for a heavy application as it has limited support for multithreading and role based access control (among many other limitations).

By hosting your own you need to set everything up right, including security configuration and other configuration aspects to keep the database running well. Furthermore you have to keep an eye for any new vulnerabilities affecting your database version and have them patched. Also need to take care of disk and CPU consumption. If you host this on DigitalOcean or AWS, this part is taken care of to a large extent. You still need to do some database work, but it is simplified.

2
  • I have upvoted your answer. Can you give more detail on the SQLite's "limited support for multithreading"?
    – M Katz
    Oct 4, 2023 at 4:59
  • 1
    That comment relates to writes. Take for example MySQL's InnoDB or MyISAM engines. When writing they lock either that particular row or table until the write completes. With SQLite, the entire database file is locked, and other threads have to wait for a lock to write anything. Another issue I did not mention is the lack of access control. Say you have a vulnerable reporting job that only needs to read data. An attacker exploiting it can cause it to write data. SQLite is awesome in it's own right. But treat it for what it is, a flat file.
    – zyked
    Oct 5, 2023 at 5:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .