You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because fail2ban has a long history and so important nowadays I wonder why no syntax for vim is available.
The format of filters doesn't match to any I searched.
Scrub
I wrote a little f2bf syntax file. It's working "so-lala", so I post it, maybe somebody can tell me a similar syntax or will goint to extent it.
" Vim syntax file
" Language: Fail2ban Filter
" Maintainer: Khamsong M. Khounlivong
" Latest Revision: 2023
if exists("b:current_syntax")
finish
endif
syn keyword f2bfFilterNames failregex datepattern ignoreregex journalmatch maxlines contained
syn keyword f2bfFixme FIXME TODO XXX NOT contained
syn match f2bfKey "^[^=]\{-}\ze=" contains=f2bfFilterNames contained
syn match f2bfValue "^\s\_.\{-}$" contains=f2bfEnv contained
syn match f2bfValue "=\zs.*$" contains=f2bfEnv contained
" from here is order relevant
syn region f2bfKeyValuePair start=/^[^=]\+=/ end=/^#/me=s-1 contains=f2bfKey,f2bfValue,f2bfComment
syn region f2bfKeyValuePair start=/^[^=]\+=/ end=/^[^=]\+=/me=s-1 contains=f2bfKey,f2bfValue,f2bfComment
syn region f2bfKeyValuePair start=/^[^=]\+=/ end=/^\[/me=s-1 contains=f2bfKey,f2bfValue,f2bfComment
syn match f2bfHeader /^\[.\+\]/
syn match f2bfComment "^#.*$" contains=f2bfFixme
syn keyword f2bfEnv HOST contained
hi def link f2bfHeader Special
hi def link f2bfFixme Todo
hi def link f2bfKey Type
hi def link f2bfValue String
hi def link f2bfFilterNames Function
hi def link f2bfComment Comment
hi def link f2bfTestKey Type
hi def link f2bfEnv Function
hi def link f2bfTestValue String
let b:current_syntax = "f2bf"
" vim: ts=2
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Status
Because fail2ban has a long history and so important nowadays I wonder why no syntax for vim is available.
The format of filters doesn't match to any I searched.
Scrub
I wrote a little f2bf syntax file. It's working "so-lala", so I post it, maybe somebody can tell me a similar syntax or will goint to extent it.
Beta Was this translation helpful? Give feedback.
All reactions