2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-29 21:37:55 +00:00

122 Commits

Author SHA1 Message Date
Aravindh R
c9d30a5082 Update messages 2021-08-30 16:49:05 +05:30
Paul Cleary
aeb5b8310c
Added key algorithm support (#1011)
Fixes #964 

- Updated the `ZoneConnection` model to allow specifying the key algorithm.
- Added an `Algorithm` to the protobuf file, defaults to HMAC-MD5
- Updated JSON serialization to serdes the algorithm
- Updated the Portal to allow the user to specify the algorithm when connecting to a zone or managing a zone

Supported algorithms are:

```
  case object HMAC_MD5 extends Algorithm("HMAC-MD5.SIG-ALG.REG.INT")
  case object HMAC_SHA1 extends Algorithm("hmac-sha1.")
  case object HMAC_SHA224 extends Algorithm("hmac-sha224.")
  case object HMAC_SHA256 extends Algorithm("hmac-sha256")
  case object HMAC_SHA384 extends Algorithm("hmac-sha384.")
  case object HMAC_SHA512 extends Algorithm("hmac-sha512.")
```

**Note: needs some tests**
2020-10-23 15:23:01 -04:00
Paul Cleary
a988bcd9a8
Add backend provider (#980)
Introduces the concept of a `Backend` into VinylDNS.  This will allow support for any DNS backend in the future, including AwS Route53 for example.  This is consistent with other "provider" things for dynamic loading of classes (Notifier, Repository, Queue, etc.)

The initial implementation builds on what we have already, that is when creating a zone one can choose a `backendId` that is configured in the `application.conf`.  If no `backendId` is specified, we attempt to map like we do today, so the exact same functionality.

We expand that by allowing one to map a `backendId` to a different provider (like aws). 

After this PR:
1. If someone specifies a zone connection on a zone, it will work exactly like it does today, namely go through the `DnsBackend` to connect.
2. If someone specifies a `backendId` when setting up a zone, the naive mapping will take place to map that zone to the `Backend` implementation that is configured with that `backendId`.   For example, if you have configured a backend id `aws` that connects to Route53, and you specify `aws` when connecting the zone, it will connect to it in Route 53 **Note: we still do not support zone create, but that is much closer to reality with this PR, much much**
3. If someone specifies NEITHER, the `defaultBackendId` will be used, which could be on any one of the backend providers configured.

To start, there is a new `vinyldns.core.domain.backend` package that contains the main classes for the system.  In there you will find the following:

- `BackendProvider` - this is to be implemented by each provider.  Adds a means of pre-loading zones, and providing connections to zones. 
- `Backend` - provides connectivity to a particular backend instance.  For example, a particular DNS Authoritative server.  This is where the real work happens of interacting with whatever backend.  For example, `DnsConnection` implements this to send DDNS messages to the DNS system.  Consider this the "main" thing to implement, where the rubber meets the road, the meat and potatoes
- `BackendProviderLoader` - to be implemented by each provider, knows how to load it's single instance `BackendProvider`, as well as possibly pre-loading configured `Backends` or anything else it needs to do to get ready.  It provides a dynamic hook via the `def load` method that is called by the `BackendLoader` to load a specific `Backend`
- `BackendResolver` - the main, default, BackendResolver.  It holds all `BackendProvider` instances loaded via the `BackendLoader` and provides right now a naive lookup mechanism to find `Backend`s.  Really, this is more of a `Router` or `Resolver`, as in the future it could use more advanced techniques to finding connections than right now
- `BackendConfigs` - used by the `BackendRegistry` as the entrypoint into configuration for all backends
- `BackendProviderConfig` - a single backend provider configuration, specifies a `className` that should be the `BackendProviderLoader` implementation to be loaded, and a `settings` that is passed into the `BackendProvider` to load itself.  This is consistent with other providers.
- `BackendResponse` - uniform responses across all providers to the rest of the VinylDNS System

**Workflow**
During initialization of the system:

1. The `BackendResolver` loads the `BackendConfigs` from the application configuration.  This contains configuration for ALL backends
2. The `BackendResolver` utilizes the `BackendLoader` to dynamically load each backend individually.  If any backend cannot be loaded, it will fail.
3. The `BackendLoader` creates a new instance of each `className` for each `BackendConfig`, this points to the `BackendProviderLoader` implementation which takes care of loading the specific `BackendProvider` provided the configuration
4. The `BackendProviderLoader` does any initialization necessary to ensure it is ready.  In the case of `Route53`, it will pre-load and cache all hosted zones that are available for the AWS account that is configured.  For Route53, a single `Route53Backend` is setup right now.  For `DnsBackend`, a connection (server, port, tsig key) is setup for each DNS Authoritative system to integrate with.

During runtime of the system:

1. When anything is needed, the `BackendResolver` is consulted that will determine how to lookup the `Backend` that is needed.  This is done right now by naively scanning all `BackendProvider` instances it has to say "can anyone connect to this zone".  More intelligent discovery rules can be added in the future
2. Once a `Backend` is obtained, any operation can be performed:
    1. `ZoneConnectionValidator` uses `zoneExists` and `loadZone` to validate a zone is usable by VinylDNS
    2. `RecordSetChangeHandler` uses `resolve` and `applyChange` to apply changes to the DNS backend
    3. `ZoneSyncHandler` and `DnsZoneViewLoader` use `loadZone` in order to load records into VinylDNS

**What else is here**

- Provided an implementation of a backend provider for DNS via `Backend`
- Updated all of VinylDNS to use `Backends` instead of hard coded to DNS
- Provided an implementation of a backend provider for AWS Route 53 as an example to follow for other providers


**Example configuration**

```
vinyldns {
  backend {
    default-backend-id = "r53"

    backend-providers = [
      {
        class-name = "vinyldns.route53.backend.Route53BackendProviderLoader"
        settings = {
          backends = [
            {
              id = "test"
              access-key = "vinyldnsTest"
              secret-key = "notNeededForSnsLocal"
              service-endpoint = "http://127.0.0.1:19009"
              signing-region = "us-east-1"
            }
          ]
        }
      }
    ]
  }
}
```
2020-09-30 09:17:32 -04:00
Peter Cline
ccaf58bc92
Slightly reduce long txt record test size (#951)
The BLOB type is juuuust too small for the previous value. Reduce the
number of characters by two -- the purpose of the test is still being
fulfilled. A migration to MEDIUMBLOB or LARGEBLOB will be required if we
need this to be bigger.
2020-06-09 14:45:47 -05:00
Michael Ly
1e6dad534d
Remove trailing whitespace from FQDN record data (#935)
* Create Fqdn class to facilitate FQDN-related string manipulations and comparisons.
* Update unit tests.
* Update functional tests.
2020-04-01 09:48:00 -05:00
Britney Wright
61c6338bee
Implement global recordset search: API (#922)
* Implement global recordset search in API
2020-03-09 09:47:13 -05:00
Britney Wright
6af5846a39
disallow recordset name and type updates (#925) 2020-01-24 10:35:16 -05:00
Britney Wright
45a15f4ffc
Zone recordset search enhancements (#912) 2019-12-12 11:44:40 -05:00
Britney Wright
0773013f27
fix user lock status in group response (#914) 2019-12-09 10:49:32 -05:00
Britney Wright
04420a6da2
make Batch Change AAAA record data flexible (#909) 2019-12-04 10:24:32 -05:00
Michael Ly
963407a0f4
Remove functional test and revert MAX_RETRIES. (#913) 2019-12-03 16:11:34 -06:00
Britney Wright
f461a62ee5
retry some failed record changes (#907) 2019-11-29 12:10:45 -05:00
Britney Wright
31b86f9733
reject recordset names with spaces (#908) 2019-11-27 09:48:44 -05:00
Britney Wright
cd8008eedf
make User Is Not Authorized error more informative (#891) 2019-11-01 11:34:11 -04:00
Michael Ly
e81dba4525
Remove multi-record feature flag from API and portal (#880)
* Remove multi-record configuration from API.
* Remove multi-record config from portal.
* Remove deprecated tests and update functional test script.
2019-10-28 16:36:50 -04:00
Michael Ly
3c1b911573
Enable multi-record functionality in batch change (#872)
* Support record data for DeleteRecordSet.
* Update unit and functional tests.
2019-10-15 09:46:34 -04:00
Britney Wright
91db8f3cd0
remove access validation from get zone by name service (#856) 2019-10-01 16:50:11 -04:00
Michael Ly
a4092c7f0d Revert multi-record feature (#854)
* Revert "support DeleteRecord in New DNS Change form (#791)"

This reverts commit cbaa13e647fd68f1db83968bc6ec52dc5cf7341d.

* Revert "[DeleteRecord] Remove multi-record config (#836)"

This reverts commit 807f6760d92ed3838fa8b8f0d816dafe8ce46bb7.

* Revert "add DeleteRecord info to the docs (#792)"

This reverts commit f19f293cf754a2c96d35c1a9fdb0fd1cf3bba2cb.
2019-09-30 13:03:47 -04:00
Michael Ly
807f6760d9
[DeleteRecord] Remove multi-record config (#836)
* Remove multi-record enabled flag and enable DeleteRecord in JSON protocol.
* Update unit and functional tests
2019-09-24 16:51:18 -04:00
Paul Cleary
730c6f8897
Par func tests (#838)
Major overhaul of func tests to allow them to run in parallel.  Major changes include:

1. Consolidate all separate test fixtures into a single test fixture in the `shared_zone_test_context`
1. Add `xdist` to allow running tests in parallel
1. Add hooks in main `conftest.py` to setup the test fixture before workers run, and tear it down when workers are finished
1. After fixture is setup, save state in a local `tmp.out` so the workers will use that state instead of trying to recreate the fixture.
1. Add a `utils.generate_record_name` which generates a unique record name in order to avoid conflicts when running tests in parallel
1. Add a `pytest.mark.serial` for func tests that just cannot be run in serial
1. Tests are now run in two phases, first we run in parallel, and if that is successful, we run the serial tests
1. Add a `--teardown` flag, this allows us to reuse the test fixture between the two phases parallel and serial
2019-09-18 15:02:25 -04:00
Britney Wright
093d27ad21
save new batch change errors on approval attempt (#823) 2019-09-12 10:18:31 -04:00
Paul Cleary
7e2aab4de6
Global ACLs (#830)
Changes in this pull request:
- `GlobalACLs` - captures logic around testing a user's `AuthPrincipal` for access to a zone
- `AccessValidations` - modified the `getAccessLevel` to consult the `GlobalACLs` for a user to determine if the user has access.  `AccessValidations` now also takes `GlobalACLs`
- `VinylDNSConfig` - load the `GlobalACLs` from the config file
- `Boot` - load two separate `AccessValidations`.  One is used exclusively for batch changes that _will_ consult the configured global acls.  The other one used by the normal record set interface will not consult the global acls.  This is a TODO for cleanup
2019-09-06 10:44:20 -04:00
Rebecca Star
8e585644a9
Refactor cvm (#826)
* Refactor ChangeForValidationMap.

* Refactor service.

* Refactor unit tests.

* clean up validation changes
2019-09-03 12:05:21 -04:00
Britney Wright
e3e3a476a6
update ManualReviewRequiresOwnerGroup (#822) 2019-08-27 12:20:59 -04:00
Britney Wright
86b4f68856
relax list group ignoreAccess assertions (#815) 2019-08-22 09:12:22 -04:00
Michael Ly
ed1f2c7e6f
JSON deserialization and protobuf changes for remove single DNS record entry (#795)
* Support DeleteRecord in API
2019-08-21 15:32:23 -04:00
Britney Wright
d0d88dc0ea
Open list groups access (#809) 2019-08-21 14:26:51 -04:00
Britney Wright
e7820e6005
update send to manual review logic (#811) 2019-08-21 14:25:50 -04:00
Rebecca Star
7bdeb39a02 clean up after ourselves in the manual review tests (#810) 2019-08-20 23:19:41 -04:00
Michael Ly
e3f8dfadec
Flag batch changes requiring manual review by zone name (#807)
* Implement zone name needs review.
* Add unit tests.
* Update func tests.
* Update conf files and docs.
2019-08-20 16:05:55 -04:00
Rebecca Star
53ffabdd32
Allow configuration of ipv6 zone discovery search range (#798)
* configure v6 range

* fix and test

* with pureconfig and assertions
2019-08-13 11:08:30 -04:00
Britney Wright
d1968bd170
API: cancel batch change that is pending review (#794) 2019-08-12 10:43:13 -04:00
Britney Wright
cf7f27a59a
flag func test (#788) 2019-08-07 13:07:15 -04:00
Michael Ly
9014570a37
Implement domains requiring manual review (via batch change interface) (#779)
* Implement domains requiring review.
* Update configs.
* Update tests.
2019-08-07 10:33:18 -04:00
Britney Wright
1fbcdfd35a
validate scheduled time is in the future (#784) 2019-08-07 08:26:15 -04:00
Britney Wright
ad6d818252
allow underscores in batch change requests (#782) 2019-08-06 16:28:58 -04:00
Britney Wright
4e2b76cccf
correctly get batchChangeSummary totalChanges (#780) 2019-08-05 17:09:11 -04:00
Rebecca Star
eefa2a3392
remove unused BatchChangeInfoSerializer (#776)
* remove unused BatchChangeInfoSerializer

* with extra validation
2019-07-30 14:11:12 -04:00
Michael Ly
a72c7faf0a
Require owner group ID for soft errors (#775)
* Require owner group ID for soft errors.
* Update tests.
2019-07-30 12:45:53 -04:00
Britney Wright
b143eeaa44
expand batch change statuses (#768) 2019-07-30 10:13:52 -04:00
Paul Cleary
bc6519dbcf
Advance scheduled change to PendingApproval (#771)
When a scheduled change is submitted, if there are no hard errors advance to PendingApproval status.

* `BatchChange` - changed the calculation of the batch change status; if it is pending approval and the scheduled time is set it will be `Scheduled`
* `MySqlBatchChangeRepository` - updated the de-serialize to consider scheduled time so when "getting" a batch change, the status returned will appropriately be `Scheduled`
* `BatchChangeService` - updated the `buildResponse` method to consider scheduled time.  If no fatal errors, manual review enabled, and scheduled then goto PendingApproval
2019-07-29 19:18:12 -04:00
Rebecca Star
eb51f56449
Zone discovery soft failure and tests (#767)
* zone discovery soft failure and tests
2019-07-26 15:16:40 -04:00
Paul Cleary
07dfbe091d
Add scheduled change feature flag and check (#761)
Add a scheduled change feature flag.  If a user submits a batch change that is scheduled, and the feature flag is disabled, then raise an error.

* `BatchChangeValidations` - added a class member variable that holds the feature flag.  Added a function `validateScheduledChange` that has the business rule if the feature flag is disabled and scheduled time is set then raise an error
* `Boot` - pass the config value into the `BatchChangeValidations` constructor
* `BatchChangeRoute` - added error handler for `ScheduleChangeDisabled` error
* `VinylDNSConfig` - add a feature flag
* `api/reference.conf` - ensure that the scheduled batch change enabled flag is set to `false` by default (it is off)
2019-07-26 10:46:36 -04:00
Britney Wright
1d1bca230c
add approval fields to batch responses (#752) 2019-07-25 11:46:36 -04:00
Michael Ly
566ae1f3da
Properly reject requests sent to non-existent routes (#739)
* Refactor routing
2019-07-23 12:19:39 -04:00
Paul Cleary
a520bcca4d
Adding scheduled time to all the things (#756)
Add scheduled time field to prepare for scheduled batch changes.

* `create_batch_change_test.py` - add a test that ensures posting and retrieving using the scheduled time field works as expected
* `BatchChangeProtocol.scala` - add scheduledTime field to `BatchChangeInput`
* `BatchChangeService.scala` - modify the `buildResonse` method, it does some logic to produce the resulting `BatchChange` entity, and we need to ensure that the `scheduledTime` field propagates through that logic
* `BatchChangeJsonProtocol.scala` - make sure that `BatchChangeInputSerializer` takes in `scheduledTime`, make sure that `BatchChangeSerializer` converts `scheduledTime` to json
* `BatchChange.scala` - add `scheduledTime` field
* `BatchChangeSummary.scala` - add `scheduledTime` field
* `V3.18__ScheduledChange.sql` - add a `scheduled_time` field to the `batch_change` table; add an index on `scheduled_time` as well to support querying by scheduled time
* `MySqlBatchChangeRepository` - make sure that save and get methods support `scheduledTime`
2019-07-22 17:17:09 -04:00
Rebecca Star
000139ff8f
Approval up front checks (#755)
* up front approval conversions

* with tests

* fix approval func tests

* address comments
2019-07-22 10:07:00 -04:00
Britney Wright
fc757d1940
allow updates to dotted CNAME records (#742) 2019-07-16 14:37:54 -04:00
Britney Wright
3cc1b26274
make zone discovery case insensitive (#738) 2019-07-16 13:02:41 -04:00
Britney Wright
feca19f2e3
update group detail page (#741) 2019-07-15 14:53:22 -04:00