Commit graph

923 commits

Author SHA1 Message Date
mcilwain
d30f9411d8 Require that DNS writer be set on Registry entities
We ran into a bunch of prober deployment issues this past week when
attempting to spin up a new cluster because the newly created prober
TLDs had null values for the dnsWriter field. Given that VoidDnsWriter
exists, we can require that dnsWriter always be set, and have people
use that if DNS publishing is not required.

Also cleans up a bunch of related inconsistent exception messages and
tests not verifying said exception messages properly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154325830
2017-05-03 10:38:49 -04:00
cgoldfeder
4eba2ea07a Make Registry.get(tld) hit memcache explicitly.
TESTED=The test fails if you change line 134 in Ofy to not use memcache
    and use the unchanged original Registry.get() code. This is the
    expected behavior.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154226534
2017-04-26 11:18:02 -04:00
cgoldfeder
9e61f1d6ef Make failfastForCreate for domain and application creates explicitly hit memcache
TESTED=For all tests, I added @Cache to DomainBase because otherwise the tests will
    fail. We aren't ready to do this in prod yet, which is why the tests are still
    marked @Ignore. The new tests fail if you change line 134 in Ofy to not use memcache
    and either use the unchanged original DomainCreateFlow code, or use the new
    inlined code and change loadWithMemcache() to load(). They pass with the new
    inlined code that calls loadWithMemcache(), as long as the @Cache is added to
    DomainResource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154224748
2017-04-26 11:16:33 -04:00
cgoldfeder
4553422ade Move domainCreateFailfast before cloneAndLinkReferences
This avoids loading all contacts and hosts before the failfast runs

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154179321
2017-04-26 11:09:23 -04:00
jianglai
33fabfff04 Remove abuse contact requirement
The requirement will instead be enforced on registrar contact that is visible in WHOIS as abuse contact.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154102111
2017-04-26 11:07:48 -04:00
mcilwain
e19386779c Fix Java 7 missing generic type error
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154081069
2017-04-26 11:02:02 -04:00
nickfelt
f296b225af Make FlowReporter log tld and various other fields
As part of b/36599833, this makes FlowReporter log the tld(s) of every domain
flow it executes, so we can provide ICANN reporting totals on a per-TLD basis.

It also adds several other fields that we're computing anyway and which seem
useful, particularly for debugging any issues we see in production with the data
that we're attempting to record for ICANN reporting.  The full set of fields is:

  - commandType (e.g. "create", "info", "transfer")
  - resourceType* (e.g. "domain", "contact", "host")
  - flowClassName (e.g. "ContactCreateFlow", "DomainRestoreRequestFlow")
  - targetId* (e.g. "ns1.foo.com", "bar.org", "contact-1234")
  - targetIds* - plural of the above, for multi-resource checks
  - tld** (e.g. "com", "co.uk") - extracted from targetId, lowercased
  - tlds** - plural of the above, deduplicated, for multi-resource checks

* = only non-empty for resource flows (not e.g. login, logout, poll)
** = only non-empty for domain flows

Note that TLD extraction is deliberately very lenient to avoid the complexity
overhead of double-validation of the domain names in the common case.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154070794
2017-04-26 10:59:09 -04:00
cgoldfeder
c596d23523 Add loadWithMemcache() to Ofy
Also clean up some minor uses of load() to standardize calls.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154067731
2017-04-26 10:57:41 -04:00
mcilwain
c1643fa3cd Correctly set clientId on EPP metrics in LoginFlow
This wasn't being recorded correctly because the clientId is only
set in LoginFlow after the flow succeeds, whereas we were
previously logging the clientId before executing the flow. This
adds special handling for LoginFlow. Note that we only set the
metric label to the clientId for valid registrar logins, to ensure
that metric cardinality doesn't grow unbounded (as it might if we
used every arbitrary string passed in as an attempted login).

This also refactors creation and handling of FakesAndMocksModule so
as to be able to make test assertions about EPP metrics from
integration flow tests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154048280
2017-04-26 10:56:13 -04:00
nickfelt
7dc3ddfc14 Skip FlowReporter logging for dry runs
Since this feeds into ICANN reporting, we don't want to muddy the data
there with dry-runs, which are always internal-only artifacts of tool usage
and shouldn't really count as real attempts to do SRS actions, since they
are always going to abort with no effect.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153856915
2017-04-26 10:54:43 -04:00
mmuller
0cbcfcc3c1 Add build rules for "nocron" deployments
Add build rules for creating "nocron" war and ear files for use during
database restores in production and alpha.

After a little consideration, I think this is the right way to do this.  If we
want to set it up in other environments, we'll need to add these rules for
them, too, and at that point it may be worthwhile to wrap the rules we want in
a macro, but for now this is fairly clear and not execessively redundant.

This change works by modifying the zip_file rule to allow us to exclude
"cron.xml".  I have verified that:

- The alpha "nocron" files are generated without cron.xml.
- The production "nocron" files are generated without cron.xml.
- I can do a full push to alpha based on deploy_nocron which doesn't install a
  new cron.
- The normal production and alpha war-files _do_ contain cron.xml.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153853205
2017-04-26 10:53:16 -04:00
nickfelt
c5d6a1f6fb Add and adjust EppInput accessors for more useful properties
This primarily adds accessors to EppInput that will be used for flow reporting
logging in FlowReporter.  Specifically, it adds:

 - Optional<String> getResourceType() -> domain/host/contact
 - Optional<String> getSingleTargetId() -> for SingleResourceCommands

And in addition, it adjusts getCommandName() so that it's now named
getCommandType() for better parallelism with the new getResourceType() (since
getResourceName() would be misleading), and it changes the value returned to be
lowercased, again for consistency.  This isn't an issue because getCommandName()
isn't actually used anywhere right now (it was formerly used for EPP whitebox
metrics, but no longer due to recent changes there).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153851957
2017-04-26 10:51:47 -04:00
nickfelt
f2c6021db0 Split FlowReporter logging into two lines for robustness
This prevents a possible failure mode of the logging where the logged
EPP input XML is very large (which can happen e.g. for domain creates
with large SMD values).  In those cases, the XML might cause the overall
JSON string to be too large to fit within a single log entry [1], in which
case it gets split over multiple lines and breaks automatic parsing.

This mitigates that case by logging the EPP input (raw and base64-encoded)
in a separate log statement so that the more compact metadata (like clientId)
and derived values (like ICANN reporting field) will still be in an intact
JSON string even in that case, and can still be readily parsed.  It's okay
if the actual EPP XML is harder to parse, since once we're logging the right
metadata fields we shouldn't need to automatically parse the EPP XML in any
normal cases.

[1] I haven't found this exact limit or splitting algorithm, or whether it's
a property of java logging or GAE log ingestion.  The GAE logs page does note
that a single application log entry (within a request, which can have up to
1000 such entries) maxes out at 8KB, so that might be it:
https://cloud.google.com/appengine/docs/standard/java/logs/#writing_application_logs

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153771335
2017-04-26 10:50:13 -04:00
nickfelt
12f267292a Move FlowRunner ICANN reporting logging to new FlowReporter
Since this reporting is getting more complicated (see b/36599833), it'll
be better to have a dedicated class to encapsulate it, which also lets us
keep the tests separate and focus FlowRunner more on its core purpose of
actually running the flow.

Note that this doesn't move the legacy log statement logging because that
specifically must be logged from the FlowRunner.run() method to preserve
the existing log signature matching in our ICANN activity reporting query.
(The new statement is designed to be robust to moves like this since it
doesn't use the logging callsite to match log lines, and it's not in use
yet anyway.)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153762008
2017-04-26 10:48:43 -04:00
jianglai
8f05ca466f Add Ability to return registrar contacts of a certain type
This is required by ICANN Consistent Labeling & Display policy that WHOIS domain query response contains registrar abuse contact's phone number and email address. Add a helper function to load registrar contact of a certain type for a given registrar.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153606137
2017-04-26 10:44:14 -04:00
jianglai
fb25b625f3 Provide better error message for abuse contact phone number
Make it clear that all the user need to do to rectify is to provide a phone number

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153191178
2017-04-26 10:41:12 -04:00
nickfelt
db2f08633a Clarify available/required OAuth scope documentation
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153167902
2017-04-26 10:39:45 -04:00
mcilwain
07c1f58004 Fix two warnings thrown by Eclipse
One is an unnecessary import and the other is an incorrectly named
Javadoc parameter.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153095269
2017-04-26 10:36:51 -04:00
larryruili
5047d568de Notify registrars of async contact/host deletions
We now send PendingActionNotificationResponses in our poll messages upon completion of an asynchronous contact or host deletion. This is part 1 of 2, which begins logging Trid in all enqueued Host/Contact deletion flows for use in batch deletions, and optionally consuming the resultant Trid info to emit a Host/ContactPendingActionNotifcationResponse.

Part 2 will make this response emission non-optional, which will happen once the queue is cleared of all non-Trid containing tasks.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153084197
2017-04-26 10:33:55 -04:00
jianglai
478c7576c6 Prevent removal of abuse contact phone number when updating registrar contact
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153000833
2017-04-13 11:03:34 -04:00
jianglai
f433242125 Move OAuth configs to yaml
Leave allowedOauthClientIds empty instead of moving the placeholder client ids over.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152967043
2017-04-13 11:02:04 -04:00
guyben
ab515cb352 Replace KeystoreKeyring with KmsKeystore comparison
Replace KeystoreKeyring with ComparatorKeyring between KeystoreKeyring and
KmsKeystore. In the opensource version, will replace DummyKeyring with
KmsKeyring directly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152893767
2017-04-13 10:58:57 -04:00
mountford
dea386d08a Change GenerateEscrowDepositCommand to trigger back end deposit generation
Previously, GenerateEscrowDepositCommand generated the deposit itself. Channeling it through the existing deposit generation code make things more maintainable.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152847950
2017-04-13 10:57:24 -04:00
mcilwain
8653d2f204 Refactor out creation of server TRIDs so they can be tested
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152837185
2017-04-13 10:55:47 -04:00
jianglai
bae5038b0a Re-apply server prohibited status codes in domain update for locked-down TLDs
For TLDs with domain create restriction. SERVER_TRANSFER_PROHIBITED and SERVER_UPDATE_PROHIBITED status codes
are automatically applied to newly created domains to make them immutable. When there is a legitimate for an update on a domain, the registry must first run nomulus update_server_locks to remove status before the registrar can request an update via EPP.

To eliminate the risk of the registry forgetting to reapply the codes after a update, we automatically re-apply these codes after a success update.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152533379
2017-04-10 13:49:21 -04:00
mountford
4f94464eaf Allow RdeStagingAction to be invoked manually
RdeStagingAction always processed all RDE and BRDA deposits currently outstanding, updating the cursors appropriately and kicking off the upload job. Sometimes we don't want all that. We just want to create a specific deposit by hand, without modifying the cursors or uploading. This CL adds parameters to support that.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152415959
2017-04-10 13:47:51 -04:00
mcilwain
08009e755f Don't include "Command" suffix in WHOIS metrics command name label
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152414152
2017-04-10 13:46:21 -04:00
nickfelt
5081d780dc Add assertTldsExist(Iterable<String>) to check multiple TLDs at once
This is better than calling assertTldExists() inside a for loop because you can throw a single exception reporting all bad TLDs at once rather than only getting as far as the first failure.  And then it's also a one-liner instead of 3 lines.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152412876
2017-04-10 13:44:52 -04:00
mountford
5127aeafb5 Enable authentication/authorization checks
The code to authenticate and authorize incoming requests (including via OAuth) has been in the system. This CL actually turns it on, since we are satisfied from logging information that it is not unjustly denying access.

Auth settings are also updated on a few commands missed earlier.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152381820
2017-04-10 13:41:51 -04:00
Ben McIlwain
bd696b4b92 Remove invalid {css $name} syntax
{css $foo} does not do anything. the correct syntax is

{css selector} (no dollar sign)
or
{css $prefix, selector}

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152375039
2017-04-10 13:40:21 -04:00
nickfelt
2be31e79ef Convert DeletionRequest to use @AutoValue.Builder
It has 5 parameters, which is pushing it for a static factory method, and we're anticipating adding more for work that Larry is doing.  Using a builder is preferable here since it makes it harder to accidentally mis-order the parameters (since @AutoValue's generated constructor is sensitive to parameter ordering).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152328220
2017-04-10 13:38:47 -04:00
mcilwain
4606b1d08e Only inject EPP metric builder in a single place
This fixes recording of number of attempts and command name on EPP
flows, which was broken because a separate metric builder was
being injected in two places, EppController and FlowRunner, with the
one injected into FlowRunner being discarded rather than having changes
applied to the same instance as in EppController.

This also adds a test that the metric is created successfully inside
a flow. Note that tests already exist for EppController to ensure that
the metric is recorded correctly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152306596
2017-04-10 13:37:18 -04:00
nickfelt
794743c7bc Fix registrar console to show type-less registrar contacts
RegistrarContacts are allowed to have no "types" specified (they can also have multiple types).  However, the registrar console displays the contacts for the logged-in registrar grouped by type into sections, and contacts with no type were simply being omitted from the listing, which was confusing because you can't even log into the console unless your email is listed as a contact, and yet you might then visit the contact settings page and see (apparently) no configured contacts.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152302159
2017-04-10 13:35:44 -04:00
jianglai
09393dc8ce Apply status during creation for domain create restricted TLDs
When a TLD is domain create restricted, every domain that is created under it will have both SERVER_TRANSFER_PROHIBITED and SERVER_UPDATE_PROHIBITED status applied on it. This way after a domain is created no registrar can change any settings on it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152266535
2017-04-10 13:34:12 -04:00
larryruili
69cf0d4b55 Add response information to TldFanoutAction
TldFanoutAction now returns an HTTP response detailing the actions it's taking.
The format is as follows:

OK: Launched the following 3 tasks in queue the-queue
- Task: task-a6ad250b-a9d8-427d-bbf7-eb736e6f4dcb, tld: com, endpoint: /the/servlet/com
- Task: task-cf6c4bb4-0542-411e-ae4d-723beec09e9c, tld: net, endpoint: /the/servlet/net
- Task: task-57899661-fc3f-4049-a265-d6604051406e, tld: org, endpoint: /the/servlet/org

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152264954
2017-04-10 13:32:41 -04:00
jianglai
87a9d27299 Remove domain create restriction check in non-create flows
Since domain create restriction only applies to closed TLDs, flows like domain application create and domain application update does not apply, as the TLD never goes through sunrise period. Removing checks for domain create restrictions in these flows.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152260673
2017-04-10 13:31:11 -04:00
guyben
47870f98eb Add UpdateKmsKeyringCommand to update keys in the KMS Keyring
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152253868
2017-04-10 13:26:43 -04:00
nickfelt
ef3977e837 Remove unused injected ClientScopeQualifier
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152253768
2017-04-10 13:25:11 -04:00
larryruili
7359cc13b8 Implement retry for transient errors in WHOIS server
We now attempt to retry Whois queries in the event of a short-lived error. Currently, we consider 'DatastoreTimeoutException' and 'DatastoreFailureException' as transient.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152044934
2017-04-05 10:18:23 -04:00
guyben
c3df4e26a3 Add GetKeyringSecretCommand to retrieve keyring secrets.
Cloned from CL 149476124 by 'g4 patch'.
Original change by shikhman@shikhman:registry-secrets-2:897:citc on 2017/03/07 15:37:09.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151950797
2017-04-05 10:13:45 -04:00
mountford
62c7a3935a Add nomulus tool command to delete a TLD
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151863632
2017-04-05 10:10:38 -04:00
guyben
bb70fcb66d Refactor KmsKeyring and KmsUpdater to use a centralized serializer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151853998
2017-04-05 10:09:06 -04:00
jianglai
ff9c72097c Add Registrar Account Data view in BigQuery snapshot
This adds a new view table that contains the registrar id, the currency-specific billing account id and the corresponding currency in latest_billing dataset based on latest_snapshot dataset.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151363209
2017-04-05 10:06:04 -04:00
jianglai
190be064cb Add billingAccountId to BillingData table
Join RegistrarAccountId table to BillingData to append additional billingAccountId column

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151362466
2017-04-05 10:04:32 -04:00
nickfelt
91c2558feb Make FlowRunner log ICANN activity report field name
As part of b/36599833, this makes FlowRunner log the appropriate ICANN activity
report field name for each flow it runs as part of a structured JSON log
statement which can be parsed to generate ICANN activity reports (under the key
"icannActivityReportField").

In order to support this, we introduce an annotation for Flow classes called
@ReportingSpec and a corresponding enum of values for this annotation, which is
IcannReportingTypes.ActivityReportField, that stores the mapping of constant
enum values to field names.

The mapping from flows to fields is fairly obvious, with three exceptions:

 - Application flows are all accounted under domains, since applications are
   technically just deferred domain creates within the EPP protocol
 - ClaimsCheckFlow is counted as a domain check
 - DomainAllocateFlow is counted as a domain create

In addition, I've added tests to all the corresponding flows that we are
indeed logging what we expect.

We'll also need to log the TLD for this to be useful, but I'm doing that in a
follow-up CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151283411
2017-03-27 13:32:57 -04:00
mcilwain
b03bd3b525 Remove UNRESERVED as a reservation type
This is a follow-up to Lai's refactoring of the get reservation types
code to return a set rather than a single type. Since we're always
returning a set now, the more natural way to represent a label that is
not reserved is to return an empty set rather than a set containing
UNRESERVED.

Also fixes some minor style issues I ran across regarding static
importing and test method naming that I ran across (no logic
implications).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151132116
2017-03-27 13:31:33 -04:00
mcilwain
4260fb573f Use the actual EPP command flow name for EppMetrics
It was previously only using the name of the inner command XML element,
e.g. "Create", "Delete", "Update", etc. This wasn't very useful because
there was no way to discriminate between operations on different types
of EPP resources.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151131491
2017-03-27 13:30:05 -04:00
nickfelt
0d32b6b7b2 Remove MakeBillingTablesCommand credit data views
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151130847
2017-03-27 13:28:33 -04:00
ctingue
c6a1c3d870 Clean up minor items found during DiRT
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151125802
2017-03-27 13:25:35 -04:00
mmuller
5ffb424682 Add a "loadtest" command to nomulus tool
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151034721
2017-03-27 13:16:35 -04:00