Commit graph

1809 commits

Author SHA1 Message Date
weiminyu
6022353e57 Enable daily backup of Datastore in sandbox and production
This uses the new backup implementation, and starts after
the old exportSnapshot task has completed. The old task
will be removed later.

Daily backups in alpha has been running successfully.

Manually triggered exports in both environments also completed
successfully.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=227908077
2019-01-08 10:55:13 -05:00
guyben
9eaeab9cfe Allow query parameters in the connection's endpoint
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=227898246
2019-01-08 10:53:35 -05:00
mcilwain
a81d45fe5d Fix stdout of DeleteAllocationTokensCommand
It was saying it was deleting tokens it wasn't, because it was outputting the
raw input list of tokens rather than the list that filtered out redeemed or
domain-specific tokens.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=227769266
2019-01-08 10:51:55 -05:00
mcilwain
577c6f6bc9 Add a mapreduce to delete all domain applications
This also deletes associated entities including indexes and history entries.

This needs to run as a prerequisite to [] which deletes all domain
application code entirely. The entities themselves need to be deleted first so
that loading DomainBases in the future doesn't accidentally get applications
which the code no longer knows how to handle.

This deletion is safe to perform because the only remaining applications in our
system are historical and we no longer refer to them. Backups will be retained
in BigQuery.

This mapreduce will be deleted at the same time that the DomainApplication code
is.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=227738528
2019-01-08 10:50:16 -05:00
guyben
2af24c945c Tweak the registrar-ote-setup web console
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=227736173
2019-01-08 10:48:35 -05:00
guyben
566f60d495 Allow using empty string to remove all whitelisted IPs
Currently, you have to set "--ip_whitelist=null", which is unintuitive.

This adds the option to just give an empty string: "--ip_whitelist="

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=227550896
2019-01-08 10:41:42 -05:00
jianglai
2e7d71b238 Refactor most of OT&E verification code to exist in utils class
This does not change existing functionality but will allow us to use this common code in the yet-to-be-created web console action as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=227159346
2019-01-02 11:58:36 -05:00
guyben
2777018d6a Add the ability to setup OT&E from the web console
We create a new endpoint with a simple form that will let admins (including
support) setup OT&E for registrars.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226570568
2019-01-02 11:56:59 -05:00
mcilwain
040319a95d Reduce # of manual instances in production and sandbox
Steady state QPS for prod is <30 on both default and pubapi, so number of instances can easily be brought safely down to 15 & 10 instances.  Sandbox has negligible steady state QPS (especially on pubapi), so it is brought even lower.  Note that, if we have any issues with these levels, we can increase them instantly using the nomulus set_num_instances command, without having to do another release or a rollback; this is therefore low risk.

Note that we'll want to go back to 100 instances for the first day of .dev sunrise as well as the entire week of EAP and first day of GA.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226566822
2019-01-02 11:55:18 -05:00
jianglai
9e155f14c0 Add support to bazel 0.21.0
Also fixes the build.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226493872
2018-12-21 15:55:08 -05:00
shicong
f83e96c448 Exit with error code when user is not logged in
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226390329
2018-12-21 15:55:08 -05:00
emcmanus
a153f8ec77 Switch remaining App Engine dependencies to built-at-head targets
Most dependencies on the Old SDK were switched in [] This is just catching up on some OAuth dependencies that remained and some remaining uses of Old build rules.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226337284
2018-12-21 15:55:08 -05:00
guyben
7ade0f0adb Fix the monospace font so the screendiff tests work correctly
see b/34094769 for context

The webdriver tests don't choose a correct font when we specify "monospace". As a result, we don't render correctly pages that use monospace.

Here we instead explicitly reference a monospace font we know exists in the webdriver: Courier New.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226233831
2018-12-21 15:55:08 -05:00
mmuller
2cc4a9fb2f Add MOE equivalence[s] for 2018-12-13 sync
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225418342
2018-12-21 15:55:08 -05:00
guyben
1975218f45 Mark nullable parameters as nullable
A few nullable parameters were not marked as nullable, which causes exceptions
to be thrown in debug mode.

This had no effect in the deployed web server, because these assert sanity
checks aren't performed - but on our local test server this failed.

Note that all these fields are checked for "nullness" in the code itself. It's
just an oversight in the declaration.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226187227
2018-12-20 07:46:33 -05:00
guyben
51f22a15ed Move SendEmailUtils to the /ui/server directory
SendEmailUtils is a general utility of the web console, and not specifically "only"
to the Registrar console.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226187094
2018-12-20 07:46:33 -05:00
mcilwain
56b61ad5a2 Invalidate premium list cache on update
This will only affect the tools service, the primary use case being (1) I go to
create a domain through nomulus tool, realize it's premium, (2) update the
premium list to not include that domain, (3) kill the tools service instance to
wipe out the cached premium value, then (4) create the domain at standard. This
commit eliminates step 3.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226180160
2018-12-20 07:46:33 -05:00
guyben
da5a8796b8 Allow XSRF to be sent as POST parameter in addition to HTML header
HTML headers can only be sent via JS, we need this change to allow
secure POST form submission.

The form itself will have a hidden "input" tag  with the XSRF token in it. This
is how other framework do it as well - see
https://en.wikipedia.org/wiki/Cross-site_request_forgery#Synchronizer_token_pattern

This is in preparation for the OT&E setup page, which will be a simple form
with a "submit" button, so using JS for it is overkill.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226178070
2018-12-20 07:46:33 -05:00
guyben
7c9b2172fd Set a "nicer" margin value for textareas
Currently there's a margin on the top, making the textarea be unaligned with
the text naming it. This is annoying on the eye, and will be more annoying in
the OT&E cl that will be added soon.

- So why not just do this change in that CL?
- Because the changes in the Screenshot tests here are irrelevant to that CL
  and I found make it harder to actually review the actual screenshots we're
  adding there.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226057985
2018-12-20 07:46:33 -05:00
jianglai
27b6231053 Add the ability to provide credential JSON file to the nomulus tool
This allows us to run nomulus tool programmatically on environments that do not
allow the 3-legged OAuth authentication flow.

The provided JSON file corresponds to a service account, which must have
GAE admin permission and whose client ID must be whitelisted in the config
file.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226008337
2018-12-20 07:46:33 -05:00
guyben
9d6a7ef66a Create OT&E entities directly, instead of calling sub-commands
This is in preparation for having a web-console endpoint to create OTE.

In addition - we streamline the code:

- we remove support for different premium lists
- we remove support for different DNS writers - we never want a "real" DnsWriter for OTE
- we remove support of --eap_only, because we don't need it anymore
- We use a single password for all the Registrars

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225841694
2018-12-20 07:46:33 -05:00
guyben
1004ef5621 Allow unsetting of the support email group, disabling "support users"
In addition to just making good sense to not have support group for some
environments (local? unittest? crash?) - connecting with G Suit requires
additional permissions that are harder to find.

Specifically, it requires the Json Credentials that just aren't set in the
Dummy Keyring used on some environments.

So we make sure to not even *try* to create the credentials if the support
email isn't set

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225589255
2018-12-20 07:46:33 -05:00
mmuller
4b425973e0 Add MOE equivalence[s] for 2018-12-13 sync
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225418342
2018-12-20 07:46:33 -05:00
jianglai
b27a49c1b4 Allow for a longer timeout in the nomulus tool
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225440541
2018-12-14 11:26:32 -05:00
mcilwain
4491b7b909 Make loadByForeignKey() and related methods return Optional
This is safer and addresses a common source of confusion in the codebase because it's always explicit that the resource returned may not be present, whether because it's soft-deleted when projected to the given time or because it never existed in the first place.

In production code, the presence of the returned value is always checked. In test code, its presence is assumed using .get() where that is expected and convenient, as it not being present will throw an NPE that will cause the test to fail anyway.

Note that the roughly equivalent reloadResourceByForeignKey(), which is widely used in test code, is not having this same treatment applied to it. That is out of the scope of this CL, and has much smaller returns anyway because it's only used in tests (where the unexpected absence of a given resource would just cause the test to fail).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225424002
2018-12-14 11:24:49 -05:00
mcilwain
4d676a09d3 Add the 'login' command to gtech_tool
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225394580
2018-12-13 15:12:25 -05:00
mmuller
c396957d15 Isolate customizable code in activity reporting
Modularize the code for DNS count reporting to allow it to be customized for
more flexible systems.
Tested:
  Uploaded to alpha with hacks to allow admin initiating and logging from the
  DnsCountQueryCoordinatorModule, verified that the provider function is invoked and
  that the action runs successfully.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225225587
2018-12-13 15:07:29 -05:00
jianglai
6966151bed Remove Google-internal auth mechanism
Nomulus tool will be using OAuth to communicate to GAE endpoints exclusively starting with next week's release. As far as I can tell that is the only part of the system that uses Google-internal auth). We can therefore remove the it after next week's release.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225221102
2018-12-13 15:05:44 -05:00
jianglai
377736e987 Add an option to perform login on remote machines
If the user runs "nomulus -e [ENV] login --remote", an URL will be provided, the user then can visit the URL on any machine (not necessary where the command is run) and copy&paste back the authorization code to complete authorization.

This makes it easy to login on machines where local browsers are not easily accessible.

Also upgraded nebula lint version to 10.3.5.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225198700
2018-12-12 13:22:34 -05:00
mcilwain
015c854a92 Make loadByForeignKeyCached() return an Optional type
Next up (and a much larger commit) will be giving loadByForeignKey() the same
treatment.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225182377
2018-12-12 13:22:34 -05:00
mcilwain
400994237c Require SSL certificate hash on login by default
Note that it's possible to set a config option to disable this functionality
on a per-environment basis (we're disabling it for sandbox), but in general
SSL certificate hashes should be required for increased security.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225053496
2018-12-12 13:22:34 -05:00
jianglai
0a44ef0dca Refactor EppXmlTransformer to be in the model/ package
This will allow us to perform the OT&E history verification
in the model/ package as well so that it can be used both
by both the UI and the command line tool.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225007167
2018-12-12 13:22:34 -05:00
mcilwain
f58211402a Add an unrenew_domain command to nomulus tool
This is used to reduce the expiration time of domain(s) by some number of years
(if enough length remains in the registration term to do so). This does not back
out the previously saved BillingEvent entities as they may have already been
sent out and invoiced, so any related refunds must be handled out of band.

In addition to reducing the registration expiration time on the domain itself,
this command writes out a new history entry, one-time poll message informing the
registrar of this change, auto-renew billing event and poll message, and
updates/ends the old auto-renew billing event and poll message.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224999285
2018-12-12 13:22:34 -05:00
weiminyu
9c706e79fd Backup Datastore using the Admin REST API
Add server end points to backup Datastore using managed-export mechanism.
A cron job is defined in Alpha to run daily exports using this implementation.

Existing backup is left running. The new backups are saved to a new set of
locations:
- GCS bucket: gs://PROJECT-ID-datastore-backups
- Big Query data set: datastore_backups
- Big Query latest back up view name: latest_datastore_backup
Also, the names of Bigquery tables now use the export timestamp
assigned by Datastore. E.g., 2018_12_05T23_56_18_50532_ContactResource,

After the new import mechanism is implemented and the back-restore flow is
tested, we will stop the existing backup runs and deploy the new
implementation to all environments.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224932957
2018-12-12 13:22:34 -05:00
jianglai
ea154a8378 Refactor threat emails for daily+monthly usage
Eventually the Publish action will control daily/monthly sending and provide
the correct threats to email. The goal of this PR is to entirely separate
the "sending email" functionality from the "parsing threat matches"
functionality.

The PublishAction will figure out if the monthly emails should be sent out,
then will ask the Spec11ThreatMatchesParser for the monthly threats (if
appropriate) and the new threat matches for today. It will then pass those
matches and the appropriate email subject+body to the email utils class,
whose only job is to format and send the emails.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224869643
2018-12-12 13:22:34 -05:00
guyben
4dad0a8a73 Fix checkState failing to trigger retrier's retry
We have a retrier wanting to call a function, retrying on
IllegalStateExceptions (thrown by checkState()).

However, one of the checkStates is called inside a Concurrent.transform, so
when the checkState fails, the resulting IllegalStateException is wrapped in an
UncheckedExecutionException and isn't caught by the retrier.

We unwrap the IllegalStateException to make sure it's caught.

Q: Why not just catch UncheckedExecution exception?
A: Because it might wrap a different exception which we don't want to retry on.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224862573
2018-12-12 13:22:34 -05:00
shicong
5bc70cbc99 Update lastEppUpdateTime after certain grace period is passed
The lastEppUpdateTime should be updated asynchronously in the situations below:

 - Implicit transfer success after 5 day pending transfer period
 - Implicit end of any grace period

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224831791
2018-12-12 13:22:34 -05:00
jianglai
a85544b3f6 Use gson to make JSON string in proxy log formatter
This is simpler than using fasterxml.jackson.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224583713
2018-12-12 13:22:34 -05:00
jianglai
57a53db84e Make FOSS proxy treat connections with unknown sources more gracefully
When a connection to the proxy using the PROXY protocol (https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt) comes from an IP address that the external load balancer does not recognize, make the source IP 0.0.0.0. This way an appropriate WHOIS quota can be configured for this kind of connections.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224583547
2018-12-12 13:22:34 -05:00
jianglai
305b1edc85 Switch all added usages of java.time to be joda.time
This is for consistency, mostly the LocalDate fields added in []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224525451
2018-12-12 13:22:34 -05:00
jianglai
68320ebad8 Remove the Google internal time dependency
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224417526
2018-12-12 13:22:34 -05:00
jianglai
ec26e3a96a Run the Spec11 pipeline daily without sending emails
Add a sendSpec11Email parameter that allows us to only send the email on
one run per month. Next, we will compute the diffs between the daily runs
and send daily emails with those diffs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224404653
2018-12-12 13:22:34 -05:00
jianglai
3ef8cd692d Add MOE equivalency for 2018-11-05 sync
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224209323
2018-12-12 13:22:34 -05:00
weiminyu
7d380256af Add helper methods to DatastoreAdmin Operation object
These are needed by Datastore export management actions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224242281
2018-12-06 13:30:56 -05:00
jianglai
a612e9bf66 Use local credential to deploy beam pipelines
We are moving away from using Application Default Credentials generated by "gcloud auth application-default login" in our code base and consolidate on using self-managed credentials provided from AuthModule.

One of the remaining dependencies on the ADCs is from beam pipeline deployment commands, which by default use the ADCs to talk to GCS and upload the jar files and templates. In this CL, we explicitly provide the locally created credential to the Options used in deployments.

Also moved all credential qualifiers to CredentialModule, and removed @AppEngineAdminApiCredential, which is no longer used.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224199812
2018-12-05 16:07:54 -05:00
jianglai
fdda03eb53 Use local GoogleCredential in the nomulus tool
The scenarios in which the credential is used are:

1) Calls to Nomulus GAE HTTP endpoints.
2) Calls to Google APIs within the tool.
3) Calls to GAE APIs within the tool.

From now on the tool should not depend on ADCs created from gcloud any more (expect for beam pipeline deployments which need some more investigation as the dependency on ADC is not apparent). Using the nomulus tool requires running "nomulus login" first, but only once.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224165735
2018-12-05 16:06:19 -05:00
jianglai
5f9aad90fc Configure client id and client secret in the config file
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224158599
2018-12-05 16:04:08 -05:00
jianglai
6352b8a01a Use self-managed credential in remote api installer
RemoteApiOption has a package-private method that takes a Stream representing the content of a JSON and use a GoogleCredential created from it as its credential. This CL uses reflection to change the access modifier of that method in order to supply a credential stream that is self-managed. This is obviously not ideal and prone to breakage in case the getGoogleCredentialStream method is changed. Unfortunately upstream is not willing to make it public citing the reason that GoogleCredential.fromStream() (which getGoogleCredentialStream uses) is a @Beta annotated function (see https://groups.google.com[]forum/#!searchin/domain-registry-eng/remoteapioptions%7Csort:date/domain-registry-eng/Flsah6skszQ/CySZv2XEBwAJ). However this function is introduced 5 years ago as a public function (b857184bfa). I think at this point it is safe to assume that it is part of the widely used APIs and will not change without sufficient notice.

Note here that RemoteApiOptions creates its own copy of GoogleCredential to be used to call App Engine APIs locally, whereas communications to Nomulus endpoints use the Credential provided in AuthModule. Even though both credentials are created from the same client id, client secret and refresh token (the three elements needed to construct a GoogleCredential this way, see https://github.com/googleapis/google-api-java-client/blob/master/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.java#L842), their refreshes cycles are independent of each other. I verified that refreshing one of the credential does not invalidate the access token of the other credential, as long as it is not expired yet.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224156131
2018-12-05 16:02:28 -05:00
jianglai
aeedc427ad Remove the ability to download service account credentials
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224034254
2018-12-05 16:00:51 -05:00
guyben
a3a60075a0 Hide the edit/add buttons for fields the user can't update
Currently the /registrar-settings backend endpoint will fail to update any
OWNER fields that a non-OWNER tries to change.

However, the front-end (soy, js) still allow non-OWNERs to try and change
these fields (there's the "edit" or "add" button, and it only fails when you try to "save")

This CL changes the front-end to remove the ability for non-OWNERs to even try
and change these fields. However, it will still let them *view* these fields as
it has interesting and important information.

-------------------------------

In addition - it changes the webdriver tests to include the "edit buttons". Those were never tested before, and now we will test to see if they are indeed displayed or not.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=223845883
2018-12-03 19:25:05 -05:00