Skip to content

Instantly share code, notes, and snippets.

@ikedas
Last active December 26, 2018 04:18
Show Gist options
  • Save ikedas/77871bb3688205869522e2439231036b to your computer and use it in GitHub Desktop.
Save ikedas/77871bb3688205869522e2439231036b to your computer and use it in GitHub Desktop.

Extending format of sympa.conf / robot.conf

Plan:

  • Content of some other config files under $SYSCONFDIR will also be included.
  • Schema for list config and site/robot config may be merged together.

Example:

domain mail.example.org
listmaster user@example.org
lang ja
db_type SQLite
db_name /var/lib/sympa/sympa.sqlite
archive.quota 1024
bounce.warn_rate 50
wwsympa_url https://web.example.org/sympa
auth.generic_sso.0.service_name       InQueue Federation
auth.generic_sso.0.service_id         inqueue
auth.generic_sso.0.http_header_prefix HTTP_SHIB
auth.generic_sso.0.email_http_header  HTTP_SHIB_EMAIL_ADDRESS
auth.generic_sso.1.service_name       SSO in my organization
auth.generic_sso.1.service_id         mysso
auth.generic_sso.1.http_header_prefix HTTP_SHIB
auth.generic_sso.1.email_http_header  HTTP_SHIB_EMAIL_ADDRESS
auth.user_table.regexp .*
auth.user_table.negative_regexp evil-user@.+

Notes:

  • archive.quota: Currently named default_archive_quota corresponding to archive.quota in list config.
  • bounce.warn_rate: Currently named bounce_warn_rate corresponding to bounce.warn_rate in list config.
  • auth.*: Currently they are included in auth.conf with "paragraph" format as:
    generic_sso
      service_name       InQueue Federation
      service_id         inqueue
      http_header_prefix HTTP_SHIB
      email_http_header  HTTP_SHIB_EMAIL_ADDRESS
    
    generic_sso
      service_name       SSO in my organization
      service_id         mysso
      http_header_prefix HTTP_SHIB
      email_http_header  HTTP_SHIB_EMAIL_ADDRESS
    
    user_table
      regexp .*
      negative_regexp evil-user@.+
    
    

Deserialization:

This will be decoded and stored in memory as following structure.

$site_config = {
    domain => 'mail.example.org',
    listmaster => 'user@example.org',
    lang => 'ja',
    db_type => 'SQLite',
    db_name => '/var/lib/sympa/sympa.sqlite',
    archive => {
        quota => '1024',
    },
    bounce => {
        warn_rate => '50',
    },
    wwsympa_url => 'https://web.example.org/sympa',
    auth => {
        generic_sso => [
            {
                service_name => 'InQueue Federation',
                service_id => 'inqueue',
                http_header_prefix => 'HTTP_SHIB',
                email_http_header => 'HTTP_SHIB_EMAIL_ADDRESS',
            },
            {
                service_name => 'SSO in my organization',
                service_id => 'mysso',
                http_header_prefix => 'HTTP_SHIB',
                email_http_header => 'HTTP_SHIB_EMAIL_ADDRESS',
            },
        ],
        user_table => {
            regexp => '.*',
            negative_regexp => 'evil-user@.+',
        },
    },
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment