- Timestamp:
- Nov 1, 2012, 7:45:54 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile.in
r414 r415 960 960 rpmspec-light: samhain.spec 961 961 @echo "Stripping docs from samhain.spec"; \ 962 cat samhain.spec | sed 's,make DESTDIR=$${RPM_BUILD_ROOT} install,make DESTDIR=$${RPM_BUILD_ROOT} install-light,' | sed s,shkeep=yes,shkeep=no, | sed s,%doc.*,, | sed s,%attr.*,,> samhain.spec-light; \962 cat samhain.spec | sed 's,make DESTDIR=$${RPM_BUILD_ROOT} install,make DESTDIR=$${RPM_BUILD_ROOT} install-light,' | sed s,shkeep=yes,shkeep=no, | sed s,%doc.*,, | sed '/logrotate/! { s,%attr.*,, }' > samhain.spec-light; \ 963 963 mv samhain.spec-light samhain.spec 964 964 -
trunk/aclocal.m4
r412 r415 1379 1379 # 1380 1380 if test "x$GCC" = xyes; then 1381 SAMHAIN_X86_64 1381 case "$host_os" in 1382 *linux*) 1383 SAMHAIN_X86_64 1384 ;; 1385 *bsd*) 1386 SAMHAIN_X86_64 1387 ;; 1388 *) 1389 SAMHAIN_X86_64 1390 ;; 1391 esac 1382 1392 fi 1383 1393 fi -
trunk/configure.ac
r412 r415 12 12 dnl start 13 13 dnl 14 AM_INIT_AUTOMAKE(samhain, 3.0. 6)14 AM_INIT_AUTOMAKE(samhain, 3.0.8) 15 15 AC_DEFINE([SAMHAIN], 1, [Application is samhain]) 16 16 AC_CANONICAL_HOST … … 1425 1425 1426 1426 elif test "x${withval}" = "xoracle"; then 1427 AC_MSG_CHECKING(for oracle in /usr /usr/local ORACLE_HOME) 1427 1428 AC_MSG_CHECKING(for oracle in ORACLE_HOME /usr/local /usr) 1429 1428 1430 oracle_directory="/usr /usr/local ${ORACLE_HOME}" 1429 1431 for i in $oracle_directory; do 1430 if test -r $i/rdbms/demo/oci.h; then 1431 ORACLE_DIR=$i 1432 fi 1433 done 1432 1433 ff=`find $i -name oci.h 2>/dev/null | tail -1` 1434 if test "x$ff" = "x"; then 1435 : 1436 else 1437 ORACLE_INC=`dirname $ff` 1438 fi 1439 1440 fg=`find $i -name libclntsh.so 2>/dev/null | tail -1` 1441 if test "x$fg" = "x"; then 1442 : 1443 else 1444 ORACLE_LIB=`dirname $fg` 1445 fi 1446 1447 done 1434 1448 1435 if test -z "$ORACLE_DIR"; then 1449 if test -z "$ORACLE_INC"; then 1450 1436 1451 tmp="" 1437 1452 for i in $oracle_directory; do 1438 tmp="$tmp $i /rdbms/demo"1453 tmp="$tmp $i" 1439 1454 done 1440 FAIL_MESSAGE("OCI header file (oci.h)", $tmp) 1441 else 1442 for i in rdbms/demo rdbms/public network/public; do 1443 ORACLE_CPP_FLAGS="$ORACLE_CPP_FLAGS -I$ORACLE_DIR/$i" 1444 done 1445 ORACLE_LIB_DIR="$ORACLE_DIR/lib" 1446 AC_MSG_RESULT(yes) 1455 FAIL_MESSAGE("OCI header file (oci.h) please define ORACLE_INC directory where oci.h resides", $tmp) 1456 1457 elif test -z "$ORACLE_LIB"; then 1458 1459 tmp="" 1460 for i in $oracle_directory; do 1461 tmp="$tmp $i" 1462 done 1463 FAIL_MESSAGE("OCI library file (libclntsh.so) please define ORACLE_LIB directory where libclntsh.so resides", $tmp) 1464 1465 else 1466 1467 ORACLE_CPP_FLAGS="-I$ORACLE_INC" 1468 ORACLE_LIB_DIR="$ORACLE_LIB" 1469 1470 AC_MSG_RESULT([$ORACLE_INC $ORACLE_LIB]) 1447 1471 1448 1472 CPPFLAGS="${CPPFLAGS} ${ORACLE_CPP_FLAGS}" 1449 1473 1450 1474 ORACLE_LIBS="-lclntsh" 1475 1476 if test -r $ORACLE_LIB_DIR/libnnz11.so; then 1477 ORACLE_LIBS="${ORACLE_LIBS} -lnnz11" 1478 fi 1451 1479 if test -r $ORACLE_LIB_DIR/libwtc9.so; then 1452 1480 ORACLE_LIBS="${ORACLE_LIBS} -lwtc9" -
trunk/docs/Changelog
r414 r415 1 3.0.8: 2 * rename to 3.0.8 for release 3 * useful exit status for samhainadmin.pl --examine 4 5 3.0.7a: 6 * add ability to create RPM with preset password (use 7 env var PASSWORD) 8 * fix the rpm-light makefile target 9 * fix minor bug in samhain_setpwd.c (incorrect error message) 10 11 3.0.7: 12 * update documentation for prelude 13 * fix configure to properly search for Oracle Instantclient SDK 14 * pass through TNS_ADMIN environment variable for Oracle 15 * optimize audit rules automatically 16 * zero out the html status file at server exit 17 * don't check for assembly optimization unless linux or *BSD 18 1 19 3.0.6: 2 20 * install logrotate script if /etc/logrotate.d is detected -
trunk/include/samhain.h
r412 r415 125 125 #define UINT32 unsigned short 126 126 #define SINT32 short 127 #else 128 #error "No 32 bit integer type found" 127 129 #endif 128 130 -
trunk/include/sh_extern.h
r294 r415 1 1 #ifndef SH_EXTERN_H 2 2 #define SH_EXTERN_H 3 4 #include <stdarg.h> 3 5 4 6 typedef struct … … 40 42 * executes shell command 41 43 */ 42 int sh_ext_popen_init (sh_tas_t * task, char * command );44 int sh_ext_popen_init (sh_tas_t * task, char * command, char * argv0, ...) SH_GNUC_SENTINEL; 43 45 44 46 /* 45 47 * -- Execute command, return first line of output 46 48 */ 47 int sh_ext_system (char * command );49 int sh_ext_system (char * command, char * argv0, ...) SH_GNUC_SENTINEL; 48 50 49 51 /* -
trunk/include/sh_files.h
r373 r415 22 22 23 23 void sh_audit_mark (const char * file); 24 void sh_audit_commit (); 24 25 void sh_audit_delete_all (); 25 26 char * sh_audit_fetch (char * file, time_t time, char * result, size_t rsize); -
trunk/samhain.spec.in
r412 r415 14 14 Packager: Andre Oliveira da Costa <brblueser@uol.com.br> 15 15 Provides: %{name} 16 Requires(pre): shadow-utils 16 17 17 18 # dummy (fix configure warning) … … 19 20 20 21 # no quotes here - aparently will be expanded literally 22 23 %define password %(echo $PASSWORD) 21 24 22 25 %define withpwd_prg x@clmytclient@ … … 65 68 ./configure @mydefargs@ 66 69 make 70 %if "%{withpwd_prg}" == "xDSH_WITH_CLIENT" 71 %if 0%{?password:1} 72 ./samhain_setpwd samhain new %{password} 73 mv samhain samhain.old 74 mv samhain.new samhain 75 %endif 76 %endif 77 67 78 68 79 %install 69 70 80 rm -rf ${RPM_BUILD_ROOT} 71 81 # sstrip shouldn't be used since binaries will be stripped later … … 88 98 %clean 89 99 rm -rf ${RPM_BUILD_ROOT} 100 101 %pre 102 if test "x@install_name@" = "xyule" 103 then 104 getent group samhain >/dev/null || groupadd -r samhain 105 getent passwd yule >/dev/null || \ 106 useradd -r -g samhain -d @mydataroot@ -s /sbin/nologin \ 107 -c "samhain server daemon" yule 108 109 fi 110 exit 0 90 111 91 112 %post … … 197 218 %attr(644,root,root) @mandir@/man8/@install_name@* 198 219 %attr(644,root,root) /etc/logrotate.d/@install_name@ 220 %if "%{name}" == "yule" 221 %attr(750,root,samhain) @mydataroot@ 222 %attr(750,yule,samhain) @mylogdir@ 223 %endif 199 224 %config(noreplace) @myrpmconffile@ 200 225 201 226 %changelog 227 * Tue Oct 23 2012 Rainer Wichmann 228 - fixes for yule installation 229 202 230 * Tue May 16 2006 Rainer Wichmann 203 231 - fix manual version, noticed by Imre Gergely -
trunk/scripts/samhainadmin.pl.in
r330 r415 687 687 check_gpg_verify(); 688 688 my $i = 0; 689 my $ret = 0; 689 690 while (defined($ARGV[$i])) { 690 691 print "\n"; 691 692 $file1 = $ARGV[$i]; 692 examine ();693 $ret += examine (); 693 694 ++$i; 694 695 print "\n--------------------------------\n" if (defined($ARGV[$i])); 695 696 } 697 exit($ret); 696 698 } 697 699 -
trunk/src/samhain.c
r411 r415 712 712 #if defined(SH_WITH_SERVER) 713 713 extern int sh_socket_remove (void); 714 extern int sh_html_zero(); 714 715 #endif 715 716 … … 743 744 */ 744 745 #if defined(SH_WITH_SERVER) 745 sh_forward_html_write(); 746 /* zero out the status file at exit, such that the status 747 * of client becomes unknown in the beltane interface 748 */ 749 sh_html_zero(); 750 /* sh_forward_html_write(); */ 746 751 #endif 747 752 … … 1174 1179 FileSchedIn = NULL; 1175 1180 *status = 0; 1176 return 0;1181 return NULL; 1177 1182 } 1178 1183 … … 1722 1727 (void) sh_files_setrec(); 1723 1728 (void) sh_files_test_setup(); 1729 sh_audit_commit (); 1724 1730 1725 1731 /* -------- NICE LEVEL --------- … … 1858 1864 (void) sh_files_setrec(); 1859 1865 (void) sh_files_test_setup(); 1866 sh_audit_commit (); 1867 1868 fprintf(stderr, "FIXME: %d\n", (int) sh.fileCheck.alarm_interval); 1869 fprintf(stderr, "FIXME: FileSchedOne %s\n", 1870 FileSchedOne == NULL ? "NULL" : "NOT NULL"); 1871 fprintf(stderr, "FIXME: FileSchedTwo %s\n", 1872 FileSchedTwo == NULL ? "NULL" : "NOT NULL"); 1873 1860 1874 1861 1875 if (0 != sh.flag.nice) -
trunk/src/samhain_setpwd.c
r212 r415 279 279 if (strlen(argv[3]) != 16) 280 280 { 281 fprintf (stdout, _("ERROR <new_password> %s has not exactly 16 chars\n"), 282 argv[0]); 281 fprintf (stdout, 282 _("ERROR <new_password> |%s| has not exactly 16 chars\n"), 283 argv[3]); 283 284 fflush(stdout); 284 285 return EXIT_FAILURE; -
trunk/src/sh_audit.c
r373 r415 211 211 if (p >= 0) 212 212 { 213 char c ommand[64];214 215 sl_snprintf(c ommand, sizeof(command), _("%s -D -k samhain"),213 char ctl[64]; 214 215 sl_snprintf(ctl, sizeof(ctl), _("%s -D -k samhain"), 216 216 _(actl_paths[p])); 217 217 sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, … … 219 219 _("Deleting audit daemon rules with key samhain"), 220 220 _("sh_audit_delete_all") ); 221 sh_ext_system(command); 222 } 223 return; 224 } 225 226 void sh_audit_mark (const char * file) 221 222 sl_strlcpy(ctl, _(actl_paths[p]), sizeof(ctl)); 223 sh_ext_system(ctl, ctl, "-D", "-k", _("samhain"), NULL); 224 } 225 return; 226 } 227 228 static void sh_audit_mark_int (const char * file) 227 229 { 228 230 static int flushRules = 0; … … 243 245 char * command = SH_ALLOC(len); 244 246 char * safe; 247 char ctl[64]; 245 248 246 249 sl_snprintf(command, len, _("%s -w %s -p wa -k samhain"), … … 255 258 SH_FREE(safe); 256 259 257 sh_ext_system(command); 258 } 259 return; 260 } 261 260 sl_strlcpy(ctl, _(actl_paths[p]), sizeof(ctl)); 261 sl_strlcpy(command, file, len); 262 263 sh_ext_system(ctl, ctl, "-w", command, "-p", "wa", "-k", _("samhain"), NULL); 264 265 SH_FREE(command); 266 } 267 return; 268 } 269 270 struct aud_list { 271 char * file; 272 struct aud_list * next; 273 }; 274 275 struct aud_list * mark_these = NULL; 276 277 static void add_this (char * file) 278 { 279 struct aud_list * this = SH_ALLOC(sizeof(struct aud_list)); 280 this->file = sh_utils_strdup(file); 281 this->next = mark_these; 282 return; 283 } 284 285 static int test_exchange (struct aud_list * this, char * file) 286 { 287 size_t len0 = sl_strlen(this->file); 288 size_t len1 = sl_strlen(file); 289 int ret = -1; 290 291 if (len0 == len1) 292 { 293 return strcmp(this->file, file); 294 } 295 else 296 { 297 char * s0 = SH_ALLOC(len0 + 2); 298 char * s1 = SH_ALLOC(len1 + 2); 299 300 sl_strlcpy(s0, this->file, len0 + 2); 301 sl_strlcpy(s1, file, len1 + 2); 302 303 if (s0 < s1) 304 { 305 sl_strlcat(s0, "/", len0 + 2); 306 ret = strncmp(s0, s1, len0 + 1); 307 } 308 else 309 { 310 sl_strlcat(s1, "/", len1 + 2); 311 if (0 == strncmp(s0, s1, len1 + 1)) 312 { 313 SH_FREE(this->file); 314 this->file = sh_utils_strdup(file); 315 ret = 0; 316 } 317 } 318 SH_FREE(s0); 319 SH_FREE(s1); 320 } 321 322 return ret; 323 } 324 325 void sh_audit_mark (char * file) 326 { 327 struct aud_list * all = mark_these; 328 struct aud_list * this = mark_these; 329 330 if (!mark_these) { 331 add_this (file); 332 return; 333 } 334 335 while (this) 336 { 337 if (0 == test_exchange(this, file)) 338 return; 339 this = this->next; 340 } 341 342 add_this (file); 343 return; 344 } 345 346 void sh_audit_commit () 347 { 348 struct aud_list * next; 349 struct aud_list * this = mark_these; 350 351 mark_these = NULL; 352 353 while (this) 354 { 355 sh_audit_mark_int (this->file); 356 next = this->next; 357 SH_FREE(this->file); 358 SH_FREE(this); 359 this = next; 360 } 361 362 } 262 363 263 364 static int sh_audit_checkdaemon() … … 381 482 return; 382 483 } 484 void sh_audit_commit () 485 { 486 return; 487 } 383 488 #endif 384 489 -
trunk/src/sh_extern.c
r400 r415 847 847 } 848 848 849 int sh_ext_popen_init (sh_tas_t * task, char * command) 850 { 851 int status; 852 849 static void task_init (sh_tas_t * task) 850 { 853 851 sh_ext_tas_init(task); 854 852 … … 858 856 _("/sbin:/bin:/usr/sbin:/usr/bin:/usr/ucb")); 859 857 (void) sh_ext_tas_add_envv (task, _("IFS"), " \n\t"); 858 860 859 if (sh.timezone != NULL) 861 860 { 862 861 (void) sh_ext_tas_add_envv(task, "TZ", sh.timezone); 863 862 } 863 return; 864 } 865 866 int sh_ext_popen_init (sh_tas_t * task, char * command, char * argv0, ...) 867 { 868 va_list vl; 869 int status; 870 871 task_init (task); 864 872 865 sh_ext_tas_command(task, _("/bin/sh")); 866 867 (void) sh_ext_tas_add_argv(task, _("/bin/sh")); 868 (void) sh_ext_tas_add_argv(task, _("-c")); 869 (void) sh_ext_tas_add_argv(task, command); 870 873 if (!argv0) 874 { 875 sh_ext_tas_command(task, _("/bin/sh")); 876 877 (void) sh_ext_tas_add_argv(task, _("/bin/sh")); 878 (void) sh_ext_tas_add_argv(task, _("-c")); 879 (void) sh_ext_tas_add_argv(task, command); 880 } 881 else 882 { 883 char * s; 884 885 sh_ext_tas_command(task, command); 886 887 (void) sh_ext_tas_add_argv(task, argv0); 888 889 va_start (vl, argv0); 890 s = va_arg (vl, char * ); 891 while (s != NULL) 892 { 893 (void) sh_ext_tas_add_argv(task, s); 894 s = va_arg (vl, char * ); 895 } 896 va_end (vl); 897 898 } 871 899 task->rw = 'r'; 872 900 task->fork_twice = S_FALSE; … … 879 907 /* Execute a system command */ 880 908 881 int sh_ext_system (char * command )909 int sh_ext_system (char * command, char * argv0, ...) 882 910 { 883 911 sh_tas_t task; 884 912 int status; 913 va_list vl; 914 char * s; 885 915 886 916 SL_ENTER(_("sh_ext_system")); 887 917 888 status = sh_ext_popen_init (&task, command); 918 task_init (&task); 919 920 sh_ext_tas_command(&task, command); 921 922 (void) sh_ext_tas_add_argv(&task, argv0); 923 924 va_start (vl, argv0); 925 s = va_arg (vl, char * ); 926 while (s != NULL) 927 { 928 (void) sh_ext_tas_add_argv(&task, s); 929 s = va_arg (vl, char * ); 930 } 931 va_end (vl); 932 933 task.rw = 'r'; 934 task.fork_twice = S_FALSE; 935 936 status = sh_ext_popen(&task); 889 937 890 938 if (status != 0) … … 915 963 SL_ENTER(_("sh_ext_popen_str")); 916 964 917 status = sh_ext_popen_init (&task, command );965 status = sh_ext_popen_init (&task, command, NULL, NULL); 918 966 919 967 if (status != 0) -
trunk/src/sh_getopt.c
r367 r415 401 401 printf (_("Client executable (port %d)"), SH_DEFAULT_PORT); ++num; 402 402 #endif 403 #if defined(SH_WITH_ CLIENT)403 #if defined(SH_WITH_SERVER) 404 404 if (num > 0) fputc ('\n', stdout); 405 405 printf (_("Server executable (port %d, user %s)"), -
trunk/src/sh_html.c
r383 r415 503 503 } 504 504 505 int sh_html_zero() 506 { 507 long fd; 508 509 SL_ENTER(_("sh_html_zero")); 510 511 if (0 != (fd = tf_trust_check (DEFAULT_HTML_FILE, SL_YESPRIV))) 512 { 513 SL_RETURN((-1), _("sh_html_zero")); 514 } 515 516 fd = sl_open_write_trunc (FIL__, __LINE__, DEFAULT_HTML_FILE, SL_YESPRIV); 517 518 if (SL_ISERROR(fd)) 519 { 520 SL_RETURN((-1), _("sh_html_zero")); 521 } 522 523 sh_html_head(fd); 524 sh_html_foot(fd); 525 526 sl_close(fd); 527 528 SL_RETURN((0), _("sh_html_zero")); 529 } 530 505 531 /* SH_WITH_SERVER */ 506 532 #endif -
trunk/src/sh_log_check.c
r379 r415 915 915 entry = SH_ALLOC(sizeof(struct task_entry)); 916 916 917 status = sh_ext_popen_init (&(entry->task), logfile->filename );917 status = sh_ext_popen_init (&(entry->task), logfile->filename, logfile->filename, NULL); 918 918 if (0 == status) 919 919 { -
trunk/src/sh_unix.c
r411 r415 1519 1519 #ifdef WITH_ORACLE 1520 1520 /* 1521 * Skip the ORACLE_HOME environment variable; Oracle may need it. 1521 * Skip the ORACLE_HOME and TNS_ADMIN environment variables; 1522 * Oracle may need them. 1522 1523 */ 1523 1524 if (0 == sl_strncmp((*env), _("ORACLE_HOME="), 12)) 1525 { 1526 ++(env); 1527 continue; 1528 } 1529 if (0 == sl_strncmp((*env), _("TNS_ADMIN="), 10)) 1524 1530 { 1525 1531 ++(env); -
trunk/test/testrun_2.sh
r369 r415 537 537 fi 538 538 539 cp $HTML ${HTML}.tmp 540 539 541 kill $PROC_Y 540 542 five_sec_sleep … … 568 570 fi 569 571 570 egrep '<!-- head -->' $ HTML>/dev/null 2>&1572 egrep '<!-- head -->' ${HTML}.tmp >/dev/null 2>&1 571 573 if [ $? -ne 0 ]; then 572 574 [ -z "$verbose" ] || log_msg_fail "head.html"; 573 575 return 1 574 576 fi 575 egrep '<!-- ehead -->' $ HTML>/dev/null 2>&1577 egrep '<!-- ehead -->' ${HTML}.tmp >/dev/null 2>&1 576 578 if [ $? -ne 0 ]; then 577 579 [ -z "$verbose" ] || log_msg_fail "end head.html"; … … 579 581 fi 580 582 581 egrep '<!-- entry -->' $ HTML>/dev/null 2>&1583 egrep '<!-- entry -->' ${HTML}.tmp >/dev/null 2>&1 582 584 if [ $? -ne 0 ]; then 583 585 [ -z "$verbose" ] || log_msg_fail "entry.html"; 584 586 return 1 585 587 fi 586 egrep '<!-- eentry -->' $ HTML>/dev/null 2>&1588 egrep '<!-- eentry -->' ${HTML}.tmp >/dev/null 2>&1 587 589 if [ $? -ne 0 ]; then 588 590 [ -z "$verbose" ] || log_msg_fail "end entry.html"; … … 590 592 fi 591 593 592 egrep '<!-- foot -->' $ HTML>/dev/null 2>&1594 egrep '<!-- foot -->' ${HTML}.tmp >/dev/null 2>&1 593 595 if [ $? -ne 0 ]; then 594 596 [ -z "$verbose" ] || log_msg_fail "foot.html"; 595 597 return 1 596 598 fi 597 egrep '<!-- efoot -->' $ HTML>/dev/null 2>&1599 egrep '<!-- efoot -->' ${HTML}.tmp >/dev/null 2>&1 598 600 if [ $? -ne 0 ]; then 599 601 [ -z "$verbose" ] || log_msg_fail "end foot.html"; … … 609 611 fi; 610 612 } 613 614 rm ${HTML}.tmp 611 615 612 616 return 0 -
trunk/yulerc.template
r30 r415 47 47 ## 48 48 # MailSeverity=none 49 MailSeverity=crit50 49 51 50 ## Console 52 51 ## 53 # PrintSeverity=info 52 PrintSeverity=none 54 53 55 54 ## Logfile 56 55 ## 57 # LogSeverity=none 56 LogSeverity = warn 58 57 59 58 ## Syslog … … 97 96 ## Log the server timestamp for received messages 98 97 # 99 SetDBServerTstamp = True98 # SetDBServerTstamp = True 100 99 101 100 ## Use a persistent connection 102 101 # 103 UsePersistent = True102 # UsePersistent = True 104 103 105 104
Note:
See TracChangeset
for help on using the changeset viewer.