You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161_p0f.robot 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. *** Settings ***
  2. Suite Setup p0f Setup
  3. Suite Teardown p0f Teardown
  4. Library Process
  5. Library ${TESTDIR}/lib/rspamd.py
  6. Resource ${TESTDIR}/lib/rspamd.robot
  7. Variables ${TESTDIR}/lib/vars.py
  8. *** Variables ***
  9. ${CONFIG} ${TESTDIR}/configs/plugins.conf
  10. ${MESSAGE} ${TESTDIR}/messages/spam_message.eml
  11. ${MESSAGE2} ${TESTDIR}/messages/freemail.eml
  12. ${REDIS_SCOPE} Suite
  13. ${RSPAMD_SCOPE} Suite
  14. ${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
  15. *** Test Cases ***
  16. p0f MISS
  17. Run Dummy p0f
  18. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.1
  19. Check Rspamc ${result} P0F
  20. Check Rspamc ${result} Linux 3.11 and newer
  21. Check Rspamc ${result} Ethernet or modem
  22. Check Rspamc ${result} WINDOWS inverse=1
  23. Check Rspamc ${result} P0F_FAIL inverse=1
  24. Shutdown p0f
  25. p0f HIT
  26. Run Dummy p0f ${P0F_SOCKET} windows
  27. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.2
  28. Check Rspamc ${result} P0F
  29. Check Rspamc ${result} P0F_FAIL inverse=1
  30. Check Rspamc ${result} Ethernet or modem
  31. Check Rspamc ${result} WINDOWS
  32. Check Rspamc ${result} Linux 3.11 and newer inverse=1
  33. Shutdown p0f
  34. p0f MISS CACHE
  35. Run Dummy p0f
  36. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.3
  37. Check Rspamc ${result} WINDOWS inverse=1
  38. Shutdown p0f
  39. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.3
  40. Check Rspamc ${result} WINDOWS inverse=1
  41. Check Rspamc ${result} P0F_FAIL inverse=1
  42. p0f HIT CACHE
  43. Run Dummy p0f ${P0F_SOCKET} windows
  44. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.4
  45. Check Rspamc ${result} WINDOWS
  46. Shutdown p0f
  47. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.4
  48. Check Rspamc ${result} WINDOWS
  49. Check Rspamc ${result} P0F_FAIL inverse=1
  50. p0f NO REDIS
  51. Shutdown Process With Children ${REDIS_PID}
  52. Run Dummy p0f
  53. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.5
  54. Check Rspamc ${result} P0F
  55. Check Rspamc ${result} Linux 3.11 and newer
  56. Check Rspamc ${result} Ethernet or modem
  57. Check Rspamc ${result} P0F_FAIL inverse=1
  58. Should Contain ${result.stdout} distance=10
  59. Shutdown p0f
  60. p0f NO MATCH
  61. Run Dummy p0f ${P0F_SOCKET} windows no_match
  62. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.6
  63. Check Rspamc ${result} P0F inverse=1
  64. Check Rspamc ${result} WINDOWS inverse=1
  65. Shutdown p0f
  66. p0f BAD QUERY
  67. Run Dummy p0f ${P0F_SOCKET} windows bad_query
  68. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.7
  69. Check Rspamc ${result} P0F_FAIL
  70. Check Rspamc ${result} Malformed Query
  71. Check Rspamc ${result} WINDOWS inverse=1
  72. Shutdown p0f
  73. p0f BAD RESPONSE
  74. Run Dummy p0f ${P0F_SOCKET} windows bad_response
  75. ${result} = Scan Message With Rspamc ${MESSAGE} --ip 1.1.1.8
  76. Check Rspamc ${result} P0F_FAIL
  77. Check Rspamc ${result} Error getting result: IO read error: connection terminated
  78. Check Rspamc ${result} WINDOWS inverse=1
  79. Shutdown p0f
  80. *** Keywords ***
  81. p0f Setup
  82. ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/p0f.conf
  83. Set Suite Variable ${PLUGIN_CONFIG}
  84. Generic Setup PLUGIN_CONFIG
  85. Run Redis
  86. p0f Teardown
  87. Normal Teardown
  88. Shutdown Process With Children ${REDIS_PID}
  89. Shutdown p0f
  90. Terminate All Processes kill=True
  91. Shutdown p0f
  92. ${p0f_pid} = Get File if exists /tmp/dummy_p0f.pid
  93. Run Keyword if ${p0f_pid} Shutdown Process With Children ${p0f_pid}
  94. Run Dummy p0f
  95. [Arguments] ${socket}=${P0F_SOCKET} ${os}=linux ${status}=ok
  96. ${result} = Start Process ${TESTDIR}/util/dummy_p0f.py ${socket} ${os} ${status}
  97. Wait Until Created /tmp/dummy_p0f.pid