ipaccess 1.2.0 → 1.2.2

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.
Files changed (49) hide show
  1. checksums.yaml +5 -13
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.yardopts +2 -0
  5. data/ChangeLog +66 -0
  6. data/Manifest.txt +5 -10
  7. data/README.md +2 -2
  8. data/Rakefile +1 -1
  9. data/docs/HISTORY +11 -0
  10. data/docs/TODO +1 -1
  11. data/docs/yard-tpl/default/fulldoc/html/css/common.css +5 -0
  12. data/examples/open-uri.rb +14 -0
  13. data/examples/telnet.rb +1 -1
  14. data/ipaccess.gemspec +62 -0
  15. data/lib/ipaccess.rb +2 -566
  16. data/lib/ipaccess/arm_sockets.rb +0 -1
  17. data/lib/ipaccess/core.rb +523 -0
  18. data/lib/ipaccess/ghost_doc/ghost_doc.rb +1 -1
  19. data/lib/ipaccess/ghost_doc/ghost_doc_acl.rdoc +54 -0
  20. data/lib/ipaccess/ghost_doc/ghost_doc_net_ftp.rb +35 -19
  21. data/lib/ipaccess/ghost_doc/ghost_doc_net_http.rb +34 -18
  22. data/lib/ipaccess/ghost_doc/ghost_doc_net_smtp.rb +35 -19
  23. data/lib/ipaccess/ghost_doc/ghost_doc_net_telnet.rb +35 -19
  24. data/lib/ipaccess/ghost_doc/ghost_doc_patched_usage.rdoc +65 -0
  25. data/lib/ipaccess/ghost_doc/ghost_doc_sockets.rb +353 -125
  26. data/lib/ipaccess/ip_access_check.rb +2 -2
  27. data/lib/ipaccess/ip_access_errors.rb +2 -2
  28. data/lib/ipaccess/ip_access_list.rb +3 -3
  29. data/lib/ipaccess/patches/generic.rb +150 -183
  30. data/lib/ipaccess/patches/net_ftp.rb +1 -2
  31. data/lib/ipaccess/patches/net_http.rb +10 -14
  32. data/lib/ipaccess/patches/net_imap.rb +1 -2
  33. data/lib/ipaccess/patches/net_pop.rb +2 -4
  34. data/lib/ipaccess/patches/net_smtp.rb +2 -4
  35. data/lib/ipaccess/patches/net_telnet.rb +1 -2
  36. data/lib/ipaccess/patches/sockets.rb +67 -69
  37. data/lib/ipaccess/socket.rb +0 -17
  38. metadata +70 -100
  39. metadata.gz.sig +0 -0
  40. data/lib/ipaccess/ghost_doc/ghost_doc_acl.rb +0 -54
  41. data/lib/ipaccess/ghost_doc/ghost_doc_p_blacklist.rb +0 -36
  42. data/lib/ipaccess/ghost_doc/ghost_doc_p_blacklist_e.rb +0 -7
  43. data/lib/ipaccess/ghost_doc/ghost_doc_p_unblacklist.rb +0 -36
  44. data/lib/ipaccess/ghost_doc/ghost_doc_p_unblacklist_e.rb +0 -7
  45. data/lib/ipaccess/ghost_doc/ghost_doc_p_unwhitelist.rb +0 -36
  46. data/lib/ipaccess/ghost_doc/ghost_doc_p_unwhitelist_e.rb +0 -7
  47. data/lib/ipaccess/ghost_doc/ghost_doc_p_whitelist.rb +0 -36
  48. data/lib/ipaccess/ghost_doc/ghost_doc_p_whitelist_e.rb +0 -7
  49. data/lib/ipaccess/ghost_doc/ghost_doc_patched_usage.rb +0 -64
@@ -1,7 +0,0 @@
1
- # :call-seq:
2
- # blacklist!(*addresses)<br />
3
- # blacklist!(list, *addresses)
4
- #
5
- # This method works same way as blacklist
6
- # but it will allow you to modify the list
7
- # even if the global access set is used by object.
@@ -1,36 +0,0 @@
1
- # :call-seq:
2
- # unblacklist(*addresses)<br />
3
- # unblacklist(list, *addresses)
4
- #
5
- # This method removes blacklisted IP address(-es)
6
- # from the input or output access list selected
7
- # by the *list* argument (+:input+ or +:output+).
8
- # If the access list selector is omited it
9
- # operates on the default access list that certain
10
- # kind of network object uses. The allowed format of address
11
- # is the same as for IPAccess.to_cidrs.
12
- # This method will not add nor remove any
13
- # whitelisted item.
14
- #
15
- # === Restrictions
16
- #
17
- # This method won't allow you to modify the list if
18
- # the global access set is associated with an object.
19
- # You may operate on IPAccess::Set.Global or use
20
- # unblacklist! instead.
21
- #
22
- # === Return value
23
- #
24
- # It will return the result of calling
25
- # IPAccess::List#unblacklist on the list.
26
- #
27
- # === Revalidation
28
- #
29
- # After modyfing access set current connection
30
- # is validated again to avoid access leaks.
31
- #
32
- # === DNS Warning
33
- #
34
- # You should avoid passing hostnames as arguments since
35
- # DNS is not reliable and responses may change with time,
36
- # which may cause security flaws.
@@ -1,7 +0,0 @@
1
- # :call-seq:
2
- # unblacklist!(*addresses)<br />
3
- # unblacklist!(list, *addresses)
4
- #
5
- # This method works same way as unblacklist
6
- # but it will allow you to modify the list
7
- # even if the global access set is used by object.
@@ -1,36 +0,0 @@
1
- # :call-seq:
2
- # unwhitelist(*addresses)<br />
3
- # unwhitelist(list, *addresses)
4
- #
5
- # This method removes whitelisted IP address(-es)
6
- # from the input or output access list selected
7
- # by the *list* argument (+:input+ or +:output+).
8
- # If the access list selector is omited it
9
- # operates on the default access list that certain
10
- # kind of network object uses. The allowed format of address
11
- # is the same as for IPAccess.to_cidrs.
12
- # This method will not add nor remove any
13
- # blacklisted item.
14
- #
15
- # === Restrictions
16
- #
17
- # This method won't allow you to modify the list if
18
- # the global access set is associated with an object.
19
- # You may operate on IPAccess::Set.Global or use
20
- # unwhitelist! instead.
21
- #
22
- # === Return value
23
- #
24
- # It will return the result of calling
25
- # IPAccess::List#unwhitelist on the list.
26
- #
27
- # === Revalidation
28
- #
29
- # After modyfing access set current connection
30
- # is validated again to avoid access leaks.
31
- #
32
- # === DNS Warning
33
- #
34
- # You should avoid passing hostnames as arguments since
35
- # DNS is not reliable and responses may change with time,
36
- # which may cause security flaws.
@@ -1,7 +0,0 @@
1
- # :call-seq:
2
- # unwhitelist!(*addresses)<br />
3
- # unwhitelist!(list, *addresses)
4
- #
5
- # This method works same way as unwhitelist
6
- # but it will allow you to modify the list
7
- # even if the global access set is used by object.
@@ -1,36 +0,0 @@
1
- # :call-seq:
2
- # whitelist(*addresses)<br />
3
- # whitelist(list, *addresses)
4
- #
5
- # This method whitelists IP address(-es) in
6
- # the input or output access list selected
7
- # by the *list* argument (+:input+ or +:output+).
8
- # If the access list selector is omited it
9
- # operates on the default access list that certain
10
- # kind of network object uses. The allowed format of address
11
- # is the same as for IPAccess.to_cidrs.
12
- # This method will not add nor remove any
13
- # blacklisted item.
14
- #
15
- # === Restrictions
16
- #
17
- # This method won't allow you to modify the list if
18
- # the global access set is associated with an object.
19
- # You may operate on IPAccess::Set.Global or use
20
- # whitelist! instead.
21
- #
22
- # === Return value
23
- #
24
- # It will return the result of calling
25
- # IPAccess::List#whitelist on the list.
26
- #
27
- # === Revalidation
28
- #
29
- # After modyfing access set current connection
30
- # is validated again to avoid access leaks.
31
- #
32
- # === DNS Warning
33
- #
34
- # You should avoid passing hostnames as arguments since
35
- # DNS is not reliable and responses may change with time,
36
- # which may cause security flaws.
@@ -1,7 +0,0 @@
1
- # :call-seq:
2
- # whitelist!(*addresses)<br />
3
- # whitelist!(list, *addresses)
4
- #
5
- # This method works same way as whitelist
6
- # but it will allow you to modify the list
7
- # even if the global access set is used by object.
@@ -1,64 +0,0 @@
1
- # Access checks are lazy,
2
- # which means they are performed when
3
- # a real connection is going to happend.
4
- #
5
- # Instances of this class will also
6
- # internally use patched versions of Ruby's network
7
- # socket objects to avoid access leaks.
8
- #
9
- # You can pass access set in various ways: while
10
- # creating a new object or while a communication is
11
- # already started. You can also rely on a global
12
- # access set, which is used by default.
13
- #
14
- # === Usage
15
- #
16
- # There are 3 ways to enable access control:
17
- #
18
- # * by patching original class (see IPAccess.arm) – use it in code that you cannot modify
19
- # * by patching single instance (see IPAccess.arm) – use it occasionally
20
- # * by using instances of this class directly – use it in your own code
21
- #
22
- # There are also 4 ways to manage access rules:
23
- #
24
- # * by using direct methods like blacklist and whitelist – preferred
25
- # * by using +acl+ member – low-level
26
- # * by using <tt>IPAccess::Set.Global</tt> constant – controls a global access set
27
- # * by using methods of an external IPAccess::Set object associated with an instance
28
- #
29
- # ==== Using direct methods
30
- #
31
- # Patched network objects and variants have methods to control access.
32
- # You should use them since they are most reliable way to perform
33
- # modifications on an working instance. These methods (documented
34
- # below) are: whitelist, blacklist, whitelist! and blacklist!.
35
- # Each of the methods ensures that needed safety checks are made
36
- # when detecting some change in access lists.
37
- #
38
- # ==== Using +acl+ member
39
- #
40
- # The +acl+ member gives you direct access to internal IPAccess::Set
41
- # instance that an object uses to control an access. However,
42
- # by accessing this member you may only modify private and shared
43
- # access sets, and you have to manually re-check connection against lists
44
- # (e.g. by using method acl_recheck).
45
- #
46
- # ==== Using IPAccess::Set.Global
47
- #
48
- # You may use IPAccess::Set.Global to add or remove rules
49
- # conatined in lists of a global access set. You should use
50
- # it before some network objects are created and if it's not
51
- # possible call acl_recheck for any object that is using it
52
- # when some changes in rules are made. It is also possible
53
- # to manipulate global access set from object's scope using
54
- # whitelist! and blacklist! methods. For working
55
- # objects you should use them.
56
- #
57
- # ==== Using external access set
58
- #
59
- # External access sets are simply IPAccess::Set objects
60
- # that were associated with an instance during initialization
61
- # or by assigning it to +acl+ member. You may manipulate their
62
- # access rules safely before a networking object is in
63
- # a connected state. After it happens it is safer to use
64
- # direct controlling methods that network object provides.