Projects
home:rottame:yggdra_agents
mail_agent
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 31
View file
rubygem-mail_agent.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Tue Aug 18 12:57:12 UTC 2026 - Angelo Grossini <rottame@intercom.it> + +- quota management + +------------------------------------------------------------------- Thu Aug 13 08:05:09 UTC 2026 - Angelo Grossini <rottame@intercom.it> - Update mail_agent service configuration, remove Cluebringer
View file
rubygem-mail_agent.spec
Changed
@@ -1,4 +1,4 @@ -%define package_version 1.2.4 +%define package_version 1.2.5 %define mod_name mail_agent %define mod_full_name %{mod_name}-%{version}
View file
mail_agent-1.2.4.gem/checksums.yaml.gz -> mail_agent-1.2.5.gem/checksums.yaml.gz
Changed
@@ -1,7 +1,7 @@ --- SHA256: - metadata.gz: 17edc82589535cdc6f2e6a61e659d4f31f1c697527969e82dd549f156e9716f4 - data.tar.gz: 98915bac8736e9646e941065e67bdc0b94192332f3b7f0650f44622a4f4ec432 + metadata.gz: ea00cba0461caa983d2895093017e5474d195290e8dee5b2e404b099faa6e985 + data.tar.gz: a9e1d59887c93bd11f3583cf2851a49395b87f6af157f7d017ba95817fed7261 SHA512: - metadata.gz: c801b69fb2de61b99146e71fa35f76a7cc7b6eb6f55f95abe1d7ba678e93b241fae5add31b8e7980fcc0b214bbc3c22864a250c55c16d76b8fc19447396a50f8 - data.tar.gz: 0dfc566433869c798f852950467cf902ca45630998604f168ee7a43a3af359c5965552ecde9900d0b368b2d15964763f747dd55428a2cd72360610ae9ba6f33c + metadata.gz: da2ed945054cc93ab679a20adce196bc59b727df20023c959fe6350ae0803eacad97637cbd2a53ca837f5cf8734a4f23f60944e4608bc0456b2f472928429b75 + data.tar.gz: 8ab669a5d3eb62ca857ae9c01693052201afff74c6dc67dfdafaf9b16a3057a82c9ef1b4f2bcdedf65951916cd11b5c6e41ae292e79c9aeadc4e812076cc9930
View file
mail_agent-1.2.4.gem/data/Gemfile.lock -> mail_agent-1.2.5.gem/data/Gemfile.lock
Changed
@@ -1,15 +1,17 @@ PATH remote: ../ygg_provisioner specs: - ygg_provisioner (1.5.0) + ygg_provisioner (1.5.2) eventmachine (~> 1.2.3) + ostruct publisher - tomte-agents + tomte-agents (~> 1.1, >= 1.1.1) + tomte-core (~> 1.3, < 1.4.0) PATH remote: . specs: - mail_agent (1.2.2) + mail_agent (1.2.4) activeresource-hel (~> 0.7.0) mysql2 (~> 0.5, >= 0.5.6) sentry-raven (~> 3, >= 3.0.0) @@ -22,21 +24,21 @@ remote: http://rubygems.org/ remote: http://gems.intercom.it/ specs: - actionview (8.0.3) - activesupport (= 8.0.3) + actionview (8.0.5) + activesupport (= 8.0.5) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activemodel (8.0.3) - activesupport (= 8.0.3) + activemodel (8.0.5) + activesupport (= 8.0.5) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (8.0.3) - activemodel (= 8.0.3) - activesupport (= 8.0.3) + activerecord (8.0.5) + activemodel (= 8.0.5) + activesupport (= 8.0.5) timeout (>= 0.4.0) activeresource (6.1.4) activemodel (>= 6.0) @@ -47,7 +49,7 @@ activeresource (>= 5.1.0, < 7.0.0) awesome_print (~> 1.8, >= 1.8.0) kaminari (~> 1.1, >= 1.1.1) - activesupport (8.0.3) + activesupport (8.0.5) base64 benchmark (>= 0.3) bigdecimal @@ -78,7 +80,7 @@ case (0.5.2.1) coderay (1.1.3) concurrent-ruby (1.3.5) - connection_pool (2.5.0) + connection_pool (3.0.2) crack (1.0.0) bigdecimal rexml @@ -87,8 +89,11 @@ drb (2.2.1) erubi (1.13.1) eventmachine (1.2.7) - faraday (1.0.0) - multipart-post (>= 1.2, < 3) + faraday (2.7.11) + base64 + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) + faraday-net_http (3.0.2) hashdiff (1.1.2) i18n (1.14.7) concurrent-ruby (~> 1.0) @@ -106,7 +111,7 @@ kaminari-core (= 1.2.0) kaminari-core (1.2.0) logger (1.6.4) - loofah (2.23.1) + loofah (2.25.2) crass (~> 1.0.2) nokogiri (>= 1.12.0) method_source (1.1.0) @@ -115,10 +120,10 @@ mime-types-data (~> 3.2015) mime-types-data (3.2024.1001) minitest (5.25.4) - multipart-post (2.4.1) mysql2 (0.5.6) - nokogiri (1.18.9) + nokogiri (1.19.4) racc (~> 1.4) + ostruct (0.6.1) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) @@ -129,8 +134,8 @@ activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.2) - loofah (~> 2.21) + rails-html-sanitizer (1.7.1) + loofah (~> 2.25, >= 2.25.2) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rake (13.2.1) rexml (3.4.0) @@ -147,6 +152,7 @@ diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.6) + ruby2_keywords (0.0.5) securerandom (0.4.1) sentry-raven (3.0.0) faraday (>= 1.0)
View file
mail_agent-1.2.4.gem/data/bin/mail_agent_shell -> mail_agent-1.2.5.gem/data/bin/mail_agent_shell
Changed
@@ -1,13 +1,11 @@ #!/usr/bin/env ruby require 'rubygems' -#require 'bundler/setup' require 'pry' +require 'tomte/agents' -require "tomte/agents" - -# -# just starts the agent now -# Tomte::Agents::Framework.setup(:async => true, :application => 'mail_agent') -binding.pry \ No newline at end of file +$agent = Tomte::Agent::MailAgent.new(:argv => ARGV) +$agent.send(:init) + +binding.pry
View file
mail_agent-1.2.4.gem/data/lib/mail_agent.rb -> mail_agent-1.2.5.gem/data/lib/mail_agent.rb
Changed
@@ -7,7 +7,6 @@ class BulkSync attr_accessor :domains, :boxes, :relext def initialize - load_data end def load_data @@ -21,62 +20,70 @@ sync_domains sync_boxes sync_policyd - rescue + rescue ex = $! if defined?(Raven) Raven.capture_exception(ex) end raise ex end - + protected def sync_domains Models::Email::Domain.transaction do - ygg_pks = - domains.each do | domain | - ygg_pks << domain.uuid if domain.create_or_update_db_domain! + new_uuids = + domains.each do | domain | + new_uuids << domain.uuid end - db_pks = Models::Email::Domain.all.map(&:uuid) - old = db_pks - ygg_pks + cur_uuids = Models::Email::Domain.all.map(&:uuid) + old_uuids = cur_uuids - new_uuids - if old.any? - old = Models::Email::Domain.where(uuid: old) - doms = old.map(&:domain).map{|d| "@#{d}"} + if old_uuids.any? + old_domains = Models::Email::Domain.where(uuid: old_uuids) + doms = old_domains.map(&:domain).map{|d| "@#{d}"} Models::Amavis::User.where(email: doms).map(&:destroy) - old.map(&:destroy!) - end + old_domains.map(&:destroy!) + end + + domains.each do | domain | + domain.create_or_update_db_domain! + end end end def sync_boxes Models::Email::Box.transaction do - ygg_pks = + new_uuids = boxes.each do | box | - ygg_pks << box.uuid if box.create_or_update_db_box! + new_uuids << box.uuid end relext.each do | ext | - ygg_pks << ext.uuid if ext.create_or_update_db_box! + new_uuids << ext.uuid end - db_pks = Models::Email::Box.all.map(&:uuid) - old = db_pks - ygg_pks + cur_uuids = Models::Email::Box.all.map(&:uuid) + old_uuids = cur_uuids - new_uuids - if old.any? - old = Models::Email::Box.where(uuid: old) - fqdas = old.map(&:fqda) + if old_uuids.any? + old_boxes = Models::Email::Box.where(uuid: old_uuids) + fqdas = old_boxes.map(&:fqda) Models::Amavis::User.where(email: fqdas).map(&:destroy) - old.map(&:destroy!) - end + old_boxes.map(&:destroy!) + end + + boxes.each do | box | + box.create_or_update_db_box! + end end end def sync_policyd Models::Policyd::Policy.transaction do - + uuids = relext.inject({identities: , addresses: }) do | m, ext | if ext.create_or_update_db_extension! m:identities << "hel:#{ext.uuid}" if ext.is_identity? @@ -84,7 +91,7 @@ end m end - + uuids.each do | k, list | if list.any? case(k) @@ -93,7 +100,7 @@ end end end - end + end end end -end \ No newline at end of file +end
View file
mail_agent-1.2.4.gem/data/lib/mail_agent/models/email.rb -> mail_agent-1.2.5.gem/data/lib/mail_agent/models/email.rb
Changed
@@ -1,7 +1,7 @@ module MailAgent module Models - module Email + module Email class Base < ActiveRecord::Base self.abstract_class = true end @@ -9,6 +9,7 @@ autoload :Forward, 'mail_agent/models/email/forward' autoload :Box, 'mail_agent/models/email/box' autoload :Domain, 'mail_agent/models/email/domain' + autoload :Quota, 'mail_agent/models/email/quota' end end -end \ No newline at end of file +end
View file
mail_agent-1.2.4.gem/data/lib/mail_agent/models/email/box.rb -> mail_agent-1.2.5.gem/data/lib/mail_agent/models/email/box.rb
Changed
@@ -5,6 +5,7 @@ module Email class Box < Email::Base has_one :forward, primary_key: :uuid, foreign_key: :uuid, dependent: :destroy + has_one :mailbox_quota, foreign_key: :domain, :user, primary_key: :domain, :user, class_name: 'MailAgent::Models::Email::Quota' def self.find_by_hel(object) self.where(uuid: object.uuid).first @@ -29,6 +30,7 @@ names -= :id, :domain_on_hold, :password, :encrypted_password, :on_hold, :active record.attributes = object.as_json(only: names).symbolize_keys record.on_hold = !object.active + record.quota = object.quota.presence || '2G' if object.encrypted_password.present? record.password = password_with_scheme(object.encrypted_password)
View file
mail_agent-1.2.5.gem/data/lib/mail_agent/models/email/quota.rb
Added
@@ -0,0 +1,11 @@ + +module MailAgent + module Models + module Email + class Quota < Email::Base + self.table_name = 'quotas' + belongs_to :box, foreign_key: :domain, :user, primary_key: :domain, :user + end + end + end +end
View file
mail_agent-1.2.4.gem/data/lib/mail_agent/models/policyd/tracker.rb -> mail_agent-1.2.5.gem/data/lib/mail_agent/models/policyd/tracker.rb
Changed
@@ -6,7 +6,7 @@ has_one :client_address has_one :authenticated_identity - serialize :heuristics + serialize :heuristics, yaml: { unsafe_load: true } before_create do self.first_seen = Time.now @@ -23,4 +23,4 @@ end end end -end \ No newline at end of file +end
View file
mail_agent-1.2.4.gem/data/lib/mail_agent/version.rb -> mail_agent-1.2.5.gem/data/lib/mail_agent/version.rb
Changed
@@ -1,3 +1,3 @@ module MailAgent - VERSION = "1.2.4" + VERSION = "1.2.5" end
View file
mail_agent-1.2.4.gem/data/lib/tomte/workers/mail_worker_pubsub.rb -> mail_agent-1.2.5.gem/data/lib/tomte/workers/mail_worker_pubsub.rb
Changed
@@ -1,11 +1,17 @@ module Tomte::Workers class MailWorkerPubsub < Tomte::Worker bus :service, :enveloper => Tomte::Protocol::Enveloper::Generic do |ep| - consumer = ep.consumer :queue => "ygg.email.events.#{Tomte.config:local:host}", :ack => false + cfg = config:email || {} + cfg = cfg.reverse_merge({ + rpc_exchange: 'ygg.svcs.email.rpc.db.api', + lifecycle_exchange: 'ygg.svcs.email.lifecycle', + tomte_exchange: 'ygg.svcs.email.events', + }) + consumer = ep.consumer :queue => "#{cfg:lifecycle_exchange}.#{Tomte.config:local:host}", :ack => false consumer.connect! do |c| - c.declare_exchange('ygg.email.events', :topic, :auto_delete => true) do - c.bind('ygg.email.events') - c.consume { log.info "ready to receive messages on ygg.email.events" } + c.declare_exchange(cfg:lifecycle_exchange, :topic, :auto_delete => true) do + c.bind(cfg:lifecycle_exchange) + c.consume { log.info "ready to receive messages on #{cfg:lifecycle_exchange}" } end consumer.prefetch 1 @@ -16,7 +22,34 @@ end consumer.on_delivery do |metadata, message| - self.class.execute_on_delivery(metadata, message) + self.execute_on_delivery(metadata, message) + end + + if cfg:tomte_exchange.present? + @ep = endpoint(:service) + @producer = @ep.producer( + exchange: cfg:tomte_exchange, + exchange_type: :direct, + exchange_options: { :passive => false, :durable => true }, + reliable: true + ) + + errback = ->(ch, ev) { + raise "Error binding exchange: #{ev.reply_text}" + } + @producer.connect!(errback: errback) do |p| + now = Time.now + nxt = Time.now.beginning_of_hour + 1.hour + delay = (nxt-now).round + + update_quotas(init: true) + + Tomte::Timer.after(delay) do + Tomte::Timer.every(config:poll_timer || 3600) do + update_quotas + end + end + end end end @@ -81,5 +114,31 @@ log&.error '* ' + $!.backtrace.join("\n* ") nil end + + def update_quotas(init: false) + chain = MailAgent::Models::Email::Quota.includes(:box) + chain = if init + chain.where(updated_at: 1.week.ago..) + else + chain.where(updated_at: 1.hour.ago..) + end + if chain.any? + quotas = chain.all.inject() do |m, quota| + q = quota.as_json(except: :username, :user, :domain) + q:uuid = quota.box.uuid + m << q + end + @producer.publish({quotas: quotas, event: 'update_quotas'}, :persistant => true) + end + rescue + ex = $! + if defined?(Raven) + Raven.extra_context(message: message, metadata: metadata.attributes) do + Raven.capture_exception(ex) + end + else + raise ex + end + end end end
View file
mail_agent-1.2.4.gem/data/lib/tomte/workers/mail_worker_rpc.rb -> mail_agent-1.2.5.gem/data/lib/tomte/workers/mail_worker_rpc.rb
Changed
@@ -1,6 +1,6 @@ module Tomte::Workers class MailWorkerRPC < Tomte::Worker - + class RPC < Tomte::Network::API::BasicServer def quotas(options = {}) identity = options.delete('identity') @@ -25,17 +25,28 @@ disable_date: object&.disable_date, count: { quota: policy&.count || 0, count: tracker&.count || 0 }, recipients: { quota: policy&.recipients || 0, count: tracker&.recipients || 0 }, - volume: { quota: policy&.volume || 0, count: tracker&.volume || 0 }, + volume: { quota: policy&.volume || 0, count: tracker&.volume || 0 }, addresses: heuristics || , last_update: tracker&.last_update } end + def mailbox_quotas(options = {}) + uuid = options.delete('uuid') + object = if uuid.present? + MailAgent::Models::Email::Box.find_by(uuid: uuid) + end + raise ArgumentError, "Must specify a valid mailbox uuid" unless object.present? + quota = object&.mailbox_quota&.as_json(except: :username, :user, :domain) + quota ||= { 'bytes' => 0, 'messages' => 0, 'updated_at' => nil } + quota + end + def reset_quotas!(options = {}) identity = options.delete('identity') address = options.delete('address') raise ArgumentError, "Must specify an identity or an address" unless address.present? || identity.present? - + object = if identity.present? MailAgent::Models::Policyd::AuthenticatedIdentity.find_by(identity: identity) elsif address.present? @@ -52,7 +63,7 @@ .reorder(id: :asc) .limit(limit) .offset(start) - + records.as_json end @@ -63,10 +74,10 @@ .reorder(id: :asc) .limit(limit) .offset(start) - + records.as_json end - + def add_whitelist(address) addr = MailAgent::Models::Policyd::NetworkAddress.find_or_initialize_by(address: address) addr.flags = 'w' @@ -74,7 +85,7 @@ addr.inserted = Time.new addr.save! end - + def remove_network_address(address) addr = MailAgent::Models::Policyd::NetworkAddress.find_by(address: address) addr&.destroy! @@ -85,9 +96,9 @@ bus :service api :api, :bus => :service, - :api => config.mail:rpc_exchange, + :api => config.mail:rpc_exchange || 'ygg.svcs.email.rpc.db.api', :class => RPC, :queue_options => { :auto_delete => true } - + end end
View file
mail_agent-1.2.4.gem/data/schema.sql -> mail_agent-1.2.5.gem/data/schema.sql
Changed
@@ -1,37 +1,16 @@ --- MySQL dump 10.13 Distrib 5.5.41, for debian-linux-gnu (x86_64) --- --- Host: 192.168.193.250 Database: mail --- ------------------------------------------------------ --- Server version 5.6.17 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `boxes` --- - DROP TABLE IF EXISTS `boxes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; CREATE TABLE `boxes` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user` varchar(255) NOT NULL, `domain` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, - `on_hold` tinyint(1) NOT NULL DEFAULT '0', - `send_only` tinyint(1) NOT NULL DEFAULT '0', - `pop3_merge_junk` tinyint(1) NOT NULL DEFAULT '0', + `on_hold` tinyint(1) NOT NULL DEFAULT 0, + `send_only` tinyint(1) NOT NULL DEFAULT 0, + `pop3_merge_junk` tinyint(1) NOT NULL DEFAULT 0, `fqda` varchar(255) NOT NULL, `uuid` varchar(255) NOT NULL, + `mx` varchar(255) DEFAULT NULL, + `quota` varchar(100) NOT NULL DEFAULT '2G', PRIMARY KEY (`id`), UNIQUE KEY `user` (`user`,`domain`), UNIQUE KEY `fqda` (`fqda`), @@ -39,288 +18,100 @@ KEY `send_only_on_hold` (`send_only`,`on_hold`), KEY `send_only` (`send_only`), KEY `on_hold` (`on_hold`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `boxes` --- - -LOCK TABLES `boxes` WRITE; -/*!40000 ALTER TABLE `boxes` DISABLE KEYS */; -/*!40000 ALTER TABLE `boxes` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `domains` --- +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; DROP TABLE IF EXISTS `domains`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; CREATE TABLE `domains` ( `id` int(11) NOT NULL AUTO_INCREMENT, `domain` varchar(255) NOT NULL, `virtual` varchar(255) DEFAULT NULL, - `relay_only` tinyint(1) NOT NULL DEFAULT '0', + `relay_only` tinyint(1) NOT NULL DEFAULT 0, `mx` varchar(255) DEFAULT NULL, `uuid` varchar(255) NOT NULL, + `mx2` varchar(255) DEFAULT NULL, + `mx3` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `domain` (`domain`), UNIQUE KEY `uuid` (`uuid`), KEY `virtual` (`virtual`), KEY `relay_only` (`relay_only`), KEY `mx` (`mx`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `domains` --- - -LOCK TABLES `domains` WRITE; -/*!40000 ALTER TABLE `domains` DISABLE KEYS */; -/*!40000 ALTER TABLE `domains` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `forwards` --- +) ENGINE=InnoDB AUTO_INCREMENT=422 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; DROP TABLE IF EXISTS `forwards`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; CREATE TABLE `forwards` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user` varchar(255) NOT NULL, `domain` varchar(255) NOT NULL, `policy_id` int(11) DEFAULT NULL, - `fwd_addresses` LONGTEXT NOT NULL, + `fwd_addresses` longtext NOT NULL, `fqda` varchar(255) NOT NULL, `uuid` varchar(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `fqda` (`fqda`), KEY `uuid` (`uuid`), KEY `user` (`user`,`domain`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; +) ENGINE=InnoDB AUTO_INCREMENT=2578 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; --- --- Dumping data for table `forwards` --- +CREATE OR REPLACE VIEW `mailbox_boxes` AS SELECT + NULL AS `user`, + NULL AS `domain`, + NULL AS `pop3_merge_junk`, + NULL AS `mailbox_host`, + NULL AS `quota`; -LOCK TABLES `forwards` WRITE; -/*!40000 ALTER TABLE `forwards` DISABLE KEYS */; -/*!40000 ALTER TABLE `forwards` ENABLE KEYS */; -UNLOCK TABLES; +CREATE OR REPLACE VIEW `mailbox_domains` AS SELECT + NULL AS `domain`, + NULL AS `mailbox_host`; --- --- Temporary table structure for view `mailbox_boxes` --- -DROP TABLE IF EXISTS `mailbox_boxes`; -/*!50001 DROP VIEW IF EXISTS `mailbox_boxes`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `mailbox_boxes` ( - `user` tinyint NOT NULL, - `domain` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; +CREATE OR REPLACE VIEW `mailbox_logins` AS SELECT + NULL AS `user`, + NULL AS `domain`, + NULL AS `password`, + NULL AS `mailbox_host`; --- --- Temporary table structure for view `mailbox_domains` --- +DROP TABLE IF EXISTS `quotas`; +CREATE TABLE `quotas` ( + `username` varchar(255) NOT NULL, + `user` varchar(128) GENERATED ALWAYS AS (substring_index(`username`,'@',1)) STORED, + `domain` varchar(128) GENERATED ALWAYS AS (substring_index(`username`,'@',-1)) STORED, + `bytes` bigint(20) unsigned NOT NULL DEFAULT 0, + `messages` bigint(20) unsigned NOT NULL DEFAULT 0, + `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`username`), + KEY `quota_user_domain` (`user`,`domain`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -DROP TABLE IF EXISTS `mailbox_domains`; -/*!50001 DROP VIEW IF EXISTS `mailbox_domains`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `mailbox_domains` ( - `domain` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `mailbox_logins` --- +INSERT INTO `quotas` +(username, bytes, messages, updated_at) +VALUES +('rottame@rottame-hq.net', 75225,12,'2026-08-13 14:20:20'); -DROP TABLE IF EXISTS `mailbox_logins`; -/*!50001 DROP VIEW IF EXISTS `mailbox_logins`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `mailbox_logins` ( - `user` tinyint NOT NULL, - `domain` tinyint NOT NULL, - `password` tinyint NOT NULL, - `pop3_merge_junk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `smtp_in_relay` --- DROP TABLE IF EXISTS `smtp_in_relay`; -/*!50001 DROP VIEW IF EXISTS `smtp_in_relay`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `smtp_in_relay` ( - `domain` tinyint NOT NULL, - `mx` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `smtp_in_virtual_domains` --- - -DROP TABLE IF EXISTS `smtp_in_virtual_domains`; -/*!50001 DROP VIEW IF EXISTS `smtp_in_virtual_domains`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `smtp_in_virtual_domains` ( - `domain` tinyint NOT NULL, - `destination_domain` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `smtp_out_logins` --- - -DROP TABLE IF EXISTS `smtp_out_logins`; -/*!50001 DROP VIEW IF EXISTS `smtp_out_logins`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `smtp_out_logins` ( - `user` tinyint NOT NULL, - `domain` tinyint NOT NULL, - `password` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Final view structure for view `mailbox_boxes` --- - -/*!50001 DROP TABLE IF EXISTS `mailbox_boxes`*/; -/*!50001 DROP VIEW IF EXISTS `mailbox_boxes`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`rottame`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `mailbox_boxes` AS select `boxes`.`user` AS `user`,`boxes`.`domain` AS `domain`,`boxes`.`pop3_merge_junk` AS `pop3_merge_junk` from `boxes` where (`boxes`.`send_only` = 0) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `mailbox_domains` --- - -/*!50001 DROP TABLE IF EXISTS `mailbox_domains`*/; -/*!50001 DROP VIEW IF EXISTS `mailbox_domains`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`rottame`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `mailbox_domains` AS select `domains`.`domain` AS `domain` from `domains` where (((`domains`.`virtual` = '') or isnull(`domains`.`virtual`)) and (`domains`.`relay_only` = 0)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; +CREATE OR REPLACE VIEW `smtp_in_relay` AS SELECT + NULL AS `domain`, + NULL AS `mx`; --- --- Final view structure for view `mailbox_logins` --- +DROP TABLE IF EXISTS `smtp_in_transport`; +CREATE OR REPLACE VIEW `smtp_in_transport` AS SELECT + NULL AS `domain`, + NULL AS `transport`; -/*!50001 DROP TABLE IF EXISTS `mailbox_logins`*/; -/*!50001 DROP VIEW IF EXISTS `mailbox_logins`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`rottame`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `mailbox_logins` AS select `boxes`.`user` AS `user`,`boxes`.`domain` AS `domain`,`boxes`.`password` AS `password` from `boxes` where ((`boxes`.`send_only` = 0) and (`boxes`.`on_hold` = 0)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; +DROP TABLE IF EXISTS `smtp_in_transport_new`; +CREATE OR REPLACE VIEW `smtp_in_transport_new` AS SELECT + NULL AS `value`, + NULL AS `transport`; --- --- Final view structure for view `smtp_in_relay` --- - -/*!50001 DROP TABLE IF EXISTS `smtp_in_relay`*/; -/*!50001 DROP VIEW IF EXISTS `smtp_in_relay`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`rottame`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `smtp_in_relay` AS select `domains`.`domain` AS `domain`,`domains`.`mx` AS `mx` from `domains` where (isnull(`domains`.`virtual`) or (`domains`.`virtual` = '')) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `smtp_in_virtual_domains` --- - -/*!50001 DROP TABLE IF EXISTS `smtp_in_virtual_domains`*/; -/*!50001 DROP VIEW IF EXISTS `smtp_in_virtual_domains`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`rottame`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `smtp_in_virtual_domains` AS select `domains`.`domain` AS `domain`,`domains`.`virtual` AS `destination_domain` from `domains` where ((`domains`.`virtual` is not null) and (`domains`.`virtual` <> '')) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `smtp_out_logins` --- - -/*!50001 DROP TABLE IF EXISTS `smtp_out_logins`*/; -/*!50001 DROP VIEW IF EXISTS `smtp_out_logins`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`rottame`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `smtp_out_logins` AS select `boxes`.`user` AS `user`,`boxes`.`domain` AS `domain`,`boxes`.`password` AS `password` from `boxes` where (`boxes`.`on_hold` = 0) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; +DROP TABLE IF EXISTS `smtp_in_virtual_domains`; +CREATE OR REPLACE VIEW `smtp_in_virtual_domains` AS SELECT + NULL AS `domain`, + NULL AS `destination_domain`; -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +CREATE OR REPLACE VIEW `smtp_out_logins` AS SELECT + NULL AS `user`, + NULL AS `domain`, + NULL AS `password`; --- Dump completed on 2015-03-13 0:13:54
View file
mail_agent-1.2.4.gem/metadata.gz -> mail_agent-1.2.5.gem/metadata.gz
Changed
@@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: mail_agent version: !ruby/object:Gem::Version - version: 1.2.4 + version: 1.2.5 platform: ruby authors: - Angelo Grossini @@ -285,6 +285,7 @@ - lib/mail_agent/models/email/box.rb - lib/mail_agent/models/email/domain.rb - lib/mail_agent/models/email/forward.rb +- lib/mail_agent/models/email/quota.rb - lib/mail_agent/models/policyd.rb - lib/mail_agent/models/policyd/authenticated_identity.rb - lib/mail_agent/models/policyd/client_address.rb
View file
mail_agent.yml
Changed
@@ -1,61 +1,11 @@ _common: mail: - rpc_exchange: 'ygg.email.rpc.db.api' -development: - core: - log_level: debug - debug: false - hel: - host: HEL_ADDRESS - username: HEL_USERNAME - password: HEL_PASSWORD - raven: - dsn: - database: - email: - adapter: mysql2 - encoding: utf8 - database: DATABASE - pool: 5 - host: DATABASE_ADDRESS - username: DATABASE_USERNAME - password: DATABASE_PASSWORD - #reconnect: false - #socket: /tmp/mysql.sock - policyd: - adapter: mysql2 - encoding: utf8 - database: DATABASE - pool: 5 - host: DATABASE_ADDRESS - username: DATABASE_USERNAME - password: DATABASE_PASSWORD - #reconnect: false - #socket: /tmp/mysql.sock - cluebringer: - adapter: mysql2 - encoding: utf8 - database: DATABASE - pool: 5 - host: DATABASE_ADDRESS - username: DATABASE_USERNAME - password: DATABASE_PASSWORD - #reconnect: false - #socket: /tmp/mysql.sock - amavis: - adapter: mysql2 - encoding: utf8 - database: DATABASE - pool: 5 - host: DATABASE_ADDRESS - username: DATABASE_USERNAME - password: DATABASE_PASSWORD - #reconnect: false - #socket: /tmp/mysql.sock + lifecycle_exchange: 'ygg.svcs.email.lifecycle' + rpc_exchange: 'ygg.svcs.email.rpc.db.api' + tomte_exchange: 'ygg.svcs.email.events' production: core: - core: log_path: /var/log/tomte/mail_agent log_level: info debug: false @@ -105,36 +55,4 @@ username: DATABASE_USERNAME password: DATABASE_PASSWORD #reconnect: false - #socket: /tmp/mysql.sock - -test: - core: - log_level: debug - debug: false - hel: - host: HEL_ADDRESS - username: HEL_USERNAME - password: HEL_PASSWORD - raven: - dsn: - database: - email: - adapter: mysql2 - encoding: utf8 - database: mail - pool: 5 - host: DATABASE_ADDRESS - username: DATABASE_USERNAME - password: DATABASE_PASSWORD - #reconnect: false - #socket: /tmp/mysql.sock - policyd: - adapter: mysql2 - encoding: utf8 - database: smtp_out_ng - pool: 5 - host: DATABASE_ADDRESS - username: DATABASE_USERNAME - password: DATABASE_PASSWORD - #reconnect: false - #socket: /tmp/mysql.sock + #socket: /tmp/mysql.sock \ No newline at end of file
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.