Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the "Hacks" and "Non-hacks" log filters. Accessible by admins only. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
d700ebff8e25e52eaac2866ad645f5c3 |
| User & Date: | drh 2024-05-27 10:33:02.119 |
Context
|
2024-05-27
| ||
| 11:28 | Call fossil_fatal() in svn import when trying to import an empty blob, rather than stepping on NULL later. Reported in [forum:15d4b242bda2a108|forum post 15d4b242bda2a108]. check-in: 05ae1fe2fe user: stephan tags: trunk | |
| 10:33 | Add the "Hacks" and "Non-hacks" log filters. Accessible by admins only. check-in: d700ebff8e user: drh tags: trunk | |
| 09:56 | Add robustness to decoding of query parameters on the /wdiff page. check-in: 8839378fb0 user: drh tags: trunk | |
Changes
Changes to src/security_audit.c.
| ︙ | ︙ | |||
801 802 803 804 805 806 807 808 809 810 811 812 813 814 |
return;
}
style_header("Server Error Log");
style_submenu_element("Test", "%R/test-warning");
style_submenu_element("Refresh", "%R/errorlog");
style_submenu_element("Log-Menu", "%R/setup-logmenu");
style_submenu_element("Panics", "%R/paniclog");
if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){
no_error_log_available();
style_finish_page();
return;
}
if( P("truncate1") && cgi_csrf_safe(2) ){
| > | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
return;
}
style_header("Server Error Log");
style_submenu_element("Test", "%R/test-warning");
style_submenu_element("Refresh", "%R/errorlog");
style_submenu_element("Log-Menu", "%R/setup-logmenu");
style_submenu_element("Panics", "%R/paniclog");
style_submenu_element("Non-Hacks", "%R/hacklog?not");
if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){
no_error_log_available();
style_finish_page();
return;
}
if( P("truncate1") && cgi_csrf_safe(2) ){
|
| ︙ | ︙ | |||
902 903 904 905 906 907 908 909 910 911 912 913 914 915 |
fossil_free(zLog);
@ <hr>
@ <pre>
while( fgets(z, sizeof(z), in) ){
if( prevWasTime
&& (strncmp(z,"panic: ", 7)==0 || strstr(z," assertion fault ")!=0)
){
@ %h(zTime)\
bOutput = 1;
}
if( strncmp(z, "--------", 8)==0 ){
size_t n = strlen(z);
memcpy(zTime, z, n+1);
prevWasTime = 1;
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 |
fossil_free(zLog);
@ <hr>
@ <pre>
while( fgets(z, sizeof(z), in) ){
if( prevWasTime
&& (strncmp(z,"panic: ", 7)==0 || strstr(z," assertion fault ")!=0)
){
@ %h(zTime)\
bOutput = 1;
}
if( strncmp(z, "--------", 8)==0 ){
size_t n = strlen(z);
memcpy(zTime, z, n+1);
prevWasTime = 1;
bOutput = 0;
}else{
prevWasTime = 0;
}
if( bOutput ){
@ %h(z)\
}
}
fclose(in);
@ </pre>
style_finish_page();
}
/*
** WEBPAGE: hacklog
**
** Scan the error log for "possible hack attempt" entries Show hack
** attempt messages only, omitting all others. Or if the "not" query
** parameter is present, show only messages that are not hack attempts.
*/
void hacklog_page(void){
i64 szFile;
char *zLog;
FILE *in;
int bOutput = 0;
int prevWasTime = 0;
int isNot = P("not")!=0;
char z[10000];
char zTime[10000];
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Server Hack Log");
style_submenu_element("Log-Menu", "%R/setup-logmenu");
if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){
no_error_log_available();
style_finish_page();
return;
}
in = fossil_fopen(g.zErrlog, "rb");
if( in==0 ){
@ <p class='generalError'>Unable to open that file for reading!</p>
style_finish_page();
return;
}
szFile = file_size(g.zErrlog, ExtFILE);
zLog = file_canonical_name_dup(g.zErrlog);
@ %s(isNot?"Non-hack":"Hack") messages contained within the %lld(szFile)-byte
@ <a href="%R/errorlog?all">error log</a> found at
@ "%h(zLog)".
fossil_free(zLog);
@ <hr>
@ <pre>
while( fgets(z, sizeof(z), in) ){
if( prevWasTime
&& ((strncmp(z,"possible hack attempt - 418 ", 27)==0) ^ isNot)
){
@ %h(zTime)\
bOutput = 1;
}
if( strncmp(z, "--------", 8)==0 ){
size_t n = strlen(z);
memcpy(zTime, z, n+1);
prevWasTime = 1;
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
"similar malfunctions."
);
setup_menu_entry("User Log", "user_log",
"The user log is a record of login attempts. The user log is stored\n"
"in the \"accesslog\" table of the respository.\n"
);
@ </table>
style_finish_page();
}
/*
** Generate a checkbox for an attribute.
| > > > > > > > > > | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
"similar malfunctions."
);
setup_menu_entry("User Log", "user_log",
"The user log is a record of login attempts. The user log is stored\n"
"in the \"accesslog\" table of the respository.\n"
);
setup_menu_entry("Hack Log", "hacklog",
"All 418 hack attempts"
);
setup_menu_entry("Non-Hack Log", "hacklog?not",
"All log messages that are not hack attempts"
);
@ </table>
style_finish_page();
}
/*
** Generate a checkbox for an attribute.
|
| ︙ | ︙ |