Commit graph

1696 commits

Author SHA1 Message Date
jianglai
ecdbdbca63 Update terraform version constraint
There is no "google_project" resource managed by terraform, so we are not worried about the new terraform binary destroying/re-creating GAE resources.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217206226
2018-10-17 11:54:34 -04:00
jianglai
476759e861 Update Spec 11 emails body and add a bcc address.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217150650
2018-10-17 11:51:28 -04:00
guyben
8d93cd8edf Refactor SessionUtil, and Add dropdown menu to switch clientId
SessionUtil is renames AuthenticatedRegistrarAccessor, as it's used to access a registrar for an authenticated user.

It will now be injected with the AuthResult instead of receiving it in every function call, since there's only one "legal" AuthResult to use.

The AccessType names are changed from READ_ONLY/READ_WRITE to READ/UPDATE, as it was confusing that a user could have both READ_ONLY AND READ_WRITE access to the same registrar.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216958306
2018-10-17 11:49:50 -04:00
mcilwain
bec7a91cfc Allow choice of Keyring to be configured in YAML
This uses a Dagger-provided map of Keyring implementations, with two currently available,
"KMS" and "Dummy". The active keyring is configured in the YAML file, so we no longer
require MOE directives to choose which one to use for internal/external builds.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216898058
2018-10-17 11:48:12 -04:00
weiminyu
9e02502fd4 Fix bugs exposed by testing with Gradle
The following issues are addressed:
- XML sanitizer should preserve input encoding. Gradle loses any that is not UTF-8. Bazel loses any that is not ASCII.
- Verify that XML sanitizer works with non-UTF8 encoding
- GpgSystemCommandRule breaks when $TMPDIR env variable is not set
- TestDataHelper throws exception when loading resources if resources are plain files on default file system as opposed to being in a jar file.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216537258
2018-10-17 11:44:41 -04:00
mcilwain
218c4517eb Stop exporting EPP flow metrics to BigQuery
These are simply too costly in their current form now that we are handling double-digit QPS, so at a minimum we'd want to refactor these for batched exports using a background thread (like how Stackdriver metrics work). However, upon further review, that work isn't worth doing if this BigQuery table isn't actually being used for anything, and it seems that we aren't using it anymore given that ICANN transaction reporting no longer requires it.

So the simplest thing to do is simply to get rid of this entirely, and just use a combination of Stackdriver metrics and App Engine logs. The eppMetrics BigQuery table is ~1.2 billion rows and takes up 223 GB, so that's not an insignificant GCP billings saving if we can delete it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215905466
2018-10-08 16:59:29 -04:00
jianglai
7b9d562043 Explicitly set terraform version in preparation for the incoming 1.13.0 update
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215806094
2018-10-08 16:59:29 -04:00
jianglai
68bd502ba7 Update apache sshd version
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215783691
2018-10-08 16:59:29 -04:00
jianglai
e3a35f0aa0 Do not include transactions with zero unit price in invoice
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215611195
2018-10-08 16:59:29 -04:00
mcilwain
1586813398 Bypass EAP fees for anchor tenants
Note that the check flow does not yet handle any kind of allocation token
handling at all. Step 2 will be to add allocation token handling there, so a
RESERVED_FOR_ANCHOR_TENANT or RESERVED_FOR_SPECIFIC_USE domain will show as
available instead of reserved if the right token is specified using the
extension. Then once that's done, we can use that information to adjust the
price accordingly as well.

Right now the behavior with a domain check is that reserved domains always show
as reserved, even if they're anchor tenants.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215599350
2018-10-08 16:59:29 -04:00
guyben
1d621bd14d Allow admins read-only access to all registrars
We want to be able to view / test / debug how the registrar console looks for our clients.

However, we don't want to accidentally change the data for registrars, especially in a "non-accountable" way (where we later don't know who did that change)

So we do 2 things here:

- Add a "mode" (read-only and read-write) to the getRegistrarForUser function. We set it according to what we want to do with the registrar. Currently, read-write is only requested for the "update" RegistrarSetting action. Admins will have read-only access to all registrars, but read-write access only to the "admin registrar" (or whatever registrar they are contacts for).

- Support an undocumented "clientId=XXX" query param that replaces the "guessClientIdForUser" function in the original page load. We can then set it when we want to view a different account.

We also change the navigation links on the HTML page to preserve the query.

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

This might be used also for a better user experience for our clients, especially those with multiple "clientId"s (some registrar entities have multiple "registrar" objects)

Currently, they have to have a separate user for each clientId, and only have one user allowed which has both read and write permissions.

Using this change, we can give them the possibility to add users on their own, some with read-only access (to view billing information without being able to change anything), and use a single user for all their clientIds.

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

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215480610
2018-10-03 12:10:28 -04:00
weiminyu
5038fa917c Remove outdated credential modules
All credentials provided by these modules have been
replaced by those in the config/CredentialsModule,
with a new set of Qualifiers. With Dagger 2, a successful
build means that the removal is safe.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215258792
2018-10-03 12:08:55 -04:00
guyben
70273fa791 Fix error reply from RegistrarSettingsAction
RegistrarSettingsAction is a JSON in / JSON out endpoint, meaning the reply is consumed as JSON.

The current state is that if an error occurs, there are two possible replies:
- a JSON error reply is sent out, or
- a 402 HTML reply is sent out with the exception.getMessage()

The difference is only - do we actively catch the exception to translate it to JSON or not.

This fix catches ALL exceptions and translates them to JSON format. Note that there's no security change by giving the getMessage in the JSON reply since we were returning that anyway (in the HTML).

In addition - changed the "gaeUserId" to "user.getEmail" as the identifier, since it's clearer to the users who see that error - and I do want to transition to a more "email identifier" way of checking access (since that's what users put in the registrar contact info)

This too isn't leaking new information because
- the initial HTML page load already gives the user's email, and
- the logs already log the user's email for every request

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215213807
2018-10-03 12:07:20 -04:00
mmuller
2bf06eac77 Add dependency on diffutils
com_google_truth has a dependency on diffutils that we're not exposing.  This
becomes problematic in cases where certain tests fail and the equality check
can't show the difference.  If this happens, instead of the original failure
all we see is a failure to load diffutils.

Note that com_google_truth appears to have some other dependencies that we are
also not exposing, but that so far these have not been problematic.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214774587
2018-10-03 12:04:04 -04:00
mcilwain
aa204be45e Delete unused default registrar referral URL
We now require the URL to be filled out by all registrars and so there is no
default needed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214774054
2018-10-03 12:02:29 -04:00
mcilwain
a7ec72f335 Use correct disclaimer for premium terms export
Looks like a copy-paste error from the reserved list export disclaimer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214773560
2018-10-03 12:00:48 -04:00
mcilwain
3d71012acd Move RDAP Terms of Service into YAML config file
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214642487
2018-10-03 11:59:11 -04:00
guyben
84a0ace2ea Clean up registrar console login flow
Replaced the plethora of inter winding access functions and inputs in SessionUtils with just 2 functions, that both accept the same type for the user (AuthResult):

guessRegistrarForUser: given an AuthResult, finds a registrar that they have access to. If none is found - a ForbiddenException is thrown.

getRegistrarForUser[Cached]: (maybe should be called getRegistrarOnBehalfOfUser?) given an AuthResult and a clientId, loads and returns the registrar ONLY IF the user has access to it. Otherwise throws a ForbiddenException.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214630657
2018-10-03 11:57:34 -04:00
guyben
6bddd5a8cb Send the "resource" ID in each resource action
This is an intermediate CL, part of the Registrar Console cleanup.

TL;DR:
- the current state: resource.js points to a resource TYPE on the server (only registrars can be resources right now), but the specific resource is selected based on the user (we select the "first resource of this type that the user has access to)
- new state: resource.js points to a SPECIFIC resource (TYPE + ID).

In this CL the server still chooses the resource like before (first one that user has access to) but we make sure the returned resource is the same one we requested.

In a subsequent CL we will use the requested ID to load the resource, and then make sure the user has access to that resource.

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

When loading the RegistrarConsole HTML page, the server determines which clientId belongs to the user ("guesses" it by looking for the first registrar that has this user as contact). It sends the relevant clientId back with the page load.

However, this information isn't currently used in the JS requests to read / update the registrar. Instead, currently the client ID is guessed again for each JS access to the server. It is also saved again in the client's "session" cookie.

As a result, it is theoretically possible to have the JS access a different clientID than the original page load (not likely, since it requires a single user registered for multiple registrars AND that the contacts change for the original registrar).

So our goal is to only have a single clientID "value" instead of the 3 we currently have for JS requests (the one from the initial page load, the one saved in the session cookie, the one guessed on the JS request)

As a first step, we send over the "initial page load" clientId on every JS request, and make sure the "session + guessed" value is equal to that one. Later we will remove the "session+guessed" values from the RegistrarSettings, using the "initial page load" clientID instead.

In addition to the "nicer code" implications, having the clientID from the initial page load always used means it'll be easy to have a clientID selection option for users who have access to multiple clientIDs (such as admins)

SECURITY NOTE:the choice of clientID has no security implication since we make sure the user has access to the clientID no matter how we actually choose the clientID on every single server request.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214459506
2018-10-03 11:55:50 -04:00
mcilwain
49e14387e7 Add nomulus command for deleting AllocationTokens
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214459480
2018-10-03 11:54:10 -04:00
mcilwain
9faf7181c3 Index the allocation token's redemption history entry field
We need this to efficiently query which tokens have and have not been redeemed.

I'm also marking it as nullable for consistency with the domain name field (it's
already null for unredeemed tokens).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214366534
2018-10-03 11:52:31 -04:00
guyben
c89cb6a3f3 Automated g4 rollback of changelist 212879670.
*** Reason for rollback ***

Automated tools sometimes don't have default credentials, and can't set them up. We should redo this CL once we figure out the credential thing.

*** Original change description ***

Add metrics for the command used in the registry CLI tool

Puts the metric in <project>/tools/commands_called

It counts the use of the tool, with the following labels:
- environment
- tool (nomulus/gtech)
- command called (class name)
- success true/false
- from the shell true/false

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214048616
2018-10-03 11:50:47 -04:00
guyben
89c942b0d9 Have a resource component receive the "registrar resource" instead of creating it
We have several "consoles" ("views" in the registrar console). They all affect the same resource - the registrar itself.

Currently, each view creates its own "RESTful resource", even though it's the same resource for all of them, meaning we have copied code and copied "URL endpoint" across multiple files.

I assume this was made so that IF one day we have a "view" to another resource, we can easily add it. But we currently don't have any such view, nor plans to add any.

So according to the YAGNI paradigm, it's better to move the resource creation outside of the console.

Also, IF we do add a view to a different resource - it'll still be more readable to have a map from the "view" to the "resource URL endpoint" alongside the existing map from the "view" to the "console"...

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213992967
2018-10-03 11:49:01 -04:00
mcilwain
ae2c1071f1 Change from ES6 Map to old-fashioned object
This fixes the Kokoro tests broken by []

Unfortunately this means that the return type changes from a Map to an Object as well,
so all of the .get() lines need to turn into [].  Yay weakly typed languages. And
apparently in some error conditions this method could already return the Object type
anyway, even if you passed in a Map, so it's just poorly designed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213808477
2018-09-20 11:19:36 -04:00
mcilwain
399cde1291 Add a command-line tool suitable for tech support usage
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213634869
2018-09-20 11:19:36 -04:00
mcilwain
633b30725a Handle Purchase Order numbers explicitly in billing pipeline
Note that these aren't used for most registrars.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213631863
2018-09-20 11:19:36 -04:00
jianglai
3fc7271145 Move GCP proxy code to the old [] proxy's location
1. Moved code for the GCP proxy to where the [] proxy code used to live.
3. Corrected reference to the GCP proxy location.
4. Misc changes to make ErrorProne and various tools happy.

+diekmann to LGTM terraform whitelist change.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213630560
2018-09-20 11:19:36 -04:00
weiminyu
961e5cc7c7 Use @DefaultCredential for Cloud API access in GAE
This change completes the switch to @DefaultCredential for
all use cases in GAE.

Impacted modules:
- IcannReporting
- CreateCdnsTld command
- LoadSnapshot command.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213511730
2018-09-20 11:19:36 -04:00
mcilwain
9bcd5579ef Fix deprecated suppresses and Map type in JS
This properly fixes the issue that was suppressed in [] and
just started breaking today thanks to []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213510500
2018-09-20 11:19:36 -04:00
weiminyu
1f80f58336 Let RegistryTool proceed if MetricWriter is unavailable
This may happen with automated runs off Google Cloud.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213462175
2018-09-20 11:19:36 -04:00
mcilwain
b54b1ea9e4 Use shorter includes on DNS writer packages
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213320963
2018-09-20 11:19:36 -04:00
mcilwain
1d134cdd3f Delete the verify entity integrity mapreduce
We never really used it and it'll be obsolete come Registry 3.0 anyway.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213274520
2018-09-20 11:19:36 -04:00
mcilwain
a483beef28 Add MOE equivalence for 2018-09-14 sync
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212996616
2018-09-20 11:19:36 -04:00
jianglai
8d675a4b8c Remove checking of SNI headers
This is only useful when we used the [] proxy because the GFE requires SNI during handshake in order to request the client certificate. The GCP proxy does not need this (it always requests the client certificate). We do not need to check for its existence.

Also removed the checking of internal headers for ssl cert hash used only by the [] proxy.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213059027
2018-09-14 21:34:44 -04:00
jianglai
8cdba74cab Update dependencies to satisfy strictness and remove -jpl_strict_deps feature
Tested:
    TAP --sample for global presubmit queue
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213040447
2018-09-14 21:33:08 -04:00
larryruili
f36c72cca0 Deploy spec11 reporting to production
This turns on spec11 reporting in production by adding it to the cron.xml, generating the report and sending an e-mail with a list of all problematic registrations to the associated registrar on the 2nd of each month at 15:00Z (11am EST)

This also tweaks the e-mail template a bit according to suggestions from Bruno.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213031440
2018-09-14 21:31:34 -04:00
guyben
cdcd5c2a0e Remove the "create" funtion from the Resource JS class
The original thought was that the actions you can do on a resource is:
- create it
- read it
- update it

(I guess you should have "delete" as well, but that isn't currently there)

Although we use "read" and "update", we never use "create". So having it goes against the YAGNI principle :)

Also, it had a bug: when sending a "create", the opt_newId in send_() would
permanentily change the uri of the request, causing any subsequent request to
go to the wrong endpoint.

By removing the "create" we can simplify the rest of the code (the send_() function).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213029499
2018-09-14 21:29:57 -04:00
mcilwain
8ddbf88151 Remove the deprecated MISTAKEN_PREMIUM reservation type
It doesn't do anything that ALLOWED_IN_SUNRISE doesn't do, and there's no point
in having two separate types when we can simply keep track of the semantic
difference between the two by using different lists (as we have for .soy).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212997752
2018-09-14 21:28:23 -04:00
mcilwain
a9944b8ce0 Remove deprecated DNS subsystem
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212987308
2018-09-14 12:01:08 -04:00
jianglai
5e2831b562 Change how access tokens are refreshed
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212880971
2018-09-14 11:59:39 -04:00
guyben
414b2e4db1 Add metrics for the command used in the registry CLI tool
Puts the metric in <project>/tools/commands_called

It counts the use of the tool, with the following labels:
- environment
- tool (nomulus/gtech)
- command called (class name)
- success true/false
- from the shell true/false

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212879670
2018-09-14 11:58:11 -04:00
weiminyu
e72f5c09a2 Enable Premium terms export in production
Defines cron job in crash, sandbox and production environments.
Job already exists in alpha.

Job is not added to qa environment.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212878436
2018-09-14 11:56:42 -04:00
mcilwain
8de36732cb Delete mapreduce entity cleanup util
This is obsoleted by the upcoming Registry 3.0 migration, after which we will be
using neither the App Engine Mapreduce library nor Cloud Datastore.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212864845
2018-09-14 11:55:12 -04:00
weiminyu
e19a431fab Use new default credentials in a few more modules
Updated Reporting (Beam pipeline), Registrar sync to sheets, and Cloud Dns.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212811185
2018-09-14 11:53:42 -04:00
weiminyu
cbe628b37c Correct wrong description of command
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212641409
2018-09-14 11:50:43 -04:00
guyben
6987d4e55c Add newline after closing boundary in multipart upload of LORDN
According to RFC 2046, the body of the multipart contains:

multipart-body := [preamble CRLF]
                  dash-boundary transport-padding CRLF
                  body-part *encapsulation
                  close-delimiter transport-padding
                  [CRLF epilogue]

The preemble and epilogue are optional, and ignored. However, it's not 100%
explicit whether the CRLFs after the preamble and before the epilogue are
required. The one after the preemble is often not given if there's no preemble,
so it's conceivable that you don't *have* to give the CRLF before the epilogue
if there's no epilogue (it's also enclosed in the [], making it part of the
"optional")

However, it seems that when the TMDB "migrated to the cloud" (as they
describe it) on Aug. 13 2018, they started requiring that CRLF.

TESTED=connected to a TMDB-whitelisted server, used CURL to manually create the
message as we currently send it (without the final CRLF) with junk data and got
the error from the bug. Then sent the exact same message with the additional
CRLF, and got a different error that directly relates to the content of the
junk data.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212637246
2018-09-14 11:49:12 -04:00
weiminyu
80b0e6297b Export Premium names to Drive
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212509587
2018-09-14 11:47:38 -04:00
weiminyu
dbb1f1649d Provide separate scopes list for delegated credentials
Scope changes in delegated credentials require coordinated external changes,
therefore should be separate from those used in the application default
credential.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212488389
2018-09-14 11:43:07 -04:00
weiminyu
5c1d9bd5c3 Refactor DelegatedCredential provisioning for GSuite domains
Updated the registar contact group management, which is the only
use case for this credential.

Also updated GSuite domain delegated admin access config in admin
dashboard for both sandbox (used by alpha and sandbox) and prod.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212320157
2018-09-11 14:18:41 -04:00
mcilwain
1b3df82fb3 Allow creation of reserved domains using allocation tokens
Unlike anchor tenants, these domains can be registered for any number of years,
but only during GA, as third parties cannot register domains pre-GA except
through the anchor tenant program.

Since this is new functionality, unlike creation of anchor tenants, there is no
fallback provided to send codes through the domain authcode; they must be sent
using the allocation token extension.

And note that, like with anchor tenants, providing the domain-specific
allocation token overrides any other reserved types that might apply to that
domain.

No changes are necessary to the domain application create flow because of the
above restriction to GA.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212310701
2018-09-11 14:17:08 -04:00