Class: IPAccess::Net::SMTP
- Inherits:
-
Net::SMTP
- Object
- Net::SMTP
- IPAccess::Net::SMTP
- Includes:
- Patches::Net::SMTP
- Defined in:
- lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb,
lib/ipaccess/net/smtp.rb
Overview
Net::SMTP class with IP access control. It uses output
access lists. It and acts the same way as Net::SMTP class but provides special member called acl
and a few new instance methods for controlling IP access.
This documentation doesn’t cover description of all class and instance methods of the original Net::SMTP class, just the patched variants that make use of IP access control.
Examples
Using IPAccess::Net::SMTP variant instead of Net::SMTP, global access set
require 'ipaccess/net/smtp'
IPAccess::Set::Global.output.blacklist 'randomseed.pl'
IPAccess::Net::SMTP.start('randomseed.pl', 25) do |smtp|
;
end
Patching single object, global access set, direct blacklisting
require 'ipaccess/net/smtp'
p = Net::SMTP.new 'randomseed.pl'
IPAccess.arm p
p.blacklist! 'randomseed.pl'
p.start
Instance Attribute Summary collapse
-
#acl ⇒ Object
=== Example.
Attributes included from Patches::ACL
Class Method Summary collapse
-
.start ⇒ Object
:call-seq: start(address)
{|smtp| …}
<br /> start(address, acl){|smtp| …}
<br /> start(address, port, acl){|smtp| …}
<br /> start(address, port, helo, acl){|smtp| …}
<br /> start(address, port, helo, user, secret, acl){|smtp| …}
<br /> start(address, port, helo, user, secret, authtype, acl){|smtp| …}
.
Instance Method Summary collapse
-
#acl_recheck ⇒ Object
This method allows you to re-check access on demad.
-
#blacklist(*addresses) ⇒ Object
(also: #add_black, #deny, #block)
-
#blacklist!(*addresses) ⇒ Object
(also: #add_black!, #deny!, #block!)
-
#blacklist_reasonable(reason, *addresses) ⇒ Object
This method works like blacklist but allows to set reason.
-
#blacklist_reasonable!(reason, *addresses) ⇒ Object
This method works like blacklist! but allows to set reason.
-
#initialize ⇒ SMTP
constructor
:call-seq: new(address)<br /> new(address, acl)<br /> new(address, port, acl).
-
#unblacklist(*addresses) ⇒ Object
(also: #unblock, #del_black)
-
#unblacklist!(*addresses) ⇒ Object
(also: #unblock!, #del_black!)
-
#unwhitelist(*addresses) ⇒ Object
(also: #del_white)
-
#unwhitelist!(*addresses) ⇒ Object
(also: #del_white!)
-
#whitelist(*addresses) ⇒ Object
-
#whitelist!(*addresses) ⇒ Object
-
#whitelist_reasonable(reason, *addresses) ⇒ Object
This method works like whitelist but allows to set reason.
-
#whitelist_reasonable!(reason, *addresses) ⇒ Object
This method works like whitelist! but allows to set reason.
Methods included from Patches::ACL
#__ipa_wrap_socket_call, #close_on_deny, #close_on_deny=, #default_list, #terminate, #valid_acl?
Constructor Details
#initialize ⇒ SMTP
:call-seq:
new(address)<br />
new(address, acl)<br />
new(address, port, acl)
Creates a new object. Argument address
is the hostname or IP address of your SMTP server. Argument port
is the port to connect to; it defaults to port 25.
This method does not open the TCP connection. You can use SMTP.start instead of SMTP.new if you want to do everything at once. Otherwise, follow SMTP.new with SMTP#start.
This method optionally sets an access set given as the last parameter. If acl
parameter is not given it defaults to IPAccess::Set.Global
.
162 163 164 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 162 def initialize # Real code hidden. end |
Instance Attribute Details
#acl ⇒ Object
142 143 144 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 142 def acl @acl end |
Class Method Details
.start ⇒ Object
:call-seq:
start(address) <tt>{|smtp| …}</tt><br />
start(address, acl) <tt>{|smtp| …}</tt><br />
start(address, port, acl) <tt>{|smtp| …}</tt><br />
start(address, port, helo, acl) <tt>{|smtp| …}</tt><br />
start(address, port, helo, user, secret, acl) <tt>{|smtp| …}</tt><br />
start(address, port, helo, user, secret, authtype, acl) <tt>{|smtp| …}</tt>
Creates a new object and connects to the server. If helo
is missing or nil
the localhost.localdomain
string will be used. This method is equivalent to:
smtp = IPAccess::Net::SMTP.new(address, port)
smtp.start(helo_domain, account, password, authtype)
This method optionally sets an access set given as the last parameter. If acl
parameter is not given it defaults to IPAccess::Set.Global
.
185 186 187 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 185 def self.start # Real code hidden. end |
Instance Method Details
#acl_recheck ⇒ Object
This method allows you to re-check access on demad. It uses internal socket’s address and access set assigned to an object. It will close your communication session before throwing an exception in case of denied access – you can prevent it by setting the flag opened_on_deny
to true
. The flag can be set while initializing object (through argument :opened_on_deny
) or by setting the attribute.
198 199 200 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 198 def acl_recheck # Real code hidden. end |
#blacklist(*addresses) ⇒ Object #blacklist(list, *addresses) ⇒ Object Also known as: add_black, deny, block
79 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 79 def blacklist(*addresses); end |
#blacklist!(*addresses) ⇒ Object #blacklist!(list, *addresses) ⇒ Object Also known as: add_black!, deny!, block!
74 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 74 def blacklist!(*addresses); end |
#blacklist_reasonable(reason, *addresses) ⇒ Object
This method works like blacklist but allows to set reason.
128 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 128 def blacklist_reasonable(reason, *addresses); end |
#blacklist_reasonable!(reason, *addresses) ⇒ Object
This method works like blacklist! but allows to set reason.
124 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 124 def blacklist_reasonable!(reason, *addresses); end |
#unblacklist(*addresses) ⇒ Object #unblacklist(list, *addresses) ⇒ Object Also known as: unblock, del_black
99 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 99 def unblacklist(*addresses); end |
#unblacklist!(*addresses) ⇒ Object #unblacklist!(list, *addresses) ⇒ Object Also known as: unblock!, del_black!
94 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 94 def unblacklist!(*addresses); end |
#unwhitelist(*addresses) ⇒ Object #unwhitelist(list, *addresses) ⇒ Object Also known as: del_white
89 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 89 def unwhitelist(*addresses); end |
#unwhitelist!(*addresses) ⇒ Object #unwhitelist!(list, *addresses) ⇒ Object Also known as: del_white!
84 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 84 def unwhitelist!(*addresses); end |
#whitelist(*addresses) ⇒ Object #whitelist(list, *addresses) ⇒ Object
69 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 69 def whitelist(*addresses); end |
#whitelist!(*addresses) ⇒ Object #whitelist!(list, *addresses) ⇒ Object
64 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 64 def whitelist!(*addresses); end |
#whitelist_reasonable(reason, *addresses) ⇒ Object
This method works like whitelist but allows to set reason.
120 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 120 def whitelist_reasonable(reason, *addresses); end |
#whitelist_reasonable!(reason, *addresses) ⇒ Object
This method works like whitelist! but allows to set reason.
116 |
# File 'lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb', line 116 def whitelist_reasonable!(reason, *addresses); end |