Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
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.

109 lines
2.6 KiB

  1. # $OpenBSD: relayd.conf,v 1.14 2011/04/07 13:33:52 reyk Exp $
  2. #
  3. # Macros
  4. #
  5. ext_addr="192.168.1.1"
  6. webhost1="10.0.0.1"
  7. webhost2="10.0.0.2"
  8. sshhost1="10.0.0.3"
  9. #
  10. # Global Options
  11. #
  12. # interval 10
  13. # timeout 1000
  14. # prefork 5
  15. #
  16. # Each table will be mapped to a pf table.
  17. #
  18. table <webhosts> { $webhost1 $webhost2 }
  19. table <fallback> { 127.0.0.1 }
  20. #
  21. # Services will be mapped to a rdr rule.
  22. #
  23. redirect www {
  24. listen on $ext_addr port http interface trunk0
  25. # tag every packet that goes thru the rdr rule with RELAYD
  26. tag RELAYD
  27. forward to <webhosts> check http "/" code 200
  28. forward to <fallback> check icmp
  29. }
  30. #
  31. # Relay and protocol for HTTP layer 7 loadbalancing and SSL acceleration
  32. #
  33. http protocol httpssl {
  34. header append "$REMOTE_ADDR" to "X-Forwarded-For"
  35. header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By"
  36. header change "Connection" to "close"
  37. # Various TCP performance options
  38. tcp { nodelay, sack, socket buffer 65536, backlog 128 }
  39. # ssl { no sslv2, sslv3, tlsv1, ciphers HIGH }
  40. # ssl session cache disable
  41. }
  42. relay wwwssl {
  43. # Run as a SSL accelerator
  44. listen on $ext_addr port 443 ssl
  45. protocol httpssl
  46. # Forward to hosts in the webhosts table using a src/dst hash
  47. forward to <webhosts> port http mode loadbalance \
  48. check http "/" code 200
  49. }
  50. #
  51. # Relay and protocol for simple TCP forwarding on layer 7
  52. #
  53. protocol sshtcp {
  54. # The TCP_NODELAY option is required for "smooth" terminal sessions
  55. tcp nodelay
  56. }
  57. relay sshgw {
  58. # Run as a simple TCP relay
  59. listen on $ext_addr port 2222
  60. protocol sshtcp
  61. # Forward to the shared carp(4) address of an internal gateway
  62. forward to $sshhost1 port 22
  63. }
  64. #
  65. # Relay and protocol for a transparent HTTP proxy
  66. #
  67. http protocol httpfilter {
  68. # Return HTTP/HTML error pages to the client
  69. return error
  70. # Block disallowed sites
  71. label "URL filtered!"
  72. request url filter "www.example.com/"
  73. # Block disallowed browsers
  74. label "Please try a <em>different Browser</em>"
  75. header filter "Mozilla/4.0 (compatible; MSIE *" from "User-Agent"
  76. # Block some well-known Instant Messengers
  77. label "Instant messenger disallowed!"
  78. response header filter "application/x-msn-messenger" from "Content-Type"
  79. response header filter "app/x-hotbar-xip20" from "Content-Type"
  80. response header filter "application/x-icq" from "Content-Type"
  81. response header filter "AIM/HTTP" from "Content-Type"
  82. response header filter "application/x-comet-log" from "Content-Type"
  83. }
  84. relay httpproxy {
  85. # Listen on localhost, accept diverted connections from pf(4)
  86. listen on 127.0.0.1 port 8080
  87. protocol httpfilter
  88. # Forward to the original target host
  89. forward to destination
  90. }