GUI editor to tame mod_security rules

⌈⌋ ⎇ branch:  modseccfg


Check-in [3438ff4aed]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Wrap .msg text
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3438ff4aedaf3d657ce42db659bc19e2c7aef59728939d3fdab9d33343014f0e
User & Date: mario 2020-11-18 21:38:35
Context
2020-11-19
15:44
Reshuffle directive categories, add 0640 in place of "octal_mode" check-in: 01df5b822a user: mario tags: trunk
2020-11-18
21:38
Wrap .msg text check-in: 3438ff4aed user: mario tags: trunk
21:37
Introduce decorators for main window (reduce common if id/vh/confn checks) check-in: 119712007a user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modseccfg/ruleinfo.py.

14
15
16
17
18
19
20





21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#


import re, json
from modseccfg import utils, vhosts, icons
from modseccfg.utils import conf
import PySimpleGUI as sg







def show(id, log_values=None):

    # display options
    class m(dict):
        head = dict(font=("Ubuntu", 20, "bold"))
        sect = dict(font=("Ubuntu", 13, "bold"))
        msg = dict(font=("Ubuntu", 14, "italic"), pad=(50,0))
        grp = dict(font=("Sans", 12, "italic"), pad=(50,0))
        val = dict(font=("Sans", 11, "italic"), pad=(50,0))
        desc = dict(text_color="gray")
        phase = dict(background_color="yellow")
        block = dict(background_color="orange")
        deny = dict(background_color="red")
        audit = dict(background_color="lightgray")







>
>
>
>
>








|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#


import re, json
from modseccfg import utils, vhosts, icons
from modseccfg.utils import conf
import PySimpleGUI as sg
import textwrap


def wrap(s, w=60):
    return "\n".join(textwrap.wrap(s, w))


def show(id, log_values=None):

    # display options
    class m(dict):
        head = dict(font=("Ubuntu", 20, "bold"))
        sect = dict(font=("Ubuntu", 13, "bold"))
        msg = dict(font=("Sans", 13, "italic"), pad=(50,0))
        grp = dict(font=("Sans", 12, "italic"), pad=(50,0))
        val = dict(font=("Sans", 11, "italic"), pad=(50,0))
        desc = dict(text_color="gray")
        phase = dict(background_color="yellow")
        block = dict(background_color="orange")
        deny = dict(background_color="red")
        audit = dict(background_color="lightgray")
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    # params 2 widget
    r = vhosts.rules[id]
    layout = [
        [sg.T(f"SecRule {id}", **m.head)],
        [sg.Frame("doc", layout=[[sg.Multiline(r.help(), auto_size_text=1, size=(60,4), background_color="lightgray")]], size=(90,4))],
    ]
    for key in "msg", "vars", "pattern":
        layout.append([sg.T(key, **m.sect), sg.T(getattr(r, key), **m_(key, m.val))])
    for key in "flags", "params", "ctl", "setvar", "tags":
        grp = getattr(r, key)
        if not grp:
            continue
        layout.append([sg.T(key, **m.sect)])
        if type(grp) is list:
            for v in grp:







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    # params 2 widget
    r = vhosts.rules[id]
    layout = [
        [sg.T(f"SecRule {id}", **m.head)],
        [sg.Frame("doc", layout=[[sg.Multiline(r.help(), auto_size_text=1, size=(60,4), background_color="lightgray")]], size=(90,4))],
    ]
    for key in "msg", "vars", "pattern":
        layout.append([sg.T(key, **m.sect), sg.T(wrap(getattr(r, key)), **m_(key, m.val))])
    for key in "flags", "params", "ctl", "setvar", "tags":
        grp = getattr(r, key)
        if not grp:
            continue
        layout.append([sg.T(key, **m.sect)])
        if type(grp) is list:
            for v in grp: