Alpine Configuration Framework Design

From Alpine Linux

Alpine Configuration Framework

The Alpine Configuration Framework (ACF) is a mvc-style application for configuring an Alpine device. The primary focus is for a web interface - ACF's main goal is to be a light-weight MVC "webmin".

Why Haserl + Lua

Other competitors in the arena were Webmin, Ruby on Rails, PHP with templates.

A full webmin (Perl), RoR or PHP implementation each require several MB of installed code, and can have very slow startup times, especially when used in "cgi" mode. After evaluating many options, we found that Lua has the following advantages:

  • It is small (typically ~200KB of compiled code)
  • It compiles and runs much faster than PHP, Perl or Ruby
  • It provides a "normal" scripting language with features similar to PHP, perl, java, awk, etc.

Haserl + Lua provides a 'good enough' toolset to build a full-featured web application.

Why ACF is MVC

The MVC design pattern is used to separate presentation information from control logic. By MVC we mean:

  • Model - code that reads / writes a config file, starts / stops daemons, or does other work modifying the router.
  • View - code that formats data for output
  • Controller - code that glues the two together

Note the lack of words like: HTML, XML, OO, AJAX, etc. The purpose of ACF's MVC is simply to separate the configuration logic from the presentation of the output.

The flow of a single transaction is:

start -> execute requested function in controller, optionally reading/writing a file using functions in the model -> execute the view to format the output -> end

Every transaction follows this pattern. For ACF developers, the focus should be on getting a model that does a proper job of abstracting the config file into useable entities and then building a controller that presents useable "actions" based on the model. The presentation layer should be last on the priority list.

For good background information on what ACF attempts to do, please see Terence Parr's paper "Enforcing Strict Model-View Separation in Template Engines" at http://www.cs.usfcs.edu or the local copy of the pdf.

ACF Developer's Guides

  1. mvc.lua reference - mvc.lua is the core of ACF
  2. mvc.lua example - build a simple (command-line) application
  3. acf www-controller reference - ACF www application functions
  4. acf www-controller example - webify the above examples
  1. ACF core principles (Things that are standard across the application)
  2. ACF Libraries Document the libraries and common functions

ACF Modules

Networking

Firewall

based on shorewall. Will need an advanced and simple interface

Routing

this is for remote/multi box routing, bgp...etc

Interfaces

Local interface management-local routing taken care of here

DNS

Caching/Hosting/for both Internet and Inside firewall nets

Proxies

Web Proxies

Squid

Web Filtering

Dansguardian

Mail

May Include fetchmail configuration/Relay host/store and forward

Connectivity

VPN

Needs to be split into an administrative end for letting people connect to you(rogue warriors,personal laptop size connectivity) and VPN connectivity to other sites(remote office or location). These are to configured differently.

Dialup

Start/Stop Dialup connection

Dialup/PPPoE

Configure Dialup/PPP/PPPoE connectivity. Maybe other Internet connections that aren't ethernet-which is Interfaces

Backup/Packages

Backup

Way to have save things not in /etc and just kickoff a lbu commit

Source Manager

Way to change the /etc/apk/apk.conf

Package Manager

Way to say what to upgrade-install-remove...apk_*

General

Password Manager

Local password changer

Logfiles

  • General
    • The logfiles-model decides which folders should be listed.
      Based on this list files could be deleted/view/downloaded.
    • By manually entering a filename that doesn't match the logfiles-list you get a error message (wrong files could not be deleted/viewed/...)
  • Delete
    • File is blocked for removal if the file is in use.
      'fuser filename' checks if file is in use at the moment.
  • View
    • Files could be blocked for viewing if this was programmed in the logfiles-model.
      Preparations has been done, but no rules has been defined if some file/files are blocked for viewing.
  • Download
    • Logfiles should be able to be downloaded.

Diagnostic

Stats/Resource use/maybe graphs-rrd