Code Monkey home page Code Monkey logo

config.berlin.freifunk.net's Introduction

config.berlin.freifunk.net Freifunk Berlin IPAM

Our ip address management system is basically a running NIPAP instance (see https://spritelink.github.io/NIPAP/ ) with two frontends:

How to install nipap for development

The following is mostly outdated. Just follow https://spritelink.github.io/NIPAP/docs/INSTALL.html and use the prebuilt packages.

How to run nipap-wizard for development

You need to have python-virtualenv installed

Install

$ git clone https://github.com/freifunk-berlin/config.berlin.freifunk.net.git nipap-wizard
$ cd nipap-wizard
$ virtualenv --python=python3 venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ cp config.cfg.dist config.cfg
$ vim config.cfg     # add MAIL_PORT = 1025 for development

We use flask-migrate for database creation and migrations. To create our database and tables you have to use the following commands:

$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade

Dev Server (including dev smtp server for emails)

$ python -m smtpd -n -c DebuggingServer localhost:1025
$ flask run 

config.berlin.freifunk.net's People

Contributors

andrenarchy avatar booo avatar dependabot[bot] avatar nicolasberens avatar noki avatar sarumpaet avatar slomo avatar svenroederer avatar sys3175 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

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

config.berlin.freifunk.net's Issues

Make HTTPS mandatory

Neither config.berlin.freifunk.net nor ca.berlin.freifunk.net use mandatory HTTPS despite actual user data getting transmitted. Also, both should set HSTS and X-Frame-Options headers.

add_header Strict-Transport-Security max-age=31536000;
add_header X-Frame-Options "SAMEORIGIN";

quick hack: non-expert form

Just to let everyone know, I changed the file /var/www/nipap-wizard on config.berlin.freifunk.net at line number 19 from
API_POOL_HNA = 'HNA IPv4'
to
API_POOL_HNA = 'Mesh IPv4'

add ipaddress to requirements.txt

Without the ipaddress in the requirements.txt I can't start the uwsgi instance because manage.py imports './scripts/legacy_importer/init.py' that imports ipaddress. Should I add the dependency or should I remove the legacy_importer?

Gracefull error Handling

Currently, when something goes wrong the app just responds with a generic error page.

We should at least create a custom one, or, better, one that also hints to what went wrong.

add PicoStation M2 to router list

The PicoStation is not available in the list of supported Freifunk routers. The router can be flashed using the Bullet M firmware. Prebuilt firmware images already exist in the ar71xx directory.

Summarized IPs

There should be a possibilty to get an email with a summary of IPs assigned to me.

replace tl-cpe210.jpg with tl-cpe210-v1.jpg

cosmetic issue only:
I would suggest to replace
config.berlin.freifunk.net/app/static/img/router/tl-cpe210.jpg
which is pointing to kathleen firmware within
config.berlin.freifunk.net/default.cfg
with an image clearly pointing out "v1" HW Revision

This will make the site more consistent and hopefully this will help newbies to avoid buying Hardware not already supported, or at least let them ask for matching builds for v1.1 via mailing list?!
See also here.

add an option to lookup lat/lon

The user should configure a lat/lon in the freifunk assistent. If we provide an option to lookup the lat/lon coordinates in config.berlin.freifunk.net we can add this to the mail template with the ip information etc. and the user can copy this information into the assistant.

Add /23 and /22 to options in expert mode

In hopefully extremely rare circumstances it is necessary to have more than a /24 DHCP network. It would be quite useful to be able to request a /23 or /22 network.

Currently it is possible to be lucky and to get two consecutive /24 addresses which can be combined into a larger /23. But this is impractical.

Migrate away from Flask_script

We have a few helper scripts that are run by manage.py using flask-script

usage: manage.py [-?]
                  {db,resetdb,remove_unconfirmed_requests,remove_orphaned_prefixes,import_legacy,get_mails_for_legacy,mail_addresses_for_pools,mail,shell,runserver}
                  ...

 positional arguments:
   {db,resetdb,remove_unconfirmed_requests,remove_orphaned_prefixes,import_legacy,get_mails_for_legacy,mail_addresses_for_pools,mail,shell,runserver}
     db                  Perform database migrations
     resetdb
     remove_unconfirmed_requests
     remove_orphaned_prefixes
     import_legacy
     get_mails_for_legacy
     mail_addresses_for_pools
     mail

flask-script is deprectaed and we should use the flask cli

exhausted ip pool results in internal server error on request of new ips

Requesting IPs from a pool that is exhausted results in an internal server error when using the expert form. We should handle this case properly and tell the user to e.g. request a smaller address range.

From the logs:

2020-01-09 14:09:59,477 ERROR: Exception on /expert/form [POST][in /usr/lib/python2.7/dist-packages/flask/app.py:1423]
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "./app/expert.py", line 40, in expert_form
    prefixes_v6)
  File "./app/utils.py", line 39, in request_create
    get_api().allocate_ips(pool, r.id, r.email, name, prefix_len, 4)
  File "./app/nipap.py", line 135, in allocate_ips
    family, data=data)
  File "./app/nipap.py", line 123, in create_prefix_from_pool
    prefix = self._create_prefix(pool, prefix_type, family, prefix_len, data=data)
  File "./app/nipap.py", line 107, in _create_prefix
    prefix.save(args)
  File "/usr/lib/python2.7/dist-packages/pynipap.py", line 1225, in save
    raise _fault_to_exception(xml_fault)
NipapNonExistentError: no free prefix found

validation errors result in a 500 error

when validations fail, we get the propper error message in the error log. (e.g.
File "./app/forms.py", line 38, in validate_email
raise ValueError('E-Mail stimmt nicht überein.')
)

but the user gets an 500 in return and therefore does not know what went wrong

TL-WR841ND == TL-WR841N?

A user of the firmware told me that he successfully flashed a TL-WR841ND with the TL-WR841N firmware. The "D" usually simply indicates that the antenna is detachable. Maybe we can place a "(D)" to all TL-WR841N models?

IP-Addresses optainable without confirmation

IP-Addresses can be optained from the wizard without validating the e-mail-address by this workflow:

  1. Request IP-Address allocation (amateur mode)
  2. do not validate the email address by not clicking on the link sent to you
  3. request a list of all alloc'd IP-Addresses

In result, a user can get the addresses without validating the email address. The allocation will expire and the addresses will be alloc'd to another user and node. This leads to duplicate addresses, which is bad for the network.

rest service for ip registration

for the new wizard we would like to register IPs during configuration (see freifunk-berlin/firmware-wizard-frontend#9)
is it possible to get a service for ip registration with the following spec?

method: reserveIPs
params: routername, mail, meships count, subnet (yes/no), v6prefix) that sends a mail with an confirmation key
function: reserve IPs and send mail to user with confirmation key
return: success / failure

method: confirmIPs
params: confirmation key, email
function: register ips for the user, send success mail
return: success (json with IPs) / failure

script to write an email to requesters

Maybe we want to notify users about changes or updates. Therefor it would be handy if we have an script to write everyone an email. This would be useful as well for #3.

Feedback on potential pynipap improvements

Hey guys,

so this isn't much of an issue or feature request on this project in itself. Instead I would like to encourage that you open issues / PRs for improvements on pynipap.

I've skimmed through https://github.com/freifunk-berlin/config.berlin.freifunk.net/blob/master/app/nipap.py and find that are a few functions, like get_pool_by_name or get_vrf_by_name, that are wrapping around pynipap that shouldn't really need to be wrapped at all - it should be offered by pynipap straight away.

I would like your feedback on how we can enhance pynipap in such a way that you, and others, don't have to write as much wrapper code to get started with pynipap :)

//kll

Additional /32 ip for LAN

On these Überlassungserklärung setups we do connect a TP-Link WDR3600 with for instance a Nanostation. Therefor we need an additional ip for LAN. For the moment a checkbox in our form should be sufficient.

write howto for wizard

There should be an howto for configuration of a router through the new wizard for beginners.

confirmation-mail: no link for deactivation

I just received a confirmation-mail for a freshly registered address:

Hey,

du hast folgende IPs bekommen:

Mesh-IPs:
 * a.f.f.e/27


Wenn du die IP-Adressen nicht mehr brauchst kannst du sie folgendem Link
löschen:



Grüße
Freifunk Berlin

This mail is missing the link to return the addresses, which should be printed after "folgendem Link
löschen:"

script to migrate 104/8 from old system

We do not want to use these 104.0.0.0/8 ips anymore but it would be good to have them in our system because there are many active devices still configured with them. Therefor we need a script to import data from our old ipam to nipap.

Optimize the last step / result page

  • Add hint to write down or keep the Mesh-IPs and DHCP-Network for later
    -- question rises regarding order of Mesh-IPs and are 3 display, while later only 2 are asked
    -- numbering and explanation needed
  • display Download links as Buttons (I was close to miss them, the visibility was bad)
  • explain difference between those two links for "unexperienced users"

IP-registry: contact owner of an IP-range

Since 2025738 we have a contact-form to notify the owner of an IP-range via an anonymous-link.
What about an contact form where a requestor can enter an IP-address and a message can be sent to the assigned contact. This might helpfull to get a contact in case of Address-missuse / address configuration issues.

allow to request IP-addresses out of the Mesh-range

it seems there is no official way to request "Mesh"-only Ip-addresses from the reserved Mesh-addressrange 10.31.0.0/16.
Using the IP-Expert you will only get addresses from 10.230.0.0/16 (maybe 10.36.0.0/16) which are reserved for DHCP-clients. see http://lists.berlin.freifunk.net/pipermail/berlin/2015-November/030789.html .

Mesh-only hosts are usefull when Routers are connected via OLSR and using B.A.T.M.A.N. (via LAN) to have a singe DHCP-server.

Rewrite: Some Ideas for Rewrite

On 16. September we've met as Community and had a talk on the config wizard. We mostly agreed, that there should be a rewrite. Some requirements for this rewrite could be:

  • handout json-file with node name and ip-addresses (works in conjunction with new FF-wizard)
  • IPv6-assignments also in end user mode
  • automatic ipv6-retrieval for falter-routers already in use
  • change name / addresses of already registered leases, instead of handing back in and make new

To be discussed:

  • provide a way to publicly see, which addresses are alloc'd to which node

@Noki Could you add some nodes, If I was missing something, please?

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.