Commit graph

2714 commits

Author SHA1 Message Date
jianglai
a09067c51d Make Cloud Build produce artifact ready for Spinnaker to consume
The artifacts for each service will be packaged inside a tar file that, when untared, is ready for Spinnaker to deploy to GAE.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226516223
2018-12-21 15:55:08 -05:00
mmuller
3d3c0eb9ae Add a set of newly broken tests to the "outcasts" group
Recent changes cause a bunch of new tests to have runtime conflicts.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226499557
2018-12-21 15:55:08 -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
4a4989e2a5 Import the Servlets instead of using full path
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226179113
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
shicong
40b05ffb3c Add a script to generate dependency metadata
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225872347
2018-12-20 07:46:33 -05:00
mmuller
214fb49091 Add "showAllOutput" project property
Added a property to show all test output, useful for debugging.

Usage: ./gradlew -PshowAllOutput=true build
Tested:
  Verified that the property does the right thing for true and false values
  and verified that the build doesn't show test output if it's omitted.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225854375
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
2ec8246097 Add a dependency on the local tools.jar for doc tool generation.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225565675
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
f96da3cb29 Add a cloud build config to upload WAR files to GCS
The private repo structure is re-done to mirror that of the public repo to facilitate easy merging.

Also removed steps to tag the private repos. This will likely cause a race condition if both the nomulus and the proxy cloud build are triggered by the same tag. They will both try to tag the private repo with the same tag.

The tagging of the private repo should happen simultaneously with the public repo tagging, and in an out-of-band process as far as the build process is concerned. The build process should not have side effect on its source.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225544063
2018-12-14 11:29:46 -05:00
shicong
296acf80bb Add build logic to upload dependency JARs
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225539482
2018-12-14 11:28:10 -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
mmuller
b573ec4969 Don't gitignore gradle wrapper jar files
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225421240
2018-12-14 11:23:10 -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
jianglai
d09be1f897 Remove all mentions of MOE in the code base
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225235111
2018-12-13 15:09:09 -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
jakubvrana
4146e69d60 Use goog.html.testing instead of legacy conversions in test
Tested:
    TAP --sample for global presubmit queue
    []    dr-foss-test passes

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225189790
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
c7fc964d9c Add a Gradle task to build the nomulus tool
It'd be nice if we can separate out the tool to its own package and reduce the transitive dependencies that it pulls in. However since the entire core project is a dependency of the tool, it doesn't make any difference as we'd be pulling in core and all its transitive dependencies as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224821931
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
jianglai
9735978b87 Consolidate app engine deployment gradle tasks
Removed duplicate build files for each service, and also added two tasks that runs deployment/staging for all services.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224359198
2018-12-06 13:34:16 -05:00
jianglai
898d0dc0d9 Make gradlew executable in Travis
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224244963
2018-12-06 13:32:41 -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