Exemple #1
0
def bootstrap_dev_server_acls():
    """Adds localhost to IP whitelist and Swarming groups."""
    assert utils.is_local_dev_server()
    if auth.is_replica():
        return

    bots = auth.bootstrap_loopback_ips()

    auth_settings = config.settings().auth
    admins_group = auth_settings.admins_group
    users_group = auth_settings.users_group
    bot_bootstrap_group = auth_settings.bot_bootstrap_group

    auth.bootstrap_group(users_group, bots, 'Swarming users')
    auth.bootstrap_group(bot_bootstrap_group, bots, 'Bot bootstrap')

    # Add a swarming admin. [email protected] is used in
    # server_smoke_test.py
    admin = auth.Identity(auth.IDENTITY_USER, '*****@*****.**')
    auth.bootstrap_group(admins_group, [admin], 'Swarming administrators')

    # Add an instance admin (for easier manual testing when running dev server).
    auth.bootstrap_group(
        auth.ADMIN_GROUP,
        [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')],
        'Users that can manage groups')
Exemple #2
0
def bootstrap():
    """Adds 127.0.0.1 as a whitelisted IP when testing."""
    if not utils.is_local_dev_server() or auth.is_replica():
        return

    # Allow local bots full access.
    bots = auth.bootstrap_loopback_ips()
    auth.bootstrap_group(FULL_ACCESS_GROUP, bots,
                         'Can read and write from/to Isolate')

    # Add a fake admin for local dev server.
    auth.bootstrap_group(
        auth.ADMIN_GROUP,
        [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')],
        'Users that can manage groups')
Exemple #3
0
def bootstrap():
  """Adds 127.0.0.1 as a whitelisted IP when testing."""
  if not utils.is_local_dev_server() or auth.is_replica():
    return

  # Allow local bots full access.
  bots = auth.bootstrap_loopback_ips()
  auth.bootstrap_group(
      FULL_ACCESS_GROUP, bots, 'Can read and write from/to Isolate')

  # Add a fake admin for local dev server.
  auth.bootstrap_group(
      auth.ADMIN_GROUP,
      [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')],
      'Users that can manage groups')
Exemple #4
0
def bootstrap_dev_server_acls():
  """Adds localhost to IP whitelist and Swarming groups."""
  assert utils.is_local_dev_server()
  if auth.is_replica():
    return

  bots = auth.bootstrap_loopback_ips()
  auth.bootstrap_group(BOTS_GROUP, bots, 'Swarming bots')
  auth.bootstrap_group(USERS_GROUP, bots, 'Swarming users')

  # Add a swarming admin. [email protected] is used in
  # server_smoke_test.py
  admin = auth.Identity(auth.IDENTITY_USER, '*****@*****.**')
  auth.bootstrap_group(ADMINS_GROUP, [admin], 'Swarming administrators')

  # Add an instance admin (for easier manual testing when running dev server).
  auth.bootstrap_group(
      auth.ADMIN_GROUP,
      [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')],
      'Users that can manage groups')
Exemple #5
0
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.

import webapp2

from components import auth
from components import utils


class WarmupHandler(webapp2.RequestHandler):
    def get(self):
        auth.warmup()
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
        self.response.write('ok')


assert utils.is_local_dev_server()
auth.disable_process_cache()

# Add a fake admin for local dev server.
if not auth.is_replica():
    auth.bootstrap_group(
        auth.ADMIN_GROUP,
        [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')],
        'Users that can manage groups')

# /_ah/warmup is used by the smoke test to detect that app is alive.
app = webapp2.WSGIApplication([webapp2.Route(r'/_ah/warmup', WarmupHandler)],
                              debug=True)
Exemple #6
0
from google.appengine.api import datastore_errors
from google.appengine.ext import ndb

from components import auth
from components import utils


class WarmupHandler(webapp2.RequestHandler):
  def get(self):
    auth.warmup()
    self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
    self.response.write('ok')


assert utils.is_local_dev_server()
auth.disable_process_cache()

# See components/auth/change_log.py, is_changle_log_indexed.
ndb.add_flow_exception(datastore_errors.NeedIndexError)

# Add a fake admin for local dev server.
if not auth.is_replica():
  auth.bootstrap_group(
      auth.ADMIN_GROUP,
      [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')],
      'Users that can manage groups')

# /_ah/warmup is used by the smoke test to detect that app is alive.
app = webapp2.WSGIApplication(
    [webapp2.Route(r'/_ah/warmup', WarmupHandler)], debug=True)