Skip to content

Commit

Permalink
Merge branch 'main' of github.com:g-research/astral
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Nov 4, 2024
2 parents aa81e34 + d73f139 commit f6b76ab
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,30 @@ UPPER_CASE). Environment vars will override any values in the config
file. Per-environment settings in the config file(development, test,
production) will override the shared values for that type.

## Database encryption
The local database can be encrypted, if needed, but requires a bit of setup
and careful retention of a master key. Note that there are performance impacts.

1. First, create encryption keys for the database:
```
rails db:encryption:init
```
Copy the output to your clipboard.

2. Next, create a `credentials.yml.enc` file:
```
EDITOR=vi rails credentials:edit
```
Paste the db encryption key data into this file, save, and exit.

NB, the credentials file is decoded by a key placed in
`config/master.key`. Be sure to save this file (it is .gitignored)!

3. Finally, set the following Astral configuration to 'true':
```
db_encryption: true
```

## mTLS connections
Astral can be run as an SSL service and can communicate with Vault via SSL.
Just set the following values in `config/astral.yml` (or environment) to
Expand Down
5 changes: 5 additions & 0 deletions app/models/domain.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
class Domain < ApplicationRecord
validates :fqdn, presence: true

if Config[:db_encryption]
encrypts :fqdn, :users, :groups
end


def groups_array
(groups || "").split(",").sort.uniq
end
Expand Down
3 changes: 3 additions & 0 deletions config/astral.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Astral configuration
# Note that values can be supplied here or as environment vars (UPPER_CASE).
shared:
# Set to true and follow setup guide for encrypted sql database fields
db_encryption: false

vault_token:
vault_addr:
# if VAULT_ADDR is https with self-signed cert, need to provide
Expand Down
1 change: 0 additions & 1 deletion config/credentials.yml.enc

This file was deleted.

0 comments on commit f6b76ab

Please sign in to comment.