Change UserPolicy to PUBLIC on WHOIS and EPP endpoints

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193407195
This commit is contained in:
jianglai 2018-04-18 13:29:15 -07:00
parent 77bfa5f4b8
commit f289259101
8 changed files with 15 additions and 32 deletions

View file

@ -145,15 +145,6 @@ oAuth:
- <client_id> - <client_id>
``` ```
This service account also needs to be an ["App Engine Admin"](https://github.com/google/nomulus/blob/3dfd141e0fed650b5eb2631b4345220355221b77/java/google/registry/request/auth/UserAuthInfo.java#L31),
which means it needs to granted a role like "Project Viewer":
```bash
$ gcloud add-iam-binding <nomulus-project> \
--member=serviceAccount:<service-account-email> \
--role=roles/viewer
```
### Setup nameservers ### Setup nameservers
The terraform output (run `terraform output` in the environment folder to show The terraform output (run `terraform output` in the environment folder to show
@ -325,15 +316,6 @@ oAuth:
Redeploy Nomulus for the change to take effect. Redeploy Nomulus for the change to take effect.
The project that hosts Nomulus also needs to add this service account as a
project viewer so that OAuth protected endpoints like `/_dr/epp` and
`/_dr/whois` can be accessed by the proxy:
```bash
$ gcloud projects add-iam-policy-binding <project-id> \
--member serviceAccount:<service-account-email> --role roles/viewer
```
Also bind the "Logs Writer" and role to the proxy service account so that it can Also bind the "Logs Writer" and role to the proxy service account so that it can
write logs to [Stackdriver Logging](https://cloud.google.com/logging/). write logs to [Stackdriver Logging](https://cloud.google.com/logging/).

View file

@ -29,7 +29,7 @@ import javax.servlet.http.HttpSession;
@Action( @Action(
path = "/_dr/epp", path = "/_dr/epp",
method = Method.POST, method = Method.POST,
auth = Auth.AUTH_INTERNAL_OR_ADMIN auth = Auth.AUTH_PUBLIC_OR_INTERNAL
) )
public class EppTlsAction implements Runnable { public class EppTlsAction implements Runnable {

View file

@ -9,7 +9,6 @@ terraform {
module "proxy" { module "proxy" {
source = "../../modules" source = "../../modules"
proxy_project_name = "YOUR_PROXY_PROJECT" proxy_project_name = "YOUR_PROXY_PROJECT"
nomulus_project_name = "YOUR_NOMULUS_GPROJECT"
gcr_project_name = "YOUR_GCR_PROJECT" gcr_project_name = "YOUR_GCR_PROJECT"
proxy_domain_name = "YOUR_PROXY_DOMAIN" proxy_domain_name = "YOUR_PROXY_DOMAIN"
proxy_certificate_bucket = "YOU_CERTIFICATE_BUCKET" proxy_certificate_bucket = "YOU_CERTIFICATE_BUCKET"

View file

@ -3,12 +3,6 @@ resource "google_service_account" "proxy_service_account" {
display_name = "Nomulus proxy service account" display_name = "Nomulus proxy service account"
} }
resource "google_project_iam_member" "nomulus_project_viewer" {
project = "${var.nomulus_project_name}"
role = "roles/viewer"
member = "serviceAccount:${google_service_account.proxy_service_account.email}"
}
resource "google_project_iam_member" "gcr_storage_viewer" { resource "google_project_iam_member" "gcr_storage_viewer" {
project = "${var.gcr_project_name}" project = "${var.gcr_project_name}"
role = "roles/storage.objectViewer" role = "roles/storage.objectViewer"

View file

@ -1,9 +1,6 @@
# GCP project in which the proxy runs. # GCP project in which the proxy runs.
variable "proxy_project_name" {} variable "proxy_project_name" {}
# GCP project in which Nomulus runs.
variable "nomulus_project_name" {}
# GCP project from which the proxy image is pulled. # GCP project from which the proxy image is pulled.
variable "gcr_project_name" {} variable "gcr_project_name" {}

View file

@ -56,6 +56,17 @@ public enum Auth {
AuthLevel.USER, AuthLevel.USER,
UserPolicy.PUBLIC), UserPolicy.PUBLIC),
/**
* Allows anyone access, as long as they use OAuth to authenticate.
*
* Also allows access from App Engine task-queue. Note that OAuth client ID still needs to be
* whitelisted in the config file for OAuth-based authentication to succeed.
*/
AUTH_PUBLIC_OR_INTERNAL(
ImmutableList.of(AuthMethod.INTERNAL, AuthMethod.API),
AuthLevel.APP,
UserPolicy.PUBLIC),
/** /**
* Allows only admins or App Engine task-queue access. * Allows only admins or App Engine task-queue access.
*/ */

View file

@ -49,7 +49,7 @@ import org.joda.time.DateTime;
* @see WhoisHttpAction * @see WhoisHttpAction
* @see <a href="http://www.ietf.org/rfc/rfc3912.txt">RFC 3912: WHOIS Protocol Specification</a> * @see <a href="http://www.ietf.org/rfc/rfc3912.txt">RFC 3912: WHOIS Protocol Specification</a>
*/ */
@Action(path = "/_dr/whois", method = POST, auth = Auth.AUTH_INTERNAL_OR_ADMIN) @Action(path = "/_dr/whois", method = POST, auth = Auth.AUTH_PUBLIC_OR_INTERNAL)
public class WhoisAction implements Runnable { public class WhoisAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();

View file

@ -1,6 +1,6 @@
PATH CLASS METHODS OK AUTH_METHODS MIN USER_POLICY PATH CLASS METHODS OK AUTH_METHODS MIN USER_POLICY
/_dr/epp EppTlsAction POST n INTERNAL,API APP ADMIN /_dr/epp EppTlsAction POST n INTERNAL,API APP PUBLIC
/_dr/whois WhoisAction POST n INTERNAL,API APP ADMIN /_dr/whois WhoisAction POST n INTERNAL,API APP PUBLIC
/check CheckApiAction GET n INTERNAL NONE PUBLIC /check CheckApiAction GET n INTERNAL NONE PUBLIC
/rdap/autnum/(*) RdapAutnumAction GET,HEAD n INTERNAL NONE PUBLIC /rdap/autnum/(*) RdapAutnumAction GET,HEAD n INTERNAL NONE PUBLIC
/rdap/domain/(*) RdapDomainAction GET,HEAD n INTERNAL,API,LEGACY NONE PUBLIC /rdap/domain/(*) RdapDomainAction GET,HEAD n INTERNAL,API,LEGACY NONE PUBLIC