What are the default paths added to AIDE's database? - aide

Please excuse me for my English ^^'
I'm trying to answer to my title question.
There is the content of my /etc/aide/aide.conf :
# AIDE conf
# The daily cron job depends on these paths
database=file:/var/lib/aide/aide.db
database_out=file:/var/lib/aide/aide.db.new
database_new=file:/var/lib/aide/aide.db.new
gzip_dbout=no
# Set to no to disable summarize_changes option.
summarize_changes=yes
# Set to no to disable grouping of files in report.
grouped=yes
# standard verbose level
verbose = 6
# Set to yes to print the checksums in the report in hex format
report_base16 = no
# if you want to sacrifice security for speed, remove some of these
# checksums. Whirlpool is broken on sparc and sparc64 (see #429180,
# #420547, #152203).
Checksums = sha256+sha512+rmd160+haval+gost+crc32+tiger
# The checksums of the databases to be printed in the report
# Set to 'E' to disable.
database_attrs = Checksums
# check permissions, owner, group and file type
OwnerMode = p+u+g+ftype
# Check size and block count
Size = s+b
# Files that stay static
InodeData = OwnerMode+n+i+Size+l+X
StaticFile = m+c+Checksums
# Files that stay static but are copied to a ram disk on startup
# (causing different inode)
RamdiskData = InodeData-i
# Check everything
Full = InodeData+StaticFile
# Files that change their mtimes or ctimes but not their contents
VarTime = InodeData+Checksums
# Files that are recreated regularly but do not change their contents
VarInode = VarTime-i
# Files that change their contents during system operation
VarFile = OwnerMode+n+l+X
# Directories that change their contents during system operation
VarDir = OwnerMode+n+i+X
# Directories that are recreated regularly and change their contents
VarDirInode = OwnerMode+n+X
# Directories that change their mtimes or ctimes but not their contents
VarDirTime = InodeData
# Logs grow in size. Log rotation of these logs will be reported, so
# this should only be used for logs that are not rotated daily.
Log = OwnerMode+n+S+X
# Logs that are frequently rotated
FreqRotLog = Log-S
# The first instance of a rotated log: After the log has stopped being
# written to, but before rotation
LowLog = Log-S
# Rotated logs change their file name but retain all their other properties
SerMemberLog = Full+I
# The first instance of a compressed, rotated log: After a LowLog was
# compressed.
LoSerMemberLog = SerMemberLog+ANF
# The last instance of a compressed, rotated log: After this name, a log
# will be removed
HiSerMemberLog = SerMemberLog+ARF
# Not-yet-compressed log created by logrotate's dateext option:
# These files appear one rotation (renamed from the live log) and are gone
# the next rotation (being compressed)
LowDELog = SerMemberLog+ANF+ARF
# Compressed log created by logrotate's dateext option: These files appear
# once and are not touched any more.
SerMemberDELog = Full+ANF
I don't understand why AIDE adds just over 400.000 entries to the new database when I execute the following command : update-aide.conf ; aideinit
In the config file there is nowhere selection lines or restricted selection lines, so I'm wondering if AIDE doesn't add some by default.
I'm on Ubuntu 18.04.4 so the package aide comes with aide-common wrapper package.
I would like to have a clean aide.conf file but when I tried to delete SerMemberDELog = Full+ANF for example, I get the following error :
846:Error in expression:
Configuration error
error checking aide config, not running aide
AIDE --init return code 255
Big thanks to anyone who will help me :) !
If you need more details I'm always here.

Finally I managed to solve my problem,
The /etc/aide/aide.conf config file isn't the unique file used by AIDE,
when you run update-aide.conf wrapper, it actually uses this file and many other conf files present in the /etc/aide/aide.conf.d directory.
Easy fix is to move or delete these files and from now you will be able to clean your /etc/aide/aide.conf file :)
Have a good day !

Related

geany custom filetype .svrf for syntax highlighting

I have a similar issue;
I copied and edited filetype_extensions.conf in my ~/.config/geany adding:
CALIBRE=*.rul;*.svrf;*.SVRF;*.cal;
Then under ~/.config/geany/filedefs I created following files:
filetypes.CALIBRE.conf ==> my custom filetypes
filetypes.commmon ==> I wanted specific colored named_styles
# For complete documentation of this file, please see Geany's main documentation
[styling]
comment=svrf_comment
key=svrf_keyword_comment,bold
[settings]
# default extension used when saving files
extension=svrf
lexer_filetype=NONE
[keywords]
# all items must be in one line
svrf=EXT ENC INT EXPAND
# the following characters are these which a "word" can contains, see documentation
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
# single comments, like / in this file
comment_single=//
# multiline comments
#comment_open=/*
#comment_close=*/
# set to false if a comment character/string should start at column 0 of a line, true uses any
# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
#command_example();
# setting to false would generate this
# command_example();
# This setting works only for single line comments
comment_use_indent=true
# context action command (please see Geany's main documentation for details)
context_action_cmd=
[indentation]
#width=4
# 0 is spaces, 1 is tabs, 2 is tab & spaces
#type=1
[build-menu]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
#FT_02_LB=_Lint
#FT_02_CM=jshint "%f"
#FT_02_WD=
#error_regex=([^:]+): line ([0-9]+), col ([0-9]+)
However when I open an svrf file type my custom filetypes is not recognized (no specific color while I chose some styling).
If I choose [styling=C] and lexer_filetype=C I am getting color for "C" code...
I also tried [styling] and lexer_filtype=NONE, but once again my custom highlight is not recognized.
I alread ready geany manual, as well as looked as some post but none of them is completely answering this subject (on the 2nd overflow link user has mapped to existing filetype hence he's not getting behavior he had wished).
geany custom filetype .sass for syntax highlighting
Geany: Syntax highlighting for custom filetype for SOME words
Do you have any idea on how to solve this issue?

python-fu select copy paste

I'm a newbie in python-fu, (my second day), so my question may seem naive: I'd like to select a rectangular portion from "r400r.png", rotate it 90 degrees, and save my selection in "r400ra.png".
So far, I tried something on these lines:
for fv in range(400,401):
fn='r%sr.png' % fv
img=pdb.gimp_file_load('/path/'+fn,fn)
drw=pdb.gimp_image_get_active_layer(img)
img1=pdb.gimp_image_new(1024,1568,0)
lyr=pdb.gimp_layer_new(img1,1024,1568,0,'ly1',0,0)
pdb.gimp_rect_select(img,10,200,1422,1024,2,0,0)
drw=pdb.gimp_rotate(drw,0,1.570796327)
pdb.script_fu_selection_to_image(img1,drw)
f0=fn[:5]+'a'+fn[5:]
pdb.gimp_file_save(drw,'/path/'+f0,f0)
The "lyr" layer is there because my understanding is that it is a must, although it's not clear to me why. The "for" loop eventually should bulk process a bunch of files; for testing it is restricted to one file only. I get an error where I try o execute "script_fu_selection_to_image".
Can you point me, please, in the right direction?
Thanks,
SxN
The PDB calls to do that are better in this order:
# import your image:
img=pdb.gimp_file_load('/path/'+fn,fn)
#make the selection
pdb.gimp_rect_select(img,10,200,1422,1024,2,0,0)
# copy
pdb.gimp_edit_copy(img.layers[0])
# (no need to "get_active_layer" - if
# your image is a flat PNG or JPG, it only has one layer,
# which is accessible as img.layers[0])
# create a new image from the copied area:
new_img = pdb.gimp_paste_as_new()
#rotate the newly created image:
pdb.gimp_image_rotate(new_img, ...)
#export the resulting image:
pdb.gimp_file_save(new_img, ...)
#delete the loaded image and the created image:
# (as the objects being destroyed on the Python side
# do not erase then from the GIMP app, where they
# stay consuming memory)
pdb.gimp_image_delete(new_img)
pdb.gimp_image_delete(img)

How to prevent vim from setting current directory

Recently my vim will change current directory no matter what I do. I'm using spf13 distribution and when I am in a rails app root directory and did vi, my pwd will be correctly in app root directory. But once I open some file, any file, it will change the pwd to abosolute/path/to/myrailsapp/app/assets/stylesheets,
When I don't have let g:spf13_no_autochdir = 1 in my .vimrc, vim will change the pwd to current file directory; When I do, it will change to the stylesheet directory whenever I open a file.
I'm also using rails.vim installed. Here is the related code inside my .vimrc
if !exists('g:spf13_no_autochdir')
autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif
" Always switch to the current file directory
endif
UPDATE:
What I want: the pwd always stay in absolute/path/to/myrailsapp/, no changing to the stylesheet directory automatically whenever I open a file.
Actually I just found and had a look at the plugin. I assume this is it:
https://github.com/spf13/spf13-vim/blob/3.0/.vimrc
Around line 75 you can see:
" Most prefer to automatically switch to the current file directory when
" a new buffer is opened; to prevent this behavior, add the following to
" your .vimrc.before.local file:
" let g:spf13_no_autochdir = 1
So just add that last line (without the comment-marker quote) to your .vimrc and you'll get rid of the automated directory change.
I note that neither method in my other answer would have worked, because the plugin author for whatever reason decided not to use the built-in option, and also not to put their autocmd in a group. Naughty, naughty!
I solved this according to Ben's second answer.
spf13 loads configuration files in order as follows.
.vimrc.before - spf13-vim before configuration
.vimrc.before.fork - fork before configuration
.vimrc.before.local - before user configuration
.vimrc.bundles - spf13-vim bundle configuration
.vimrc.bundles.fork - fork bundle configuration
.vimrc.bundles.local - local user bundle configuration
.vimrc - spf13-vim vim configuration
.vimrc.fork - fork vim configuration
.vimrc.local - local user configuration
if !exists('g:spf13_no_autochdir') check is done at (7), so let g:spf13_no_autochdir = 1 should be loaded before that.
I put it in .vimrc.before.local, and it works as expected.
There are two ways this could be happening.
The most likely, is that this "spf13" configuration includes set autochdir. To find out whether this is the case, start up Vim normally, and type :verbose set autochdir? and press Enter. This should tell you IF autochdir is set and WHICH FILE set it to that value.
If autochdir is set, then you only need to set up a VimEnter autocmd, or stick a file in ~/.vim/after/plugin, to turn it off again after spf13 loads.
If autochdir is NOT set, then probably an autocmd is setting your directory for you. If there is a plugin option in SPF13 to turn it off, then do that. If not, you'll need to find where in the plugin the directory is getting changed. If you're lucky, the autocmd will be in an augroup by itself, and you can then remove that autocmd with :au! GroupName. This command can be in the same places; a VimEnter autocmd, or a file in ~/.vim/after/plugin.

I need to create a script that will check a files size, warn user, move files and link to new location

We are trying to keep as little end-user data on our companies thin-clients, so I need to create a script that will run when a file is saved locally. I'm completely new to power shell so I do apologize for the lack of knowledge.
Check file size
if (file size is equal or greater than "x"mb) output a warning "file is larger than allowed, moving file to you cloud drive (usually the K: drive)
I'd imaging I'd use Move-Item -destination "k:\My Documents\"
create a link or shortcut to the new file location.
I'm sure I will need more data at some point. I will take any/all the help I can get.
$Directory = Get-ChildItem "D:\Download" #Directory I care about
$SizeLimit = "200000" #Size limit in bytes
foreach ($File in $Directory) {
if ($File.Length -ge $SizeLimit) {
# Notify the user with a pop-up
# the coding for said popup
# Move the file
Move-Item $File.FullName K:\
mklink.exe K:\$File.Name $File.FullName

how to delete rails log file after certain size

I have a daemon that runs constantly which fills up the log file(development.log or production.log) pretty quickly. What is the best way to delete the log file after certain size or delete the portion before certain day.
config.logger = Logger.new(config.log_path, 50, 1.megabyte)
but beware that multiple mongrels can have issues with this.
The best way is to set up log rotation, but how you do this is very platform dependent,
so you should add a comment about what you're using, both for development and production.
For our apps running on Linux, we have a file /etc/logrotate.d/appname for each app,
that looks something like this:
/path/to/rails_root_for_app/log/production.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
create 640 capistrano capistrano
}
This will move the log into a new file once a day, keeping a compressed backup file for each
of the last 7 days.
If you just want to empty the file without keeping any of the data in it while the daemon is
running, simply do this from a shell:
> /path/to/rails_root_for_app/log/development.log
This will truncate the file to 0 bytes length.
I prefer a monthly log file in my production.rb file
config.logger = Logger.new(config.log_path, 'monthly')
Or even better, if all your environments are on either Mac or Linux, and have /usr/sbin/rotatelogs, just use that. It's much more flexible, and doesn't have the data loss issue that logrotate has (even if you use copytruncate).
Add this inside config/application.rb (or just config/environments/production.rb if you only want rotation in prod):
log_pipe = IO.popen("/usr/sbin/rotatelogs #{Rails.root}/log/#{Rails.env}.%Y%m%d.log 86400", 'a')
config.logger = Logger.new(log_pipe)
(From this blog post)
Or you can delegate logging to syslog

Resources