rmails 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/Gemfile +24 -0
- data/Gemfile.lock +167 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +9 -0
- data/Rakefile +31 -0
- data/Rakefile1 +9 -0
- data/Vagrantfile +51 -0
- data/app/assets/images/arrow_bottom.gif +0 -0
- data/app/assets/images/arrow_right.gif +0 -0
- data/app/assets/images/at-sign.png +0 -0
- data/app/assets/images/checkerboard.gif +0 -0
- data/app/assets/images/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/glyphicons-halflings.png +0 -0
- data/app/assets/images/icon_draft.gif +0 -0
- data/app/assets/images/icon_layout.gif +0 -0
- data/app/assets/images/icon_move.gif +0 -0
- data/app/assets/images/icon_regular.gif +0 -0
- data/app/assets/images/icon_snippet.gif +0 -0
- data/app/assets/images/nav_arrow.png +0 -0
- data/app/assets/images/x.png +0 -0
- data/app/assets/javascripts/application.coffee.erb +27 -0
- data/app/assets/javascripts/canjs/can.construct.proxy.js +60 -0
- data/app/assets/javascripts/canjs/can.construct.super.js +44 -0
- data/app/assets/javascripts/canjs/can.control.plugin.js +245 -0
- data/app/assets/javascripts/canjs/can.control.view.js +88 -0
- data/app/assets/javascripts/canjs/can.dojo.js +3669 -0
- data/app/assets/javascripts/canjs/can.dojo.min.js +66 -0
- data/app/assets/javascripts/canjs/can.fixture.js +1020 -0
- data/app/assets/javascripts/canjs/can.jquery.js +2995 -0
- data/app/assets/javascripts/canjs/can.jquery.min.js +52 -0
- data/app/assets/javascripts/canjs/can.mootools.js +3462 -0
- data/app/assets/javascripts/canjs/can.mootools.min.js +63 -0
- data/app/assets/javascripts/canjs/can.observe.attributes.js +293 -0
- data/app/assets/javascripts/canjs/can.observe.backup.js +368 -0
- data/app/assets/javascripts/canjs/can.observe.delegate.js +359 -0
- data/app/assets/javascripts/canjs/can.observe.setter.js +58 -0
- data/app/assets/javascripts/canjs/can.observe.validations.js +374 -0
- data/app/assets/javascripts/canjs/can.view.modifiers.js +292 -0
- data/app/assets/javascripts/canjs/can.yui.js +3530 -0
- data/app/assets/javascripts/canjs/can.yui.min.js +65 -0
- data/app/assets/javascripts/canjs/can.zepto.js +3426 -0
- data/app/assets/javascripts/canjs/can.zepto.min.js +62 -0
- data/app/assets/javascripts/controls/admins.coffee.erb +105 -0
- data/app/assets/javascripts/controls/aliases.coffee.erb +91 -0
- data/app/assets/javascripts/controls/domains.coffee.erb +115 -0
- data/app/assets/javascripts/controls/settings.coffee.erb +47 -0
- data/app/assets/javascripts/controls/users.coffee.erb +94 -0
- data/app/assets/javascripts/lib/facebox.js +311 -0
- data/app/assets/javascripts/lib/html5.js +2 -0
- data/app/assets/javascripts/lib/jquery.js +9301 -0
- data/app/assets/javascripts/lib/jquery_formparams.js +108 -0
- data/app/assets/javascripts/lib/jquery_input_hint.js +20 -0
- data/app/assets/javascripts/lib/jquery_paginate.js +120 -0
- data/app/assets/javascripts/lib/jquery_ui_custom.js +6 -0
- data/app/assets/javascripts/lib/json2.js +487 -0
- data/app/assets/javascripts/lib/utils.coffee.erb +48 -0
- data/app/assets/javascripts/models/admin.coffee.erb +42 -0
- data/app/assets/javascripts/models/alias.coffee.erb +28 -0
- data/app/assets/javascripts/models/domain.coffee.erb +39 -0
- data/app/assets/javascripts/models/property.coffee.erb +18 -0
- data/app/assets/javascripts/models/user.coffee.erb +29 -0
- data/app/assets/stylesheets/application.sass +156 -0
- data/app/assets/stylesheets/base.css.sass +243 -0
- data/app/assets/stylesheets/facebox.css +80 -0
- data/app/assets/stylesheets/lib/bootstrap.css +9 -0
- data/app/assets/stylesheets/twitter/bootstrap-responsive.scss +1 -0
- data/app/assets/stylesheets/twitter/bootstrap.scss +63 -0
- data/app/assets/stylesheets/twitter/bootstrap/_accordion.scss +34 -0
- data/app/assets/stylesheets/twitter/bootstrap/_alerts.scss +79 -0
- data/app/assets/stylesheets/twitter/bootstrap/_breadcrumbs.scss +24 -0
- data/app/assets/stylesheets/twitter/bootstrap/_button-groups.scss +229 -0
- data/app/assets/stylesheets/twitter/bootstrap/_buttons.scss +228 -0
- data/app/assets/stylesheets/twitter/bootstrap/_carousel.scss +158 -0
- data/app/assets/stylesheets/twitter/bootstrap/_close.scss +32 -0
- data/app/assets/stylesheets/twitter/bootstrap/_code.scss +61 -0
- data/app/assets/stylesheets/twitter/bootstrap/_component-animations.scss +22 -0
- data/app/assets/stylesheets/twitter/bootstrap/_dropdowns.scss +237 -0
- data/app/assets/stylesheets/twitter/bootstrap/_forms.scss +689 -0
- data/app/assets/stylesheets/twitter/bootstrap/_grid.scss +21 -0
- data/app/assets/stylesheets/twitter/bootstrap/_hero-unit.scss +25 -0
- data/app/assets/stylesheets/twitter/bootstrap/_labels-badges.scss +83 -0
- data/app/assets/stylesheets/twitter/bootstrap/_layouts.scss +16 -0
- data/app/assets/stylesheets/twitter/bootstrap/_media.scss +55 -0
- data/app/assets/stylesheets/twitter/bootstrap/_mixins.scss +690 -0
- data/app/assets/stylesheets/twitter/bootstrap/_modals.scss +95 -0
- data/app/assets/stylesheets/twitter/bootstrap/_navbar.scss +497 -0
- data/app/assets/stylesheets/twitter/bootstrap/_navs.scss +409 -0
- data/app/assets/stylesheets/twitter/bootstrap/_pager.scss +43 -0
- data/app/assets/stylesheets/twitter/bootstrap/_pagination.scss +123 -0
- data/app/assets/stylesheets/twitter/bootstrap/_popovers.scss +133 -0
- data/app/assets/stylesheets/twitter/bootstrap/_progress-bars.scss +122 -0
- data/app/assets/stylesheets/twitter/bootstrap/_reset.scss +216 -0
- data/app/assets/stylesheets/twitter/bootstrap/_responsive-1200px-min.scss +28 -0
- data/app/assets/stylesheets/twitter/bootstrap/_responsive-767px-max.scss +193 -0
- data/app/assets/stylesheets/twitter/bootstrap/_responsive-768px-979px.scss +19 -0
- data/app/assets/stylesheets/twitter/bootstrap/_responsive-navbar.scss +189 -0
- data/app/assets/stylesheets/twitter/bootstrap/_responsive-utilities.scss +74 -0
- data/app/assets/stylesheets/twitter/bootstrap/_scaffolding.scss +53 -0
- data/app/assets/stylesheets/twitter/bootstrap/_sprites.scss +197 -0
- data/app/assets/stylesheets/twitter/bootstrap/_tables.scss +235 -0
- data/app/assets/stylesheets/twitter/bootstrap/_thumbnails.scss +53 -0
- data/app/assets/stylesheets/twitter/bootstrap/_tooltip.scss +70 -0
- data/app/assets/stylesheets/twitter/bootstrap/_type.scss +247 -0
- data/app/assets/stylesheets/twitter/bootstrap/_utilities.scss +45 -0
- data/app/assets/stylesheets/twitter/bootstrap/_variables.scss +301 -0
- data/app/assets/stylesheets/twitter/bootstrap/_wells.scss +29 -0
- data/app/assets/stylesheets/twitter/bootstrap/responsive.scss +48 -0
- data/app/controllers/admin_users_controller.rb +62 -0
- data/app/controllers/aliases_controller.rb +35 -0
- data/app/controllers/application_controller.rb +20 -0
- data/app/controllers/domains_controller.rb +48 -0
- data/app/controllers/server_controller.rb +28 -0
- data/app/controllers/users_controller.rb +35 -0
- data/app/helpers/admin_users_helper.rb +11 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/helpers/domains_helper.rb +25 -0
- data/app/helpers/server_helper.rb +30 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/admin_user.rb +54 -0
- data/app/models/certificate_manager.rb +46 -0
- data/app/models/property.rb +103 -0
- data/app/models/property/awstats.rb +15 -0
- data/app/models/property/dovecot.rb +61 -0
- data/app/models/property/dspam.rb +45 -0
- data/app/models/property/nginx.rb +47 -0
- data/app/models/property/postfix.rb +64 -0
- data/app/models/property_value_validator.rb +41 -0
- data/app/models/system_manager.rb +88 -0
- data/app/models/virtual_alias.rb +13 -0
- data/app/models/virtual_domain.rb +15 -0
- data/app/models/virtual_user.rb +51 -0
- data/app/views/admin_users/_form.html.haml +21 -0
- data/app/views/admin_users/first.html.haml +12 -0
- data/app/views/admin_users/index.html.haml +61 -0
- data/app/views/aliases/_form.html.haml +11 -0
- data/app/views/aliases/_list.html.haml +0 -0
- data/app/views/devise/confirmations/new.html.haml +9 -0
- data/app/views/devise/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/devise/mailer/unlock_instructions.html.haml +5 -0
- data/app/views/devise/passwords/edit.html.haml +14 -0
- data/app/views/devise/passwords/new.html.haml +12 -0
- data/app/views/devise/registrations/edit.html.haml +18 -0
- data/app/views/devise/registrations/new.html.haml +10 -0
- data/app/views/devise/sessions/new.html.haml +16 -0
- data/app/views/devise/shared/_links.haml +17 -0
- data/app/views/devise/unlocks/new.html.haml +11 -0
- data/app/views/domains/_fields.html.haml +0 -0
- data/app/views/domains/_form.html.haml +7 -0
- data/app/views/domains/index.html.haml +133 -0
- data/app/views/domains/show.html.haml +1 -0
- data/app/views/layouts/_nav.html.haml +3 -0
- data/app/views/layouts/application.html.haml +29 -0
- data/app/views/server/_certificates.html.haml +10 -0
- data/app/views/server/_dovecot.html.haml +27 -0
- data/app/views/server/_dspam.html.haml +9 -0
- data/app/views/server/_postfix_info.html.haml +5 -0
- data/app/views/server/_postfix_test.html.haml +5 -0
- data/app/views/server/_status.html.haml +11 -0
- data/app/views/server/index.html.haml +36 -0
- data/app/views/users/_form.html.haml +11 -0
- data/app/views/users/_list.html.haml +0 -0
- data/bin/rmails +43 -0
- data/config.ru +4 -0
- data/config/application.rb +62 -0
- data/config/boot.rb +6 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +37 -0
- data/config/environments/production.rb +67 -0
- data/config/environments/test.rb +37 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/devise.rb +240 -0
- data/config/initializers/devise_encryptable.rb +37 -0
- data/config/initializers/devise_models.rb +86 -0
- data/config/initializers/inflections.rb +15 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/initializers/simple_form.rb +142 -0
- data/config/initializers/simple_form_bootstrap.rb +45 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/cz.yml +45 -0
- data/config/locales/devise.cz.yml +47 -0
- data/config/locales/devise.en.yml +60 -0
- data/config/locales/en.yml +5 -0
- data/config/locales/server/cz.yml +14 -0
- data/config/locales/server/en.yml +7 -0
- data/config/locales/server/help/dovecot/cz.yml +21 -0
- data/config/locales/server/help/dovecot/en.yml +18 -0
- data/config/locales/server/help/dspam/cz.yml +10 -0
- data/config/locales/server/help/dspam/en.yml +4 -0
- data/config/locales/server/key/dovecot/cz.yml +23 -0
- data/config/locales/server/key/dovecot/en.yml +20 -0
- data/config/locales/server/key/dspam/cz.yml +10 -0
- data/config/locales/server/key/dspam/en.yml +4 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/locales/views/admin_users/cz.yml +25 -0
- data/config/locales/views/admin_users/en.yml +5 -0
- data/config/locales/views/aliases/cz.yml +17 -0
- data/config/locales/views/aliases/en.yml +1 -0
- data/config/locales/views/devise/cz.yml +26 -0
- data/config/locales/views/devise/en.yml +13 -0
- data/config/locales/views/domains/cz.yml +15 -0
- data/config/locales/views/domains/en.yml +15 -0
- data/config/locales/views/server/cz.yml +19 -0
- data/config/locales/views/server/en.yml +3 -0
- data/config/locales/views/users/cz.yml +18 -0
- data/config/locales/views/users/en.yml +1 -0
- data/config/routes.rb +80 -0
- data/db/migrate/20121112201233_virtual_domain.rb +11 -0
- data/db/migrate/20121112201247_virtual_alias.rb +10 -0
- data/db/migrate/20121112201341_virtual_user.rb +34 -0
- data/db/migrate/20121112201359_create_admin_user.rb +30 -0
- data/db/migrate/20121112201411_server_configuration.rb +13 -0
- data/db/migrate/20130304083938_join_domains_users.rb +12 -0
- data/db/migrate/20130311214040_create_versions.rb +18 -0
- data/db/seeds.rb +45 -0
- data/lib/devise-encryptable.rb +1 -0
- data/lib/rmails.rb +5 -0
- data/lib/rmails/installer.rb +37 -0
- data/lib/rmails/version.rb +3 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/templates/haml/scaffold/_form.html.haml +10 -0
- data/locals +0 -0
- data/log/.gitkeep +0 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +25 -0
- data/public/favicon.ico +0 -0
- data/public/fonts/London.eot +0 -0
- data/public/fonts/London.otf +0 -0
- data/public/fonts/London.woff +0 -0
- data/public/fonts/LondonBold.otf +0 -0
- data/public/robots.txt +5 -0
- data/rmails.gemspec +35 -0
- data/script/prepflog.pl +576 -0
- data/script/rails +6 -0
- data/system/config/automateit_env.rb +16 -0
- data/system/config/fields.yml +48 -0
- data/system/config/tags.yml +39 -0
- data/system/dist/README_AutomateIt_dist.txt +20 -0
- data/system/dist/amavis/spamassassin.cf.erb +85 -0
- data/system/dist/amavis/user.erb +33 -0
- data/system/dist/awstats/awstats.mail.conf.erb +41 -0
- data/system/dist/awstats/prepflog.pl +576 -0
- data/system/dist/dovecot/dovecot-sql.conf.ext.erb +14 -0
- data/system/dist/dovecot/dovecot.conf.erb +297 -0
- data/system/dist/dovecot/old_dovecot.conf.erb +63 -0
- data/system/dist/dspam/conf.erb +96 -0
- data/system/dist/dspam/pgsql.conf +33 -0
- data/system/dist/nginx/awstats.erb +17 -0
- data/system/dist/nginx/rmails.erb +40 -0
- data/system/dist/postfix/email2email.cf.erb +5 -0
- data/system/dist/postfix/main.cf.erb +118 -0
- data/system/dist/postfix/master.cf.erb +74 -0
- data/system/dist/postfix/sasl.conf.erb +3 -0
- data/system/dist/postfix/sender_login_maps.cf.erb +5 -0
- data/system/dist/postfix/virtual_alias_maps.cf.erb +5 -0
- data/system/dist/postfix/virtual_mailbox_domains.cf.erb +5 -0
- data/system/dist/postfix/virtual_mailbox_maps.cf.erb +5 -0
- data/system/dist/postgresql/postgresql.conf.erb +54 -0
- data/system/dist/rmails/Gemfile.1 +8 -0
- data/system/dist/rmails/Gemfile.2 +24 -0
- data/system/dist/rmails/database.yml.erb +15 -0
- data/system/dist/sudoers +37 -0
- data/system/lib/README_AutomateIt_lib.txt +22 -0
- data/system/lib/dkim_key.rb +9 -0
- data/system/lib/smtpd_key.rb +39 -0
- data/system/lib/ssl.rb +23 -0
- data/system/recipes/01_prepare_server.rb +84 -0
- data/system/recipes/02_setup_database.rb +65 -0
- data/system/recipes/03_setup_postfix.rb +124 -0
- data/system/recipes/04_setup_dovecot.rb +78 -0
- data/system/recipes/05_setup_nginx.rb +29 -0
- data/system/recipes/06_setup_dspam.rb +24 -0
- data/system/recipes/07_setup_amavis.rb +16 -0
- data/system/recipes/08_setup_spamassassin.rb +22 -0
- data/system/recipes/09_setup_awstats.rb +49 -0
- data/system/recipes/XX_start_services.rb +5 -0
- data/test/fixtures/.gitkeep +0 -0
- data/test/functional/.gitkeep +0 -0
- data/test/functional/aliases_controller_test.rb +7 -0
- data/test/functional/domains_controller_test.rb +7 -0
- data/test/functional/users_controller_test.rb +7 -0
- data/test/integration/.gitkeep +0 -0
- data/test/performance/browsing_test.rb +12 -0
- data/test/test_helper.rb +13 -0
- data/test/unit/.gitkeep +0 -0
- data/test/unit/helpers/aliases_helper_test.rb +4 -0
- data/test/unit/helpers/domains_helper_test.rb +4 -0
- data/test/unit/helpers/users_helper_test.rb +4 -0
- data/vendor/assets/javascripts/.gitkeep +0 -0
- data/vendor/assets/javascripts/canjs/can.construct.proxy.js +60 -0
- data/vendor/assets/javascripts/canjs/can.construct.super.js +44 -0
- data/vendor/assets/javascripts/canjs/can.control.plugin.js +245 -0
- data/vendor/assets/javascripts/canjs/can.control.view.js +88 -0
- data/vendor/assets/javascripts/canjs/can.dojo.js +3669 -0
- data/vendor/assets/javascripts/canjs/can.dojo.min.js +66 -0
- data/vendor/assets/javascripts/canjs/can.fixture.js +1020 -0
- data/vendor/assets/javascripts/canjs/can.jquery.js +2995 -0
- data/vendor/assets/javascripts/canjs/can.jquery.min.js +52 -0
- data/vendor/assets/javascripts/canjs/can.mootools.js +3462 -0
- data/vendor/assets/javascripts/canjs/can.mootools.min.js +63 -0
- data/vendor/assets/javascripts/canjs/can.observe.attributes.js +293 -0
- data/vendor/assets/javascripts/canjs/can.observe.backup.js +368 -0
- data/vendor/assets/javascripts/canjs/can.observe.delegate.js +359 -0
- data/vendor/assets/javascripts/canjs/can.observe.setter.js +58 -0
- data/vendor/assets/javascripts/canjs/can.observe.validations.js +374 -0
- data/vendor/assets/javascripts/canjs/can.view.modifiers.js +292 -0
- data/vendor/assets/javascripts/canjs/can.yui.js +3530 -0
- data/vendor/assets/javascripts/canjs/can.yui.min.js +65 -0
- data/vendor/assets/javascripts/canjs/can.zepto.js +3426 -0
- data/vendor/assets/javascripts/canjs/can.zepto.min.js +62 -0
- data/vendor/assets/javascripts/twitter/bootstrap-affix.js +104 -0
- data/vendor/assets/javascripts/twitter/bootstrap-alert.js +90 -0
- data/vendor/assets/javascripts/twitter/bootstrap-button.js +96 -0
- data/vendor/assets/javascripts/twitter/bootstrap-carousel.js +176 -0
- data/vendor/assets/javascripts/twitter/bootstrap-collapse.js +158 -0
- data/vendor/assets/javascripts/twitter/bootstrap-dropdown.js +150 -0
- data/vendor/assets/javascripts/twitter/bootstrap-modal.js +239 -0
- data/vendor/assets/javascripts/twitter/bootstrap-popover.js +103 -0
- data/vendor/assets/javascripts/twitter/bootstrap-scrollspy.js +151 -0
- data/vendor/assets/javascripts/twitter/bootstrap-tab.js +135 -0
- data/vendor/assets/javascripts/twitter/bootstrap-tooltip.js +275 -0
- data/vendor/assets/javascripts/twitter/bootstrap-transition.js +60 -0
- data/vendor/assets/javascripts/twitter/bootstrap-typeahead.js +300 -0
- data/vendor/assets/javascripts/twitter/my/bootstrap-typeahead.js +311 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- metadata +470 -0
data/script/rails
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
|
3
|
+
|
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
|
6
|
+
require 'rails/commands'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Put your environment commands here
|
|
2
|
+
|
|
3
|
+
#-----------------------------------------------------------------------
|
|
4
|
+
#
|
|
5
|
+
# == ENVIRONMENT
|
|
6
|
+
#
|
|
7
|
+
# This is an AutomateIt environment file. Use it to customize AutomateIt
|
|
8
|
+
# and provide settings to recipes, interactive shell, or embedded
|
|
9
|
+
# Interpreters using this project.
|
|
10
|
+
#
|
|
11
|
+
# The "self" in this file is an Interpreter instance, so you can execute
|
|
12
|
+
# all the same commands that you'd normally put in a recipe.
|
|
13
|
+
#
|
|
14
|
+
# This file is loaded after the project's tags, fields and libraries.
|
|
15
|
+
#
|
|
16
|
+
#-----------------------------------------------------------------------
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Put your fields here
|
|
2
|
+
|
|
3
|
+
hostname: rmails.com
|
|
4
|
+
postfix:
|
|
5
|
+
database:
|
|
6
|
+
adapter: pgsql
|
|
7
|
+
user: postfix
|
|
8
|
+
password: S0meP4ssw0rd
|
|
9
|
+
name: rmails
|
|
10
|
+
host: 127.0.0.1
|
|
11
|
+
message_size_limit: 15728640
|
|
12
|
+
mail_name: Rmails
|
|
13
|
+
myhostname: mail.rmails.com
|
|
14
|
+
mydomain: rmails.com
|
|
15
|
+
smtpd_banner: "$myhostname ESMTP $mail_name"
|
|
16
|
+
dovecot:
|
|
17
|
+
protocols: imap pop3
|
|
18
|
+
postmaster: fandisek@gmail.com
|
|
19
|
+
storage_size: 400M
|
|
20
|
+
trash_storage_size: 10%%
|
|
21
|
+
spam_storage_size: 10%%
|
|
22
|
+
service:
|
|
23
|
+
imap_login:
|
|
24
|
+
listener_imap_port: 143
|
|
25
|
+
listener_imaps_port: 993
|
|
26
|
+
pop3_login:
|
|
27
|
+
listener_pop3_port: 110
|
|
28
|
+
listener_pop3s_port: 995
|
|
29
|
+
imap:
|
|
30
|
+
process_limit: 1024
|
|
31
|
+
pop3:
|
|
32
|
+
process_limit: 1024
|
|
33
|
+
web:
|
|
34
|
+
domain_third_dot: ''
|
|
35
|
+
database:
|
|
36
|
+
host: localhost
|
|
37
|
+
port: 5432
|
|
38
|
+
max_connections: 111
|
|
39
|
+
|
|
40
|
+
dspam:
|
|
41
|
+
delivery_port: 7711
|
|
42
|
+
database:
|
|
43
|
+
user: dspamer
|
|
44
|
+
password: S0meP4ssw0rd
|
|
45
|
+
name: dspam
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Put your roles here
|
|
2
|
+
|
|
3
|
+
#-----------------------------------------------------------------------
|
|
4
|
+
#
|
|
5
|
+
# == TAGS
|
|
6
|
+
#
|
|
7
|
+
# This is an AutomateIt tags file. Use it to assign tags to hosts so you
|
|
8
|
+
# can manage multiple hosts as a group.
|
|
9
|
+
#
|
|
10
|
+
# For example, in this file assign the tag "myrole" to two computers
|
|
11
|
+
# named "host1" and "host2":
|
|
12
|
+
#
|
|
13
|
+
# myrole:
|
|
14
|
+
# - host1
|
|
15
|
+
# - host2
|
|
16
|
+
#
|
|
17
|
+
# Then check from a recipe if this host has this tag:
|
|
18
|
+
#
|
|
19
|
+
# if tagged?("myrole")
|
|
20
|
+
# # Code will only run if this host is tagged with "myrole"
|
|
21
|
+
# end
|
|
22
|
+
#
|
|
23
|
+
# You can also retrieve tags:
|
|
24
|
+
#
|
|
25
|
+
# puts "Tags for this host: #{tags.inspect}"
|
|
26
|
+
# # => ["myrole"]
|
|
27
|
+
# puts "Tags for a specific host: #{tags_for("host1").inspect}"
|
|
28
|
+
# # => ["myrole"]
|
|
29
|
+
# puts "Hosts with a tag: #{hosts_tagged_with("myrole").inspect}"
|
|
30
|
+
# # => ["host1", "host2"]
|
|
31
|
+
#
|
|
32
|
+
# You will likely see additional tags which are automatically added
|
|
33
|
+
# based on the host's operating system, architecture, hostnames, etc.
|
|
34
|
+
#
|
|
35
|
+
# You may use ERB statements within this file.
|
|
36
|
+
#
|
|
37
|
+
# See AutomateIt::TagManager for further details.
|
|
38
|
+
#
|
|
39
|
+
#-----------------------------------------------------------------------
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#-----------------------------------------------------------------------
|
|
2
|
+
#
|
|
3
|
+
# == DIST
|
|
4
|
+
#
|
|
5
|
+
# This is your AutomateIt project's "dist" directory. It's a place for
|
|
6
|
+
# keeping files and templates you plan to distribute.
|
|
7
|
+
#
|
|
8
|
+
# You can retrieve this directory's path using the "dist" method in
|
|
9
|
+
# recipes, for example:
|
|
10
|
+
#
|
|
11
|
+
# # Display the "dist" directory's path
|
|
12
|
+
# puts dist
|
|
13
|
+
#
|
|
14
|
+
# # Render the template file "dist/foo.erb"
|
|
15
|
+
# render(:file => dist+"/foo.erb", ...)
|
|
16
|
+
#
|
|
17
|
+
# # Or copy the same file somewhere
|
|
18
|
+
# cp(dist+"/foo.erb", ...)
|
|
19
|
+
#
|
|
20
|
+
#-----------------------------------------------------------------------
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# This is the right place to customize your installation of SpamAssassin.
|
|
2
|
+
#
|
|
3
|
+
# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
|
|
4
|
+
# tweaked.
|
|
5
|
+
#
|
|
6
|
+
# Only a small subset of options are listed below
|
|
7
|
+
#
|
|
8
|
+
###########################################################################
|
|
9
|
+
|
|
10
|
+
# Add *****SPAM***** to the Subject header of spam e-mails
|
|
11
|
+
#
|
|
12
|
+
# rewrite_header Subject *****SPAM*****
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Save spam messages as a message/rfc822 MIME attachment instead of
|
|
16
|
+
# modifying the original message (0: off, 2: use text/plain instead)
|
|
17
|
+
#
|
|
18
|
+
report_safe 1
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# Set which networks or hosts are considered 'trusted' by your mail
|
|
22
|
+
# server (i.e. not spammers)
|
|
23
|
+
#
|
|
24
|
+
# trusted_networks 212.17.35.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# Set file-locking method (flock is not safe over NFS, but is faster)
|
|
28
|
+
#
|
|
29
|
+
# lock_method flock
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Set the threshold at which a message is considered spam (default: 5.0)
|
|
33
|
+
#
|
|
34
|
+
required_score 5.0
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# Use Bayesian classifier (default: 1)
|
|
38
|
+
#
|
|
39
|
+
use_bayes 0
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# Bayesian classifier auto-learning (default: 1)
|
|
43
|
+
#
|
|
44
|
+
bayes_auto_learn 0
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Set headers which may provide inappropriate cues to the Bayesian
|
|
48
|
+
# classifier
|
|
49
|
+
#
|
|
50
|
+
# bayes_ignore_header X-Bogosity
|
|
51
|
+
# bayes_ignore_header X-Spam-Flag
|
|
52
|
+
# bayes_ignore_header X-Spam-Status
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# Some shortcircuiting, if the plugin is enabled
|
|
56
|
+
#
|
|
57
|
+
ifplugin Mail::SpamAssassin::Plugin::Shortcircuit
|
|
58
|
+
#
|
|
59
|
+
# default: strongly-whitelisted mails are *really* whitelisted now, if the
|
|
60
|
+
# shortcircuiting plugin is active, causing early exit to save CPU load.
|
|
61
|
+
# Uncomment to turn this on
|
|
62
|
+
#
|
|
63
|
+
# shortcircuit USER_IN_WHITELIST on
|
|
64
|
+
# shortcircuit USER_IN_DEF_WHITELIST on
|
|
65
|
+
# shortcircuit USER_IN_ALL_SPAM_TO on
|
|
66
|
+
# shortcircuit SUBJECT_IN_WHITELIST on
|
|
67
|
+
|
|
68
|
+
# the opposite; blacklisted mails can also save CPU
|
|
69
|
+
#
|
|
70
|
+
# shortcircuit USER_IN_BLACKLIST on
|
|
71
|
+
# shortcircuit USER_IN_BLACKLIST_TO on
|
|
72
|
+
# shortcircuit SUBJECT_IN_BLACKLIST on
|
|
73
|
+
|
|
74
|
+
# if you have taken the time to correctly specify your "trusted_networks",
|
|
75
|
+
# this is another good way to save CPU
|
|
76
|
+
#
|
|
77
|
+
# shortcircuit ALL_TRUSTED on
|
|
78
|
+
|
|
79
|
+
# and a well-trained bayes DB can save running rules, too
|
|
80
|
+
#
|
|
81
|
+
# shortcircuit BAYES_99 spam
|
|
82
|
+
# shortcircuit BAYES_00 ham
|
|
83
|
+
|
|
84
|
+
endif # Mail::SpamAssassin::Plugin::Shortcircuit
|
|
85
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
use strict;
|
|
2
|
+
|
|
3
|
+
$max_servers = 2;
|
|
4
|
+
|
|
5
|
+
$mydomain = '<%= mydomain %>';
|
|
6
|
+
|
|
7
|
+
@bypass_virus_checks_acl = qw( . );
|
|
8
|
+
|
|
9
|
+
$sa_tag_level_deflt = -999;
|
|
10
|
+
|
|
11
|
+
$sa_tag2_level_deflt = 5.0;
|
|
12
|
+
|
|
13
|
+
$inet_socket_port = 3377;
|
|
14
|
+
|
|
15
|
+
$forward_method='smtp:[127.0.0.1]:7733';
|
|
16
|
+
$notify_method ='smtp:[127.0.0.1]:7733';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
$sa_spam_subject_tag = '***SPAM*** ';
|
|
20
|
+
$sa_tag_level_deflt = 2.0; # add spam info headers if at, or above that level
|
|
21
|
+
$sa_tag2_level_deflt = 6.31; # add 'spam detected' headers at that level
|
|
22
|
+
$sa_kill_level_deflt = 6.31; # triggers spam evasive actions
|
|
23
|
+
$sa_dsn_cutoff_level = 10; # spam level beyond which a DSN is not sent
|
|
24
|
+
|
|
25
|
+
$sa_mail_body_size_limit = 200*1024; # don't waste time on SA if mail is larger
|
|
26
|
+
$sa_local_tests_only = 1; # only tests which do not require internet access?
|
|
27
|
+
|
|
28
|
+
$final_virus_destiny = D_DISCARD; # (data not lost, see virus quarantine)
|
|
29
|
+
$final_banned_destiny = D_BOUNCE; # D_REJECT when front-end MTA
|
|
30
|
+
$final_spam_destiny = D_BOUNCE;
|
|
31
|
+
$final_bad_header_destiny = D_PASS; # False-positive prone (for spam)
|
|
32
|
+
|
|
33
|
+
1;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
LogFile="cat <%= logfile %> | prepflog.pl | maillogconvert.pl standard | grep <%= domain %> |"
|
|
3
|
+
|
|
4
|
+
LogType=M
|
|
5
|
+
LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"
|
|
6
|
+
SiteDomain="<%= domain %>"
|
|
7
|
+
HostAliases="<%= domain %>"
|
|
8
|
+
|
|
9
|
+
DirData="<%= outputs %>/<%= domain %>"
|
|
10
|
+
|
|
11
|
+
LevelForBrowsersDetection=0
|
|
12
|
+
LevelForOSDetection=0
|
|
13
|
+
LevelForRefererAnalyze=0
|
|
14
|
+
LevelForRobotsDetection=0
|
|
15
|
+
LevelForWormsDetection=0
|
|
16
|
+
LevelForSearchEnginesDetection=0
|
|
17
|
+
LevelForFileTypesDetection=0
|
|
18
|
+
ShowMenu=1
|
|
19
|
+
ShowSummary=HB
|
|
20
|
+
ShowMonthStats=HB
|
|
21
|
+
ShowDaysOfMonthStats=HB
|
|
22
|
+
ShowDaysOfWeekStats=HB
|
|
23
|
+
ShowHoursStats=HB
|
|
24
|
+
ShowDomainsStats=0
|
|
25
|
+
ShowHostsStats=HBL
|
|
26
|
+
ShowAuthenticatedUsers=0
|
|
27
|
+
ShowRobotsStats=0
|
|
28
|
+
ShowEMailSenders=HBML
|
|
29
|
+
ShowEMailReceivers=HBML
|
|
30
|
+
ShowSessionsStats=0
|
|
31
|
+
ShowPagesStats=0
|
|
32
|
+
ShowFileTypesStats=0
|
|
33
|
+
ShowFileSizesStats=0
|
|
34
|
+
ShowBrowsersStats=0
|
|
35
|
+
ShowOSStats=0
|
|
36
|
+
ShowOriginStats=0
|
|
37
|
+
ShowKeyphrasesStats=0
|
|
38
|
+
ShowKeywordsStats=0
|
|
39
|
+
ShowMiscStats=0
|
|
40
|
+
ShowHTTPErrorsStats=0
|
|
41
|
+
ShowSMTPErrorsStats=1
|
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
#!/usr/bin/perl
|
|
2
|
+
eval 'exec perl -S $0 "$@"'
|
|
3
|
+
if 0;
|
|
4
|
+
|
|
5
|
+
=pod
|
|
6
|
+
|
|
7
|
+
=head1 NAME
|
|
8
|
+
|
|
9
|
+
prepflog.pl - Pre-processor for pflogsumm
|
|
10
|
+
|
|
11
|
+
=head1 SYNOPSIS
|
|
12
|
+
|
|
13
|
+
prepflog.pl [-d <today|yesterday>][--syslog_name=string]
|
|
14
|
+
[file1 [filen]]
|
|
15
|
+
|
|
16
|
+
prepflog.pl -[help|version]
|
|
17
|
+
|
|
18
|
+
If no file(s) specified, reads from stdin. Output is to stdout.
|
|
19
|
+
|
|
20
|
+
=head1 DESCRIPTION
|
|
21
|
+
|
|
22
|
+
Utility to filter out postfix log lines due to re-injection
|
|
23
|
+
into postfix of messages from a content filter or antivirus
|
|
24
|
+
scanner.
|
|
25
|
+
|
|
26
|
+
Reads from input and writes to output intercepting and
|
|
27
|
+
disregarding lines which are related to the second
|
|
28
|
+
passage of messages through postfix.
|
|
29
|
+
|
|
30
|
+
The output is suitable to pass to pflogsumm and should avoid
|
|
31
|
+
pflogsumm's double counting of these messages.
|
|
32
|
+
|
|
33
|
+
As with pflogsumm itself, only postfix lines are processed.
|
|
34
|
+
All other log lines are not passed on to the output.
|
|
35
|
+
A non standard syslog name can be handled via the
|
|
36
|
+
syslog_name parameter. Also log lines may be filtered by
|
|
37
|
+
today or yesterday's date.
|
|
38
|
+
|
|
39
|
+
=head1 OPTIONS
|
|
40
|
+
|
|
41
|
+
-d today extract log lines just for today
|
|
42
|
+
|
|
43
|
+
-d yesterday extract log lines just for yesterday
|
|
44
|
+
|
|
45
|
+
-help Emit short usage message and bail out.
|
|
46
|
+
|
|
47
|
+
--syslog_name=name
|
|
48
|
+
|
|
49
|
+
Set syslog_name to look for for Postfix log entries.
|
|
50
|
+
|
|
51
|
+
By default, prepflog looks for entries in logfiles
|
|
52
|
+
with a syslog name of "postfix," the default.
|
|
53
|
+
If you've set a non-default "syslog_name" parameter
|
|
54
|
+
in your Postfix configuration, use this option to
|
|
55
|
+
tell prepflog what that is.
|
|
56
|
+
|
|
57
|
+
-version Print program name and version and bail out.
|
|
58
|
+
|
|
59
|
+
=head1 EXAMPLES
|
|
60
|
+
|
|
61
|
+
Typical use of this pre-processor would be:
|
|
62
|
+
|
|
63
|
+
prepflog.pl -d yesterday /var/log/mail | pflogsumm.pl
|
|
64
|
+
|
|
65
|
+
Any other options can be specified to pflogsumm as normal.
|
|
66
|
+
The -d flag can however be omitted from pflogsumm if already
|
|
67
|
+
specified with prepflog.pl. It will do no harm if left.
|
|
68
|
+
If --syslog_name is used with prepflog.pl it must be specified
|
|
69
|
+
again with pflogsumm.
|
|
70
|
+
|
|
71
|
+
Processing of log files should be carried out just before
|
|
72
|
+
rotating them. Even so it is still possible to miss messages
|
|
73
|
+
unless processing considers all log files for a particular
|
|
74
|
+
day. A script that may be helpful for this is (which
|
|
75
|
+
considers that logfiles are compressed when rotated):
|
|
76
|
+
|
|
77
|
+
#!/bin/sh
|
|
78
|
+
LASTLOG=`ls -t /var/log/mail*.gz | head -n 1`
|
|
79
|
+
/bin/zcat $LASTLOG | /bin/cat - /var/log/mail | \
|
|
80
|
+
/usr/local/bin/prepflog.pl -d yesterday | \
|
|
81
|
+
/usr/local/bin/pflogsumm
|
|
82
|
+
|
|
83
|
+
=head1 CAVEATS
|
|
84
|
+
|
|
85
|
+
The current release is a beta version, which has
|
|
86
|
+
undergone internal testing. In particular it has not
|
|
87
|
+
been tested on a highly loaded server or a large
|
|
88
|
+
corpus of mail log examples
|
|
89
|
+
|
|
90
|
+
As always, use a program in a test environment until
|
|
91
|
+
you are comfortable about putting it into a production
|
|
92
|
+
environment.
|
|
93
|
+
|
|
94
|
+
=head1 BUGS
|
|
95
|
+
|
|
96
|
+
None known, but needs more testing.
|
|
97
|
+
|
|
98
|
+
=head1 NOTES
|
|
99
|
+
|
|
100
|
+
Compatible with postfix 2.3 or later and pflogsumm 1.1.3
|
|
101
|
+
|
|
102
|
+
=head1 SEE ALSO
|
|
103
|
+
|
|
104
|
+
pflogsumm(1)
|
|
105
|
+
|
|
106
|
+
=head1 AUTHOR
|
|
107
|
+
|
|
108
|
+
John Fawcett
|
|
109
|
+
|
|
110
|
+
This script has been adapted from the pflogsumm
|
|
111
|
+
written by Jim Seymour. Whole sections of pflogsumm
|
|
112
|
+
code have been imported here. The reason for this
|
|
113
|
+
is that having taken into account the way pflogsumm
|
|
114
|
+
works, it should be easier to integrate in the
|
|
115
|
+
future, if indeed that step is found to be a useful one.
|
|
116
|
+
|
|
117
|
+
Any feedback is welcome: john@gufonero.com
|
|
118
|
+
|
|
119
|
+
The script is currently available at:
|
|
120
|
+
http://www.gufonero.com/postfix/
|
|
121
|
+
|
|
122
|
+
=head1 COPYRIGHT AND LICENSE
|
|
123
|
+
|
|
124
|
+
Copyright (c) 2004 John Fawcett
|
|
125
|
+
|
|
126
|
+
The parts of the code derived from pflogsumm are
|
|
127
|
+
copyrighted by Jim Seymour.
|
|
128
|
+
|
|
129
|
+
This program is free software; you can redistribute it and/or
|
|
130
|
+
modify it under the terms of the GNU General Public License
|
|
131
|
+
as published by the Free Software Foundation; either version 2
|
|
132
|
+
of the License, or (at your option) any later version.
|
|
133
|
+
|
|
134
|
+
This program is distributed in the hope that it will be useful,
|
|
135
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
136
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
137
|
+
GNU General Public License for more details.
|
|
138
|
+
|
|
139
|
+
You may have received a copy of the GNU General Public License
|
|
140
|
+
along with this program; if not, write to the Free Software
|
|
141
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
142
|
+
USA.
|
|
143
|
+
|
|
144
|
+
An on-line copy of the GNU General Public License can be found
|
|
145
|
+
http://www.fsf.org/copyleft/gpl.html.
|
|
146
|
+
|
|
147
|
+
=cut
|
|
148
|
+
|
|
149
|
+
# Taken from pflogsumm
|
|
150
|
+
use strict;
|
|
151
|
+
use locale;
|
|
152
|
+
use Getopt::Long;
|
|
153
|
+
eval { require Date::Calc };
|
|
154
|
+
my $hasDateCalc = $@ ? 0 : 1;
|
|
155
|
+
|
|
156
|
+
my $release = "0.4";
|
|
157
|
+
my $debug = 0;
|
|
158
|
+
|
|
159
|
+
use vars qw(
|
|
160
|
+
$progName
|
|
161
|
+
$usageMsg
|
|
162
|
+
%opts
|
|
163
|
+
@monthNames %monthNums $thisYr $thisMon
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
# Constants used throughout pflogsumm
|
|
167
|
+
@monthNames = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
|
|
168
|
+
%monthNums = qw(
|
|
169
|
+
Jan 0 Feb 1 Mar 2 Apr 3 May 4 Jun 5
|
|
170
|
+
Jul 6 Aug 7 Sep 8 Oct 9 Nov 10 Dec 11);
|
|
171
|
+
($thisMon, $thisYr) = (localtime(time()))[4,5];
|
|
172
|
+
$thisYr += 1900;
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
my ( $cmd, $qid,
|
|
176
|
+
$dateStr,
|
|
177
|
+
$msgMonStr, $msgMon, $msgDay, $msgTimeStr, $msgHr, $msgMin, $msgSec,
|
|
178
|
+
$msgYr);
|
|
179
|
+
|
|
180
|
+
$progName = "prepflog.pl";
|
|
181
|
+
$usageMsg =
|
|
182
|
+
"usage: $progName [-d <today|yesterday>] [--syslog_name=name] [file1 [filen]]
|
|
183
|
+
|
|
184
|
+
$progName -[version|help]";
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
GetOptions(
|
|
188
|
+
"d=s" => \$opts{'d'},
|
|
189
|
+
"help" => \$opts{'help'},
|
|
190
|
+
"syslog_name=s" => \$opts{'syslogName'},
|
|
191
|
+
"version" => \$opts{'version'},
|
|
192
|
+
) || die "$usageMsg\n";
|
|
193
|
+
# internally: 0 == none, undefined == -1 == all
|
|
194
|
+
my $syslogName = $opts{'syslogName'}? $opts{'syslogName'} : "postfix";
|
|
195
|
+
|
|
196
|
+
if(defined($opts{'help'})) {
|
|
197
|
+
print "$usageMsg\n";
|
|
198
|
+
exit 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if(defined($opts{'version'})) {
|
|
202
|
+
print "$progName $release\n";
|
|
203
|
+
exit 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if($hasDateCalc) {
|
|
207
|
+
# manually import the Date::Calc routine we want
|
|
208
|
+
#
|
|
209
|
+
# This looks stupid, but it's the only way to shut Perl up about
|
|
210
|
+
# "Date::Calc::Delta_DHMS" used only once" if -w is on. (No,
|
|
211
|
+
# $^W = 0 doesn't work in this context.)
|
|
212
|
+
*Delta_DHMS = *Date::Calc::Delta_DHMS;
|
|
213
|
+
*Delta_DHMS = *Date::Calc::Delta_DHMS;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
$dateStr = get_datestr($opts{'d'}) if(defined($opts{'d'}));
|
|
217
|
+
|
|
218
|
+
########################################################
|
|
219
|
+
# start of prepflog code section
|
|
220
|
+
########################################################
|
|
221
|
+
|
|
222
|
+
# variables used by prepflog
|
|
223
|
+
my %block = (); # array of lines which will be blocked
|
|
224
|
+
my %held_connect = (); # array of smtpd connect lines which will be output or disregarded
|
|
225
|
+
my %held_client = (); # array of smtpd client lines which will be output or disregarded
|
|
226
|
+
my %held_lookup = (); # maps queue ids to process ids and hosts keys
|
|
227
|
+
my %seen = (); # array of message ids for seen messages
|
|
228
|
+
my $lookup; # temporary variable to hold keys for lookups
|
|
229
|
+
my @out_queue = (); # queue for passing log lines back to main loop
|
|
230
|
+
|
|
231
|
+
########################################################
|
|
232
|
+
# end of prepflog code section
|
|
233
|
+
########################################################
|
|
234
|
+
|
|
235
|
+
while(<>) {
|
|
236
|
+
next if(defined($dateStr) && ! /^$dateStr/o);
|
|
237
|
+
s/: \[ID \d+ [^\]]+\] /: /o; # lose "[ID nnnnnn some.thing]" stuff
|
|
238
|
+
my $logRmdr;
|
|
239
|
+
|
|
240
|
+
# "Traditional" timestamp format?
|
|
241
|
+
if((($msgMonStr, $msgDay, $msgHr, $msgMin, $msgSec, $logRmdr) =
|
|
242
|
+
/^(...) {1,2}(\d{1,2}) (\d{2}):(\d{2}):(\d{2}) \S+ (.+)$/o) == 6)
|
|
243
|
+
{
|
|
244
|
+
# Convert string to numeric value for later "month rollover" check
|
|
245
|
+
$msgMon = $monthNums{$msgMonStr};
|
|
246
|
+
} else {
|
|
247
|
+
# RFC 3339 timestamp format?
|
|
248
|
+
next unless((($msgYr, $msgMon, $msgDay, $msgHr, $msgMin, $msgSec, $logRmdr) =
|
|
249
|
+
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:[\+\-](?:\d{2}):(?:\d{2})|Z) \S+ (.+)$/o) == 10);
|
|
250
|
+
# RFC 3339 months start at "1", we index from 0
|
|
251
|
+
--$msgMon;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
unless((($cmd, $qid) = $logRmdr =~ m#^(?:postfix|$syslogName)/([^\[:]*).*?: ([^:\s]+)#o) == 2 ||
|
|
255
|
+
(($cmd, $qid) = $logRmdr =~ m#^((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2)
|
|
256
|
+
{
|
|
257
|
+
#print UNPROCD "$_";
|
|
258
|
+
next;
|
|
259
|
+
}
|
|
260
|
+
chomp;
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
########################################################
|
|
265
|
+
# start of prepflog code section
|
|
266
|
+
########################################################
|
|
267
|
+
|
|
268
|
+
# Each log line is filtered through the preprocess routine.
|
|
269
|
+
# The task of preprocess is to decide whether to output a line. It may:
|
|
270
|
+
# 1. output the line immediately
|
|
271
|
+
# 2. disregard the line immediately
|
|
272
|
+
# 3. reserve judgement until some future line has been processed.
|
|
273
|
+
# 4. In this case, in response to some future log line, preprocess may:
|
|
274
|
+
# a. output the held line(s) and the future log line
|
|
275
|
+
# b. disregard the held line(s) and the future log line
|
|
276
|
+
#
|
|
277
|
+
# The preprocess routine may return:
|
|
278
|
+
# - nothing (cases 2, 3, 4b) in which case processing continues with the next log line.
|
|
279
|
+
# - one or more lines (cases 1, 4a). If preprocess will return multiple lines
|
|
280
|
+
# then the first line is returned on the first call.
|
|
281
|
+
# Any further lines are returned by calling preprocess with an empty input $_.
|
|
282
|
+
# When the preprocess returns nothing (ie preprocessing of a particular log
|
|
283
|
+
# line is finished), processing continues with the next log line.
|
|
284
|
+
|
|
285
|
+
while ( $_ = preprocess($logRmdr) )
|
|
286
|
+
{
|
|
287
|
+
print "$_\n";
|
|
288
|
+
$_ = "";
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
exit 0;
|
|
292
|
+
|
|
293
|
+
# preprocess checks if it was called with non-empty input $_
|
|
294
|
+
# in which case it processes $_ via getnext() which may
|
|
295
|
+
# add lines to the queue.
|
|
296
|
+
# If called with empty input the next line from the queue is
|
|
297
|
+
# returned.
|
|
298
|
+
|
|
299
|
+
sub preprocess
|
|
300
|
+
{
|
|
301
|
+
my $logRmdr = pop(@_);
|
|
302
|
+
if ($_ ne "")
|
|
303
|
+
{
|
|
304
|
+
getnext($logRmdr);
|
|
305
|
+
}
|
|
306
|
+
return shift(@out_queue);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
# getnext contains the logic which decides which lines
|
|
310
|
+
# can be output, which can be blocked and which have
|
|
311
|
+
# to be held for future decision.
|
|
312
|
+
|
|
313
|
+
sub getnext
|
|
314
|
+
{
|
|
315
|
+
my $logRmdr = pop(@_);
|
|
316
|
+
if ($debug) { print "processing <".$logRmdr.">\n"; }
|
|
317
|
+
if( $cmd eq "qmgr" )
|
|
318
|
+
{
|
|
319
|
+
|
|
320
|
+
# If qmgr line has been blocked, disregard this log line
|
|
321
|
+
# (Key for the block array is qmgr:qid)
|
|
322
|
+
$lookup = "qmgr:".$qid;
|
|
323
|
+
if (is_blocked())
|
|
324
|
+
{
|
|
325
|
+
# If qmgr 'removed' line, free up space in the block array
|
|
326
|
+
# since there are no more qmgr lines for this qid
|
|
327
|
+
if( $logRmdr =~ /: removed/o )
|
|
328
|
+
{
|
|
329
|
+
remove_block();
|
|
330
|
+
}
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
else
|
|
334
|
+
{
|
|
335
|
+
# qmgr line was not blocked so add to output queue
|
|
336
|
+
push (@out_queue, $_);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if( $cmd eq "smtpd" )
|
|
341
|
+
{
|
|
342
|
+
if( $logRmdr =~ /\/smtpd\[(\d+)\]: disconnect from (.+)/o )
|
|
343
|
+
{
|
|
344
|
+
# If smtpd disconnect line has been blocked, disregard log line
|
|
345
|
+
# (Key in the block array is smtpd:pid:host)
|
|
346
|
+
# Free up space in the blocked array since we will not see any more
|
|
347
|
+
# smtpd lines for this message
|
|
348
|
+
$lookup = "smtpd:".$1 .":".$2;
|
|
349
|
+
if ( is_blocked())
|
|
350
|
+
{
|
|
351
|
+
remove_block();
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
}
|
|
356
|
+
# If this is an smtpd reject/warning/hold/discard for previously held rows,
|
|
357
|
+
# add the held rows to the output queue followed by the current line
|
|
358
|
+
# (Key for the held array is qid)
|
|
359
|
+
if ( $logRmdr =~ /\/smtpd\[\d+\]: (.*): (reject(?:_warning)?|hold|discard): /o)
|
|
360
|
+
{
|
|
361
|
+
$lookup=$1;
|
|
362
|
+
output_held();
|
|
363
|
+
push (@out_queue, $_);
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
# If this is an smtpd connect line then hold the line
|
|
367
|
+
# (Key for the held_connect array is pid:host)
|
|
368
|
+
if ($logRmdr =~ /\/smtpd\[(\d+)\]: connect from (.+)/o)
|
|
369
|
+
{
|
|
370
|
+
$lookup= $1.":".$2;
|
|
371
|
+
hold_connect();
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
# If this is an smtpd client line then hold the line
|
|
375
|
+
# (Key for the held_client array is $qid)
|
|
376
|
+
# The value of pid:host will be stored to cross reference
|
|
377
|
+
# later to the smtpd connect line which is stored by pid:host
|
|
378
|
+
|
|
379
|
+
if ($logRmdr =~ /\/smtpd\[(\d+)\]: (.*): client=(.+?)(?:,|$)/o)
|
|
380
|
+
{
|
|
381
|
+
$lookup= $1.":".$3;
|
|
382
|
+
$qid= $2;
|
|
383
|
+
hold_client();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
# If this is smtp line giving final disposal of message
|
|
388
|
+
# (such as smtp,local,lmtp,pipe) and if it is blocked
|
|
389
|
+
# disregard this log line.
|
|
390
|
+
# (Key for the block array is deliver:qid)
|
|
391
|
+
|
|
392
|
+
if ($logRmdr =~ /\[\d+\]: (.*): to=<[^>]*>, (?:orig_to=<[^>]*>, )?relay=[^,]+, delay=[^,]+, (?:delays=[^,]+, )?(?:dsn=\d+\.\d+\.\d+, )?status=\S+.*$/o )
|
|
393
|
+
{
|
|
394
|
+
if ($debug) { print "final disposal\n"; }
|
|
395
|
+
$lookup="deliver:".$1;
|
|
396
|
+
if( is_blocked() )
|
|
397
|
+
{
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
# Cleanup line links msg id to qid. If the msg id has already been seen
|
|
402
|
+
# held lines for this qid are disregarded. Otherwise they are added
|
|
403
|
+
# to output queue.
|
|
404
|
+
# (Key for the seen array is msg id)
|
|
405
|
+
if ( $cmd eq "cleanup" )
|
|
406
|
+
{
|
|
407
|
+
if ($logRmdr =~ /\/cleanup\[\d+\]: (.*): message-id=\s?<?(.*)>?/o )
|
|
408
|
+
{
|
|
409
|
+
$lookup = $2;
|
|
410
|
+
if ( is_seen())
|
|
411
|
+
{
|
|
412
|
+
# msg id has been seen already
|
|
413
|
+
# add a block on future qmgr lines for this message
|
|
414
|
+
# Key is qmgr:qid
|
|
415
|
+
$lookup = "qmgr:".$1;
|
|
416
|
+
add_block();
|
|
417
|
+
# add a block on future smtpd disconnect for this message
|
|
418
|
+
# Key is the same one used to hold smtpd connect line
|
|
419
|
+
$lookup= $1;
|
|
420
|
+
$lookup = "smtpd:".get_held_lookup();
|
|
421
|
+
add_block();
|
|
422
|
+
# add a block on future final disposal of message lines (such as
|
|
423
|
+
# smtp,local,lmtp,pipe etc).
|
|
424
|
+
# Key is deliver:qid
|
|
425
|
+
$lookup = "deliver:".$1;
|
|
426
|
+
add_block();
|
|
427
|
+
# The held lines can be deleted
|
|
428
|
+
# Key is qid
|
|
429
|
+
$lookup= $1;
|
|
430
|
+
remove_held();
|
|
431
|
+
# msg id must be removed from seen array to be able to
|
|
432
|
+
# handle multiple recipients or representation of rejected
|
|
433
|
+
# messages
|
|
434
|
+
# Key is msg id
|
|
435
|
+
$lookup = $2;
|
|
436
|
+
remove_seen();
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
else
|
|
440
|
+
{
|
|
441
|
+
# msg id has not been seen so add held lines to output queue.
|
|
442
|
+
# Key is qid
|
|
443
|
+
$lookup=$1;
|
|
444
|
+
output_held();
|
|
445
|
+
remove_held();
|
|
446
|
+
# add current line to output queue
|
|
447
|
+
push (@out_queue, $_);
|
|
448
|
+
# add msg id to seen array
|
|
449
|
+
$lookup = $2;
|
|
450
|
+
add_seen();
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
# default case, just add line to output queue
|
|
456
|
+
push (@out_queue, $_);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
########################################################
|
|
461
|
+
# auxiliary routines for prepflog
|
|
462
|
+
########################################################
|
|
463
|
+
|
|
464
|
+
# these were so simple, that they could have been left
|
|
465
|
+
# in the main body of the code, but I preferred
|
|
466
|
+
# extracting them to help readability in the main body
|
|
467
|
+
|
|
468
|
+
# add block
|
|
469
|
+
sub add_block
|
|
470
|
+
{
|
|
471
|
+
$block{$lookup}=1;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
# check if blocked
|
|
475
|
+
sub is_blocked
|
|
476
|
+
{
|
|
477
|
+
return $block{$lookup};
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
# remove block
|
|
481
|
+
sub remove_block
|
|
482
|
+
{
|
|
483
|
+
delete $block{$lookup};
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
# hold the smtpd connect line
|
|
487
|
+
# Key is pid:host
|
|
488
|
+
sub hold_connect
|
|
489
|
+
{
|
|
490
|
+
$held_connect{$lookup} = $_;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
# hold the smtpd client line
|
|
494
|
+
# Key is qid
|
|
495
|
+
# Cross reference stored to key of held
|
|
496
|
+
# smtpd connect line
|
|
497
|
+
sub hold_client
|
|
498
|
+
{
|
|
499
|
+
$held_lookup{$qid} = $lookup;
|
|
500
|
+
$held_client{$qid} = $_;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
# lookup key to held_connect line
|
|
504
|
+
# Key for the lookup is qid.
|
|
505
|
+
sub get_held_lookup
|
|
506
|
+
{
|
|
507
|
+
return $held_lookup{$lookup};
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
# output held lines.
|
|
511
|
+
# Key is qid
|
|
512
|
+
sub output_held
|
|
513
|
+
{
|
|
514
|
+
# output smtpd connect
|
|
515
|
+
if( $held_connect{$held_lookup{$lookup}} )
|
|
516
|
+
{
|
|
517
|
+
push (@out_queue, $held_connect{$held_lookup{$lookup}});
|
|
518
|
+
}
|
|
519
|
+
# ouput smtpd client
|
|
520
|
+
if( $held_client{$lookup} )
|
|
521
|
+
{
|
|
522
|
+
push (@out_queue, $held_client{$lookup});
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
# remove held lines
|
|
527
|
+
# Key is qid
|
|
528
|
+
sub remove_held
|
|
529
|
+
{
|
|
530
|
+
delete $held_connect{$held_lookup{$lookup}};
|
|
531
|
+
delete $held_lookup{$lookup};
|
|
532
|
+
delete $held_client{$lookup};
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
# add msg id to those seen
|
|
536
|
+
sub add_seen
|
|
537
|
+
{
|
|
538
|
+
$seen{$lookup}=1;;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
# check if msg id seen
|
|
542
|
+
sub is_seen
|
|
543
|
+
{
|
|
544
|
+
return $seen{$lookup};
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
# remove msg id from those seen
|
|
548
|
+
sub remove_seen
|
|
549
|
+
{
|
|
550
|
+
delete $seen{$lookup};
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
########################################################
|
|
555
|
+
# end of prepflog code section
|
|
556
|
+
########################################################
|
|
557
|
+
|
|
558
|
+
# Taken from pflogsumm
|
|
559
|
+
# return a date string to match in log
|
|
560
|
+
sub get_datestr {
|
|
561
|
+
my $dateOpt = $_[0];
|
|
562
|
+
|
|
563
|
+
my $time = time();
|
|
564
|
+
|
|
565
|
+
if($dateOpt eq "yesterday") {
|
|
566
|
+
# Back up to yesterday
|
|
567
|
+
$time -= ((localtime($time))[2] + 2) * 3600;
|
|
568
|
+
} elsif($dateOpt ne "today") {
|
|
569
|
+
die "$usageMsg\n";
|
|
570
|
+
}
|
|
571
|
+
my ($t_mday, $t_mon) = (localtime($time))[3,4];
|
|
572
|
+
|
|
573
|
+
return sprintf("%s %2d", $monthNames[$t_mon], $t_mday);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
|