Kouhei Sutou
null+****@clear*****
Tue Jan 31 15:25:47 JST 2017
Kouhei Sutou 2017-01-31 15:25:47 +0900 (Tue, 31 Jan 2017) New Revision: 3bb9329eef7484115f64ac20e40eaf5dc0382f67 https://github.com/milter-manager/milter-manager/commit/3bb9329eef7484115f64ac20e40eaf5dc0382f67 Message: Support Rmilter on FreeBSD Modified files: binding/ruby/lib/milter/manager/freebsd-rc-detector.rb binding/ruby/test/manager/test-freebsd-rc-detector.rb data/defaults/freebsd.conf Modified: binding/ruby/lib/milter/manager/freebsd-rc-detector.rb (+16 -1) =================================================================== --- binding/ruby/lib/milter/manager/freebsd-rc-detector.rb 2017-01-31 13:27:51 +0900 (3ef3438) +++ binding/ruby/lib/milter/manager/freebsd-rc-detector.rb 2017-01-31 15:25:47 +0900 (929a0ae) @@ -1,4 +1,4 @@ -# Copyright (C) 2009-2010 Kouhei Sutou <kou****@clear*****> +# Copyright (C) 2009-2017 Kouhei Sutou <kou****@clear*****> # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -15,6 +15,7 @@ require 'milter/manager/rcng-detector' require 'milter/manager/enma-socket-detector' +require 'milter/manager/rmilter-socket-detector' module Milter::Manager module FreeBSDRCBaseDetector @@ -54,6 +55,14 @@ module Milter::Manager @script_name == "milter-opendkim" or @name == "milteropendkim" end + def detect_rmilter_connection_spec + Milter::Manager::RmilterSocketDetector.new(rmilter_conf).detect + end + + def rmilter? + @script_name == "rmilter" or @name == "rmilter" + end + private def enma_conf @variables["cfgfile"] || @@ -79,6 +88,11 @@ module Milter::Manager "/usr/local/etc/opendkim.conf" end + def rmilter_conf + extract_parameter_from_flags(command_args, "-c") || + "/usr/local/etc/rmilter.conf" + end + def parse_rc_conf_unknown_line(line) case line when /\Arcvar=`set_rcvar`/ @@ -93,6 +107,7 @@ module Milter::Manager spec ||= detect_enma_connection_spec if enma? spec ||= detect_clamav_milter_connection_spec if clamav_milter? spec ||= detect_opendkim_connection_spec if opendkim? + spec ||= detect_rmilter_connection_spec if rmilter? spec end end Modified: binding/ruby/test/manager/test-freebsd-rc-detector.rb (+56 -1) =================================================================== --- binding/ruby/test/manager/test-freebsd-rc-detector.rb 2017-01-31 13:27:51 +0900 (0b292ae) +++ binding/ruby/test/manager/test-freebsd-rc-detector.rb 2017-01-31 15:25:47 +0900 (755b422) @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2010 Kouhei Sutou <kou****@clear*****> +# Copyright (C) 2008-2017 Kouhei Sutou <kou****@clear*****> # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -457,6 +457,61 @@ EOC "inet:10025****@127*****"]]) end + def test_apply_rmilter_style + rmilter_conf = @tmp_dir + "rmilter.conf" + (@rc_d + "rmilter").open("w") do |rc| + rc << <<-RC +name="rmilter" +rcvar=rmilter_enable +command="/usr/local/sbin/rmilter" + +load_rc_config $name + +: ${rmilter_enable="NO"} +: ${rmilter_pidfile="/var/run/rmilter/rmilter.pid"} +: ${rmilter_socket="/var/run/rmilter/rmilter.sock"} +: ${rmilter_user="_rmilter"} +: ${rmilter_group="mail"} + +command_args="$procname -c /usr/local/etc/rmilter.conf" + +run_rc_command "$1" + RC + end + + rmilter_conf.open("w") do |conf| + conf << <<-CONFIG +# Sample config file for rmilter +# $Id$ +# + +# .include - directive to include other config file +#.include ./rmilter-grey.conf + +# pidfile - path to pid file +# Default: pidfile = /var/run/rmilter.pid +pidfile = /var/run/rmilter/rmilter.pid; + +# bind_socket - socket credits for local bind: +# unix:/path/to/file - bind to local socket +# inet:port at host - bind to inet socket +# Default: bind_socket = unix:/var/tmp/rmilter.sock; +bind_socket = unix:/var/run/rmilter/rmilter.sock; + CONFIG + end + + detector = freebsd_rc_detector("rmilter") + detector.detect + detector.apply(@loader) + assert_equal("rmilter", detector.name) + assert_eggs([["rmilter", + nil, + false, + (@rc_d + "rmilter").to_s, + "start", + "unix:/var/run/rmilter/rmilter.sock"]]) + end + private def freebsd_rc_detector(name, options={}) detector = Milter::Manager::FreeBSDRCDetector.new(@configuration, name) Modified: data/defaults/freebsd.conf (+3 -0) =================================================================== --- data/defaults/freebsd.conf 2017-01-31 13:27:51 +0900 (f3b4a0c) +++ data/defaults/freebsd.conf 2017-01-31 15:25:47 +0900 (aa139b3) @@ -17,6 +17,9 @@ candidates = [ ["spamass-milter", ["Remote Network", "Unauthenticated", "No Stress"]], ["amavis-milter", []], + ["rmilter", + ["Remote Network", "S25R", "Unauthenticated", "No Stress"], + ], ] candidates.each do |candidate, conditions| detector = FreeBSDRCDetector.new(configuration, candidate) -------------- next part -------------- An HTML attachment was scrubbed... Télécharger