awall crasches if a enabled policy loses it's policy-file
This would most likely not happen too often.
But it /could/ happen for various reasons. And when/if it happens, then
users will need to have good understanding of awall in order to resolve
from the problem.
Reproduce the problem this way:
cat <<EOF > /usr/share/awall/optional/testpolicy.json
{
"description": "Testpolicy"
}
EOF
awall enable testpolicy
So far nothing special.
Now to the situation that the file disappears for some reason (corrupt
file, accidental removal, other unknown reason)
rm /usr/share/awall/optional/testpolicy.json
awall list
Above will produce a error that looks something like:
/usr/bin/lua: /usr/share/lua/5.1/awall/policy.lua:128: Import failed: testpolicy
stack traceback:
[C]: in function 'error'
/usr/share/lua/5.1/awall/policy.lua:128: in function 'loadJSON'
/usr/share/lua/5.1/awall/policy.lua:150: in function 'require'
/usr/share/lua/5.1/awall/policy.lua:156: in function 'load'
/usr/share/lua/5.1/awall/policy.lua:244: in function 'list'
/usr/sbin/awall:115: in main chunk
[C]: ?
I haven’t found any way to solve the issue by using awall (I didn’t try
awall flush because then I lose ssh connection to the box).
The only way to solve this (as I can find out) is to:
- Recreate the missing file
- Remove broken symlink from /etc/awall/
Maybe those are the right way to solve the issue - but still I think it
would be good if awall could handle the situation where a file is
missing instead of crashing.
Maybe have ‘awall list’ display a warning that the enabled policy is
missing it’s file (or broken for some reason). Maybe even give a example
on how to resolve the problem.
(from redmine: issue id 1449, created on 2012-10-23, closed on 2012-11-02)
- Changesets:
- Revision f03aa51c by Kaarle Ritvanen on 2012-10-30T09:14:39Z:
mention policy file path in error message when reading fails
fixes #1449