Skip to content

Added more audit logs#662

Merged
jimklimov merged 5 commits into42ity:masterfrom
EldoreiJK:master
Aug 2, 2019
Merged

Added more audit logs#662
jimklimov merged 5 commits into42ity:masterfrom
EldoreiJK:master

Conversation

@EldoreiJK
Copy link
Copy Markdown
Contributor

This should provide necessary logs to get some idea about the auditing results.
This is dependant on 42ity/fty-common-rest#36 and won't pass until it is merged and updated on Jenkins/Travis

Comment thread src/web/src/alert_ack.ecpp Outdated
log_debug ("Database is not ready yet.");
std::string err = TRANSLATE_ME ("Database is not ready yet, please try again after a while.");
if (request.getMethod () == "PUT")
log_info_audit ("Request PUT alert ack FAILED");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment. On failure treatment, we invoke log_info_audit(). It should be log_error_audit().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thx

@jimklimov
Copy link
Copy Markdown
Member

jimklimov commented Jul 29, 2019

Missed some headers?

  CXX      src/shared/src_libfty_rest_la-magic.lo
ecppc --nolog -I./include -I./include -o ./src/web/src/add_gpio.cc ./src/web/src/add_gpio.ecpp && \
	    mv -f ./src/web/src/add_gpio.cc.cpp ./src/web/src/add_gpio.cc
  CXX      src/web/src/src_libfty_rest_la-add_gpio.lo
./src/web/src/add_gpio.ecpp: In member function 'virtual unsigned int {anonymous}::_component_::operator()(tnt::HttpRequest&, tnt::HttpReply&, tnt::QueryParams&)':
./src/web/src/add_gpio.ecpp:154:104: error: 'CHECK_USER_PERMISSIONS_OR_DIE_AUDIT' was not declared in this scope
     CHECK_USER_PERMISSIONS_OR_DIE_AUDIT (PERMISSIONS, audit_msg.empty () ? nullptr : audit_msg.c_str ());
                                                                                                        ^
make[1]: *** [src/web/src/src_libfty_rest_la-add_gpio.lo] Error 1
make[1]: Leaving directory `/home/travis/build/42ity/fty-rest'

Otherwise LGTM ;)

UPDATE: Missed at first the comment about dependency PRs

Comment thread src/web/src/auth.ecpp
audit_msg = std::string ("Request CREATE auth username ") + username + " FAILED";
check_regex_text_or_die ("token", token, checked_token, "^[-/._~+/a-z0-9]{0,255}={0,10}$",
audit_msg = std::string ("Request CREATE auth FAILED");
check_regex_text_or_die_audit ("token", token, checked_token, "^[-/._~+/a-z0-9]{0,255}={0,10}$",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future: macro names should be all same-style, commonly upper-cased.

Also, the CHECK_USER_PERMISSIONS_OR_DIE_AUDIT above casts (char *) nullptr while other cases I've seen recently do not...

@jimklimov jimklimov merged commit 8de9d55 into 42ity:master Aug 2, 2019
@jimklimov jimklimov mentioned this pull request Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants