Coder Social home page Coder Social logo

netsec-ethz / scionlab Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 15.0 2.74 MB

SCIONLab user interface and administration

Home Page: https://www.scionlab.org

License: Apache License 2.0

Python 90.45% CSS 0.44% HTML 5.41% Shell 1.92% Ruby 1.65% Dockerfile 0.14%

scionlab's People

Contributors

andreatulimiero avatar anotherkamila avatar cmeury avatar code-review-doctor avatar dependabot[bot] avatar fl99kl avatar fr4nk-w avatar juagargi avatar marcfrei avatar matzf avatar mkowalski avatar mlegner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scionlab's Issues

Admin: make AS core/non-core

Add an admin action to promote/demote an AS.

  • Update TRC
  • Update affected AS certificates -- deal with issuing AS removed from the core!
  • Need to determine how to best handle AS links (e.g. remove all or automatically promote/demote).

User AS: details, create, edit

Create a Form: prompting for:

  • attachment point
  • label (optional)
  • VM?
  • VPN? (if available on the selected attachment point?)
  • if not VPN:
    • IP
    • NAT: internal IP, internal port (optional)
  • port

Create a View to create a new user AS using this form. On submit, this will:

  • generate/assign an AS-identifier
  • generate keys and certificates for this AS
  • create an AS object in the DB with:
    • ISD set to the ISD of the attachment point
    • exactly one Host object, with IP=localhost
    • one Service object for each of the "normal" AS services (ZK, BS, CS, PS)
    • a Link to the attachment point
    • VPN, if configured
  • (later: trigger updates for attachment point)
  • redirect to the AS detail page

Create a View to see the details of and edit an existing AS, using this form. On submit, this will:

  • update certificates if attachment point changed to different ISD
  • update the properties (as above)
  • redirect to the same page

Not part of this issue: trigger configuration update for attachment point

Attachment Point: allow configuring Host running border-routers

Currently, when creating a UserAS, the Host running the corresponding border router interface on the attachment point is selected using the function AttachmentPoint.get_host_for_useras_interface which simply makes a sensible choice.
If we have a setup with an attachment point AS running on many different hosts, we may have to make this configurable.

Add regression tests for config generation

The end-to-end tests will be great to determine whether the generated configuration actually works, but it will still be useful to have tests that verify that the generated configuration is identical to a known baseline (for faster feedback during development and to narrow down the cause of broken end-to-end tests). Maybe, we can simply check-in entire config tar.gz files and compare against those.

Frontend: styling for existing form templates

Most templates have been created without styling, forms are rendered plainly using form.as_p.
Try to use django-crispy-forms for form rendering.

  • registration/activation forms
  • login/logout and password change forms
  • user_as_add/user_as_details: form already looks decent, consider using crispy to simplify the code

Setup CI and tests

Setup the continuous integration system & provide guidelines for adding tests. This should cover

  • unit tests (standard python unittest)
  • django tests
  • webtest and/or selenium

Data Migration: assessment

Check that current configuration can be adequately represented in new data model. Determine the required steps to import the data into the new coordinator & create issues.

Infrastructure:

  • SCION config
  • VPNs
    • Note: we don't need to migrate the configuration of the point-to-point VPNs used e.g. to connect to GEANT into the data model.

Coordinator:

  • User meta data
  • User ASes
  • ?

Certificate renewal before expiration

All the TRCs and Certificates have an expiration timestamp. Currently, this is just set "far enough" in the future to avoid having to deal with this. With all the functionality to update and re-issue certificates we already have in place, it is should be easy to set a mechanism that updates certificates before they expire.
We should be able to use recurring tasks from huey for this (adding huey is already on the way).

Admin: configuration check

Add an admin action to check the current network topology configuration for problems.

  • ASes have all the required services configured
  • All ASes connected to it's ISD cores
  • No port clashes
  • etc.

Note: related to #46; all the checks proposed there as validation can also be double-checked here.

User AS: transition from old Coordinator to new one

Plan and validate and implement the solution.
The requirements are:

  • User ASes running automated updates will continue working seamlessly.
  • There will be a script (or similar tool) to update dedicated machines running user ASes.
  • Both VPN and direct connection must be supported.
  • The ASes are authenticated via account_id and account_secret at least the first time they contact the new Coordinator.

Configuration deployment

  • Add an API to obtain the full configuration for a host, as a tar.gz-ball, containing

    • generate the updated gen/ folder for the attachment point
    • generate the updated VPN server configuration

    The parameters for the API are

    • an identifier & a secret for the Host (assume we'll use https)
    • the version of the configuration previously deployed, if any

    The response is

    • 304 not changed, if the config version supplied is already the latest version
    • 200 and a tar ball, if the config has changed
    • 204 no content, if the config fpr the host is empty
  • Add a script/binary (sh, python, go?) to run on the host, which will query this API, unpack the config tar-ball and restart services as required.

    For user-ases, running this script may be used as alternative to manually downloading and unpacking the tar ball.

    For "managed" Hosts, this update-config script is run either

    • triggered on the host by a timer or similar event
    • triggered by the scionlab server

    Note: might be able to re-use the script created created in netsec-ethz/scion-coord#299

  • Add a functionality to the scionlab server to trigger this config deployment on managed hosts. Either using ansible or plain ssh.
    This triggering should

    • asynchronous
    • rate limited ?
    • avoid multiple simultaneous processes for the same target host

User AS: generate configuration tarball

Add a function to generate the configuration tarball for a user AS. This should include:

  • a README, either for dedicated or VM setups
  • the gen/-folder, generated for the (unique) host of a user AS (see #8)
  • VPN config (see #10)
  • Vagrantfile, if VM setup

Generate AS configuration

Add a new function create_gen(host, directory)
For one Host object, generate the configuration for the gen-folder, by traversing all the related Interface and Service objects.
Always write a configuration for sciond.

Attachment Point: automatic configuration update

After every change to a user AS, the configuration of the related attachment points (two APs involved if the user changes the attachment point) needs to be updated.

  • The deployment of the configuration to the AP should be triggered immediately, but with a limited rate (e.g. at most once per minute)
  • For each host, only deployment process may be active at any given time
  • The deployment should obviously be run asynchronously (with whatever django/python mechanism is most suitable)

Note: If required (e.g. due to VPN-IP-assignment issues) we can re-implement the "updates pending" status, to disallow further changes to the user AS before the deployment has been completed. For now, I'd like to be optimistic that we can solve these issues without such a status.

Depends on #7 #13

Mixed IPv4/6 support for attachment points

For the infrastructure ASes we can support using IPv4/6 by (manually) setting a per-Interface public_ip. For the APs, we'd have to automatically choose which address to configure, based on whether the user configured a IPv6 address. Currently, there is no field in the model where the options for IPv4/6 addresses could be stored; a Host has only one default public_ip.

Image builder

Add back support for image builder.

Low priority. Image builder might be entirely replaced by having binary packages.

Admin: validation

In the admin pages, creating/changing links can create an invalid SCION network topology.

We should implement proper validation to avoid creating impossible configurations:

  • no PARENT/CHILD loops
  • CORE links only between core ASes
  • no PARENT links for core ASes
  • no PARENT/CHILD links outside of ISDs

Other things that can be validated (less important):

  • multiple VPNServers on same host must use different subnet
  • multiple VPNClients on same host must use different IP

Generate VPN configuration

Add a function to generate the VPN client configuration for a Host: write_vpn_client_config(host).
Add a function to generate the VPN server configuration for a ManagedHost: write_vpn_server_config(host)

Note: this should support multiple VPN clients on the same host.

Add tests for deployment queue tasks

The integration of the huey for the config deployment tasks is fairly fiddly. We should have unittests that only test the actual fiddling with huey.

Somewhat tricky to set this up for testing because the huey consumer needs to run in a separate process.

User: main page and AS list view

Create the main page for a user: this contains

  • a friendly greeting
  • a list of the user's ASes with "edit" links to the detail pages
  • a button to create a new AS, enabled only if quota not exceeded

UserAS status checks

Gather status info from attachment points / core-ASes.
This should then enable to automatically disable UserASes that have not been active for some time.

User: adapt user model

Adapt the default user model to:

Adapt the django_registration.forms.RegistrationForm and the corresponding template (depends #3).

See notes on extending django user model:

DB: Configure PostgreSQL

Configure PostgreSQL instead of sqlite as the DB backend, at least in the production configuration.

UserAS: validation of IPs

Need to ensure that IP addresses given by user are safe to use in the attachment point configuration.

  • Not localhost / ip6-localhost etc.
  • No broadcast addresses
  • other?

Frontend: dynamic UserAS form

The UserAS creation/edit form needs a little bit of JavaScript logic for the following dynamic behavior:

  • VPN option should only be shown/enabled if the selected attachment point supports VPN
  • Public IP/bind IP settings should be hidden if VPN is enabled
  • The bind-address settings should be hidden/collapsed ("My host is behind NAT")

Related: #31

overlay file missing

The file under gen/overlay is missing when generating the configuration. Without it, at least the current BS refuses to start.

User registration

Use the "two-phase" registration model from django-registration: https://django-registration.readthedocs.io/en/3.0/

Frontend: landing page and site navigation

Create a nice landing page.

  • Introduction
    • What is SCION
    • What is SCIONLab
    • What is a (SCION-)AS
    • -> Register to run your own ASes today ๐Ÿ˜‰
  • Pictures
  • Login/register buttons/form

Add/populate navbar, hamburger menu with "my ASes", "logout" and "password change" and link to scion-architecture, tutorials etc.

Revisit rate limiting for AP deployment

Currently implemented by a simply delaying for one minute before actually running the update. All updates during this time will be bundled together. This introduces unnecessary delay.

Generate Certificates and TRC

As first step of configuration deployment, the AS certificates and TRC need to be generated if marked as needs_update.

Generate supervisord configuration for scion-apps

The models contain options to configure a bandwidth-test-server (Service.BW) and pingpong-server (Service.PP). During the generation of the gen/ folder, these are currently ignored in the code.

Add a supervisor config file to start these services.
A starting point is _create_gen in generate.py:

for service in host.services.filter(type__in=SERVICE_TYPES_CONTROL_PLANE):
instance_name = service_names[service]
generator.generate_instance_dir(archive, as_, service.type, topo_dict, instance_name)
processes.append(instance_name)
sciond_name = "sd%s" % as_.isd_as_path_str()
generator.generate_sciond_config(archive, as_, topo_dict, sciond_name)
processes.append(sciond_name)

OpenVPN: add UDP/TCP server configuration

Currently have (manually configured) servers that use UDP/TCP setup; two openvpn servers one UDP, one TCP, both handing using the same address range for VPN addresses, using an address-learn-script to explicitly set routing rules per client.
We'll need this, or something similar again to have "no UDP" fallback.

Data Migration: enter infrastructure topology

Create a script that creates the data model representation for the existing SCIONLab infrastructure topology (somewhat analogous to the current fixtures/testtopo.py).

This should:

  • create the AS,es Hosts, Routers/Interfaces/Links, Services (etc)
  • import keys/certificates

The idea is to start using the new coordinator to start configuring (some of) the scionlab infrastructure hosts.
The attachment points will not yet be included, but we could still create them as "dummy" entries.
(Let's not bother with the VPN settings yet).

Support of public, dynamic IP addresses

Many home users have public IP addresses but those are dynamically changing (e.g. users connected over DSL or LTE). Those users could be supported by relying on a static hostname (such as one assigned through dyndns) instead of VPN, thereby avoiding performance degradation.

Profiling of UserAS pages and config generation

Profiling of the DB models and queries. Can be based on the existing tests. Preferrably also using PostgreSQL.
The goal is to detect big performance problems early and make the necessary adjustments to the data model.

Add `gen/ia` file to config

Add gen/ia file, containing the ISD-AS (no trailing newline) to the config tarball, like the current coordinator does.
Not having this will break web-app and various other scripts/tools/apps that introspect the gen folder.

User AS: download configuration tarball

Add a button to the AS detail view to download the configuration tarball.
This should just generate the tarball and then serve it. If there is a simple way to cache the tarball to disk using django's caching framework, then we should enable that.

Data Migration: configuration verification

Create script to compare generated configuration tar-ball with existing gen/-folders.

  • Sort topology.json, yaml files etc.
  • toml files?
  • supervisor files will have differences, maybe just ignore them

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.