Commit graph

1720 commits

Author SHA1 Message Date
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
weiminyu
9c280f99b1 Update marksdb test download url
Marksdb changed the testing url to work with their
SSL certificate.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212277787
2018-09-11 14:15:23 -04:00
weiminyu
be18f55640 Switch to new Json credential provisioning
As part of credential consolidation, update the credential provisioing
in StackDriver Module. This is the only module that will continue using
Json-based credential.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211878151
2018-09-08 00:21:22 -04:00
mcilwain
22e1d905b6 Default to admin registrar in check_domain commands
The vast majority of the time this is the registrar client ID you want, so
there's no reason to require specifying it everything each time. These are
read-only commands anyway, so the potential negative effects are minimal.

See the existing lock/unlock_domain commands for existing occurrences of this
behavior.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211857712
2018-09-08 00:19:53 -04:00
mcilwain
72bfd43e00 Add octothorpes to disclaimer in exported reserved list
There's no real standard for commented lines in a CSV, but this seems to be the
most well-supported option, so may as well use it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211847395
2018-09-08 00:18:19 -04:00
weiminyu
9436ce6f0e Introduce simplified Default credential provision
As the first step in credential consolidation, we replace
injection of application default credential in for KMS and
Drive.

Tests:
- for Drive, tested with exportDomainLists and exportReservedTerms.
- For KMS, used CLI commands (get_keyring_secret and update_kms_keyring) to change and
  restore secret for one key.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211819859
2018-09-08 00:16:09 -04:00
mmuller
4c3207647f Remove ServerSideCommand
ServerSideCommand now just aggregates CommandWithConnection and
CommandWithRemoteApi, so it's arguably clearer for commands to just implement
both of these.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211670031
2018-09-08 00:14:30 -04:00
mmuller
8a2388f5b6 Rename RemoteApiCommand to CommandWithRemoteApi
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211521742
2018-09-08 00:12:31 -04:00
mmuller
e43349592d Allow AppEngineConnection to target services other than "tools"
This change required several things:
- Separating out the interfaces that merely do HTTP calls to the backend from those
  that require the remote API (only load the remote API for the latter).  Only the
  tools service provides the remote api endpoint.
- Removing the XSRF token as an authentication mechanism (with OAUTH, we no longer
  need this, and trying to provide it requires initialization of the datastore
  code which requires the remote API)

I can't think of a compelling unit test for this beyond what already exists.
Tested:
  Verified that:
  - nomulus tool commands (e.g. "list_tlds") work against the tools service as they
    currently do
  - The "curl" command hits endpoints on "tools" by default.
  - We can use --server to specify endpoints on the default service.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211510454
2018-09-08 00:10:06 -04:00
mountford
8d131a52bd RDAP: Add registrar entities to nameserver query results
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211462672
2018-09-08 00:08:29 -04:00
larryruili
c5e6eae555 Add Spec11 registrar emailing mechanism
This adds the terminal step of the Spec11 pipeline- processing the output of
the Beam pipeline to send an e-mail to each registrar informing them of
identified 'bad urls.'

This also factors out methods common between invoicing (which uses similar beam pipeline tools) and spec11 to the common superpackage ReportingModule + ReportingUtils classes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=210932496
2018-09-08 00:06:53 -04:00
mmuller
e4bb1c281c Uncomment crontab entry for deleteProberData
This was only supposed to stay commented out until load-testing was complete.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=210087917
2018-09-08 00:04:26 -04:00
mmuller
7068f758b1 Disallow creating CDNS zones for sandbox TLDs
Do not allow the user to create TLDs on sandbox that aren't of the form
"*.test.".  If real TLDs are created, they will block users from registering
names under that TLD for the nameserver set that we're using for sandbox.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209983482
2018-09-08 00:01:13 -04:00
jianglai
ee97d7c2cd Update max pod number to 10
This should not cause any waste as the pods are only scaled up when necessary.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209881536
2018-09-07 23:59:39 -04:00
mcilwain
7b87ba41c7 Delete all Limited Release Program (LRP) code
We never used it and don't have any plans to use it going forward. All
conceivable parts of its functionality that we might use going forward have
already been subsumed into allocation tokens, which are a simpler way of
handling the same use case that are also standards-compliant.

Also gets rid of the hideous ANCHOR_ prefix on anchor tenant EPP authcodes
that was only ever necessary because of overloading the authcode for
anchor tenant creation. Going forward it'll be based on allocation tokens,
so there's no risk of conflicts.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209418194
2018-08-20 14:28:16 -04:00
larryruili
f7bc17fbe8 Update input/output of Spec11 pipeline to final format
This changes the BigQuery input to the fields we ultimately want (fqdn,
registrarName, registrarEmailAddress) and the output to a structured POJO
holding the results from the API. This POJO is then converted to its final text output, i.e.:

Map from registrar e-mail to list of threat-detected subdomains:
{"registrarEmail": "c@fake.com", "threats": [{"url": "a.com", "threatType": "MALWARE"}]}
{"registrarEmail": "d@fake.com", "threats": [{"url": "x.com", "threatType": "MALWARE"}, {"url": "y.com", "threatType": "MALWARE"}]}

This gives us all the data we want in a JSON structured format, to be acted upon downstream by the to-be-constructed PublishSpec11ReportAction. Ideally, we would send an e-mail directly from the beam pipeline, but this is only possible through third-party providers (as opposed to app engine itself).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209416880
2018-08-20 14:26:46 -04:00
mountford
7dcadaecf6 RDAP: Always use summary output format for registrar entities
For domains (and soon for hosts as well), we output data about the owning registrar. These subrecords wind up being really big if we include all data, because they also list all the registrar contacts. To avoid bloating the RDAP responses, change to output domain response registrar information in summary format, meaning we skip the registrar contacts and events. The requester can still get this information by using the link provided to request the registrar directly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209189993
2018-08-20 14:25:13 -04:00
jianglai
0065e52d84 Log remote IP when EPP SSL handshake fails
This makes it easy to debug issues when registrars cannot finish SSL
handshake. There's no privacy concerns because we keep a record of the
registrars' IP address in our whitelist anyway.

The remote address attribute it set by the ProxyProtocolHandler, which runs before anything is done. The GCLP added the protocol header at the beginning of a stream, so we know that by the time handshake is finished (successful or not), this key must be set.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209169683
2018-08-20 14:23:40 -04:00
mcilwain
d2f849ac0f Add new reserved domain creation from allocation tokens mechanism
Note that this gets rid of anchor tenant codes in reserved lists (yay!), which
are no longer valid.  They have to come from allocation tokens now.

This removes support for LRP from domain application create flow (that's fine,
we never used it and I'm going to delete all of LRP later).  It also uses
allocation tokens from EPP authcodes as a fallback, for now, but that will be
removed later once we switch fully to the allocation token mechanism.

This doesn't yet allow registration of RESERVED_FOR_SPECIFIC_USE domains using
the allocation token extension; that will come in the next CL.  Ditto for
showing these reserved domains as available on domain checks when the allocation
token is specified.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209019617
2018-08-20 14:22:06 -04:00
jianglai
782643ce33 Log all exceptions thrown at the end of the pipeline
The RelayHandler is installed at the end of a channel pipeline (both frontend and backend). If it does not log the exception, it will be regarded and unhandled exception, which shows up in logs, but does not log the corresponding channel.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208984756
2018-08-20 14:20:32 -04:00
jianglai
8a1c99e22b Only log EPP and WHIOS connections
Only connections that have backend are of interest to us. Move the logging
statement accordingly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208898433
2018-08-20 14:15:56 -04:00
jianglai
fc75e08061 Change access token validity and remove logging
The access token renewal on GCE is not what we expected. The metadata server always returns the same token as long as it is valid for 1699 to 3599 seconds and rolls over to the next token on its own schedule. Calling refresh on the GoogleCredential has no effect. We were caching the token for 30 min (1800 seconds), so in a rare case where we "refreshed" the token while its expiry is between 1699 and 1800 seconds, we will cache the token for longer than its validity. [] shorted the caching period to 10 min and added logging, which proved to be working. We no longer need the log any more now that the root cause has been identified. Also changed the cache period to 15 min (900 seconds) which should still be good.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208888170
2018-08-20 14:14:21 -04:00
jianglai
301301cafe Remove some unnecessary loggings from the proxy
We confirmed that the retry is working. Instead of logging the messages them
selves, we only need to log the message hash to ensure that the same message is
retried.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208883712
2018-08-20 14:12:44 -04:00
mmuller
3dba385213 Remove special Cloud DNS configuration from sandbox.
Removing this stanza from the config will cause sandbox to write to production
cloud dns, which is what we want.

Likewise, exclude sandbox in addition to production in the create_cdns_tld
command from the environments that point to staging.

Cloud DNS has 3 environments that we would consider using:
- staging which is reset every week, so we can't use it for sandbox
- testing, which is not accessible from external App Engine
- production

Because of the difficulties with the first two, we've decided to use production.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208834786
2018-08-20 14:09:33 -04:00
jianglai
d878f4ba2d Tweak access token refresh time
There's a very rare error where our access token is denied by GAE which happens a couple of seconds a day (if it happens at all). There doesn't seem to be anything wrong on our side, it could be just that the OAuth server is flaky. But to be safe, the refresh period is shortened. Also added logging to confirm what is refreshed. Note that the logging is at FINE leve, which only actually write to the logs in non-production environment.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208823699
2018-08-20 14:07:59 -04:00
jianglai
c5c0051f5e Ensure that no reference counted objects leak memory
The objects stored in the relay buffer may leak memory when they are no longer used. Alway remember to release their reference count in all cases.

Also save the relay channel and its name in BackendMetricsHandler when the handler is registered. This is because when retrying a relay, the write is sent as soon as the channel is connected, and the channelActive function is not called yet.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208757730
2018-08-20 14:06:24 -04:00
jianglai
4965478cce Correctly retry relay of reference counted objects
It turns out in the edge case where a write occurs at the same moment that the
relay connection is terminated, the current retry mechanism is not sufficient
because it stores reference coutned objects whose internal buffers are already
freed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208738065
2018-08-20 14:03:18 -04:00