README 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. MONPOLY is a monitor for checking whether log files are policy
  2. compliant. Policies are specified by formulas in metric first-order
  3. temporal logic (MFOTL). Details on MFOTL and the core monitoring
  4. algorithm are described in [1]. A larger case study in which MONPOLY
  5. was used is described in [2]. [3] gives a brief overview of MONPOLY.
  6. Requirements
  7. ============
  8. OCaml compiler (http://caml.inria.fr/ocaml/index.en.html)
  9. MONPOLY has been tested with version 3.12.1 of OCaml
  10. under Linux. It should also compile and work with most not-too-old
  11. versions of OCaml under other operating systems.
  12. The following additional OCaml tools are used:
  13. ocamllex for generating the lexers
  14. ocamlyacc for generating the parsers
  15. ocamldep for generating dependencies between modules
  16. ocamldoc for generating the documentation (optional)
  17. On a Debian or Ubuntu system, the OCaml compiler and tools can be
  18. installed with the command
  19. apt-get install ocaml
  20. For installing OCaml on other systems, see the OCaml website
  21. (http://caml.inria.fr/). There you also find links to binary OCaml
  22. distributions for other Linux distributions (Fedora, Red Hat, and
  23. Gentoo), Microsoft Windows, and MacOS X. For Microsoft Windows you
  24. also need to install the Cygwin environment (http://www.cygwin.com/).
  25. Compiling
  26. =========
  27. $ make
  28. $ make clean # optional, to delete the object and other generated files
  29. $ make clean-all # also deletes the executable and the documentation
  30. Building the Documentation
  31. ==========================
  32. $ make
  33. $ make doc
  34. Running
  35. =======
  36. Usage:
  37. monpoly -sig <file> -formula <file> [-negate] [-log <file>]
  38. [-help] [-version] [-debug <unit>] [-verbose]
  39. [-check] [-sigout] [-unix] [-mem] [-nonewlastts]
  40. [-nofilterrel] [-nofilteremptytp] [-testfilter]"
  41. The options are:
  42. -sig Choose the signature file
  43. -formula Choose the formula file
  44. -negate Analyze the negation of the input formula
  45. -log Choose the log file
  46. -version Display the version (and exit)
  47. -debug Choose unit to debug
  48. -verbose Turn on verbose mode
  49. -check Check if formula is monitorable (and exit)
  50. -sigout Show the output signature (and exit)
  51. -unix Timestamps represent Unix time
  52. -mem Show memory usage on stderr
  53. -nonewlastts Do not add a last maximal time-stamp
  54. -nofilterrel Disable filter_rel module
  55. -nofilteremptytp Disable filter_empty_tp module
  56. -testfilter Test filter on the log without evaluating the formula
  57. Example
  58. =======
  59. To run MONPOLY on the "rv11" example, which is contained in the
  60. example directory, start MONPOLY as follows from a Unix shell:
  61. ./monpoly -sig examples/rv11.sig -formula examples/rv11.mfotl -log examples/rv11.log -negate
  62. In this example, the formula file (examples/rv11.mfotl) contains the
  63. policy expressed as a formula in MFOTL. For background on MFOTL, see
  64. [1]. In the example, the formula is
  65. publish(?r) IMPLIES ONCE[0,7d] approve(?r)
  66. It expresses the policy that if a report is published then the report
  67. must have been approved within the last 7 days.
  68. The log file (examples/rv11.log) shows for each time point the tuples
  69. in the relations. For instance, the following 2 lines
  70. @1307955600 approve (163)
  71. publish (160)
  72. mean that at a time point with time 1307955600 the relation approve
  73. consists of the value 163 and the relation publish consists of the
  74. value 160. If time units such as days or hours are used in the
  75. formula, then time is assumed to be Unix time. MONPOLY reads from
  76. stdin if no log file is specified with the switch -log.
  77. The relations used in the formula and the log must be specified in the
  78. signature file (examples/rv11.sig). In the example, the signature file
  79. contains the 2 lines:
  80. publish(int)
  81. approve(int)
  82. These specify that there are two relations, publish and approve, each
  83. with a single parameter of type integer. Relations can have multiple
  84. parameters (separated by a comma) and parameters can also be of type
  85. string.
  86. When MONPOLY processes the log file examples/rv11.log, it outputs to
  87. stdout
  88. @1307955600 (time-point 1): (160)
  89. @1308477599 (time-point 2): (152)
  90. The output means that at time point 1 (with time 1307955600) the
  91. policy was violated by report 160 and at time point 2 (with time
  92. 1308477599) the policy was violated by report 152. Note that since we
  93. use the -negate switch, these are the violations with respect to the
  94. given policy. In other words, the output consists of the time points
  95. and the valuations at which the negation of the formula from the
  96. formula file is satisfied. Error messages are written to stderr.
  97. File Description
  98. ================
  99. AUTHORS Authors of the tool
  100. CHANGES Change log
  101. LICENSE License file
  102. README This file
  103. Makefile Commands to compile the monitor
  104. /doc Directory for the documentation (generated with 'make doc')
  105. /examples Directory with some simple formulas and log files
  106. /src Directory with the source code
  107. misc.ml[i] Miscellaneous helper functions
  108. dllist.ml[i] Module for operations on doubly-linked lists
  109. mqueue.ml[i] Module for operations on queues
  110. predicate.ml[i] Module for operations on predicates
  111. MFOTL.ml[i] Module for operations on MFOTL formulas
  112. tuple.ml[i] Module for operations on tuples
  113. relation.ml[i] Module for operations on relations (sets of tuples)
  114. table.ml[i] Module for operations on tables (named relations)
  115. db.ml[i] Module for operations on databases (sets of tables)
  116. rewriting.ml[i] Module for rewriting operations on MFOTL formulas
  117. sliding.ml[i] Module implementing the sliding window algorithm
  118. algorithm.ml[i] The monitoring algorithm
  119. formula_lexer.mll Lexer for MFOTL formulas
  120. formula_parser.mly Parser for MFOTL formulas
  121. log_parser.mll Lexer for logs (in the general format)
  122. log_parser.mly Parser for logs (in the general format)
  123. log.ml[i] Module for parsing log files
  124. filter_empty_tp.ml[i] Module for filtering empty time-points
  125. filter_rel.ml[i] Module for filtering tuples and relations
  126. perf.ml[i] Module for performance evaluation
  127. main.ml The tool's entry point
  128. /tools Directory with various independent modules
  129. mfotl2sql.ml Module for translating MFORT formulas to SQL queries
  130. table2log.ml[i] Module for putting PostrgreSQL output into MonPoly's format
  131. Contact
  132. =======
  133. If you encounter problems, please contact Eugen Zalinescu
  134. (eugen.zalinescu@inf.ethz.ch).
  135. We would highly appreciate it if you drop us a mail when you are using
  136. the tool in a project. Feedback of any kind on the tool is welcome.
  137. References
  138. ==========
  139. [1] D. Basin, F. Klaedtke, S. Mueller, B. Pfitzmann: "Runtime
  140. Monitoring of Metric First-Order Temporal Properties." In the
  141. Proceedings of the 28th International Conference on Foundations of
  142. Software Technology and Theoretical Computer Science (FSTTCS'08).
  143. [2] D. Basin, M. Harvan, F. Klaedtke, E. Zalinescu: "Monitoring
  144. usage-control policies in distributed systems." In the Proceedings
  145. of the 18th International Symposium on Temporal Representation and
  146. Reasoning (TIME'11).
  147. [3] D. Basin, M. Harvan, F. Klaedtke, E. Zalinescu: "MONPOLY:
  148. Monitoring usage-control policies." In the Proceedings of the 2nd
  149. International Conference on Runtime Verification (RV'11).