1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Net::Config 3perl"
.TH Net::Config 3perl 2024-05-30 "perl v5.38.2" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
Net::Config \- Local configuration data for libnet
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 1
\& use Net::Config qw(%NetConfig);
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
\&\f(CW\*(C`Net::Config\*(C'\fR holds configuration data for the modules in the libnet
distribution. During installation you will be asked for these values.
.PP
The configuration data is held globally in \f(CW\*(C`/etc/perl/Net/libnet.cfg\*(C'\fR,
but a user may override any of these values by providing their own. This
can be done by having a \f(CW\*(C`.libnetrc\*(C'\fR file in their home directory. This file
should return a reference to a HASH containing the keys described below.
For example
.PP
.Vb 6
\& # .libnetrc
\& {
\& nntp_hosts => [ "my_preferred_host" ],
\& ph_hosts => [ "my_ph_server" ],
\& }
\& _\|_END_\|_
.Ve
.SS "Class Methods"
.IX Subsection "Class Methods"
\&\f(CW\*(C`Net::Config\*(C'\fR defines the following methods. They are methods as they are
invoked as class methods. This is because \f(CW\*(C`Net::Config\*(C'\fR inherits from
\&\f(CW\*(C`Net::LocalCfg\*(C'\fR so you can override these methods if you want.
.ie n .IP requires_firewall($host) 4
.el .IP \f(CWrequires_firewall($host)\fR 4
.IX Item "requires_firewall($host)"
Attempts to determine if a given host is outside your firewall. Possible
return values are.
.Sp
.Vb 3
\& \-1 Cannot lookup hostname
\& 0 Host is inside firewall (or there is no ftp_firewall entry)
\& 1 Host is outside the firewall
.Ve
.Sp
This is done by using hostname lookup and the \f(CW\*(C`local_netmask\*(C'\fR entry in
the configuration data.
.SS "NetConfig Values"
.IX Subsection "NetConfig Values"
.IP nntp_hosts 4
.IX Item "nntp_hosts"
.PD 0
.IP snpp_hosts 4
.IX Item "snpp_hosts"
.IP pop3_hosts 4
.IX Item "pop3_hosts"
.IP smtp_hosts 4
.IX Item "smtp_hosts"
.IP ph_hosts 4
.IX Item "ph_hosts"
.IP daytime_hosts 4
.IX Item "daytime_hosts"
.IP time_hosts 4
.IX Item "time_hosts"
.PD
Each is a reference to an array of hostnames (in order of preference),
which should be used for the given protocol
.IP inet_domain 4
.IX Item "inet_domain"
Your internet domain name
.IP ftp_firewall 4
.IX Item "ftp_firewall"
If you have an FTP proxy firewall (\fBNOT\fR an HTTP or SOCKS firewall)
then this value should be set to the firewall hostname. If your firewall
does not listen to port 21, then this value should be set to
\&\f(CW"hostname:port"\fR (eg \f(CW"hostname:99"\fR)
.IP ftp_firewall_type 4
.IX Item "ftp_firewall_type"
There are many different ftp firewall products available. But unfortunately
there is no standard for how to traverse a firewall. The list below shows the
sequence of commands that Net::FTP will use
.Sp
.Vb 5
\& user Username for remote host
\& pass Password for remote host
\& fwuser Username for firewall
\& fwpass Password for firewall
\& remote.host The hostname of the remote ftp server
.Ve
.RS 4
.IP 0 4
There is no firewall
.IP 1 4
.IX Item "1"
.Vb 2
\& USER user@remote.host
\& PASS pass
.Ve
.IP 2 4
.IX Item "2"
.Vb 4
\& USER fwuser
\& PASS fwpass
\& USER user@remote.host
\& PASS pass
.Ve
.IP 3 4
.IX Item "3"
.Vb 5
\& USER fwuser
\& PASS fwpass
\& SITE remote.site
\& USER user
\& PASS pass
.Ve
.IP 4 4
.IX Item "4"
.Vb 5
\& USER fwuser
\& PASS fwpass
\& OPEN remote.site
\& USER user
\& PASS pass
.Ve
.IP 5 4
.IX Item "5"
.Vb 2
\& USER user@fwuser@remote.site
\& PASS pass@fwpass
.Ve
.IP 6 4
.IX Item "6"
.Vb 4
\& USER fwuser@remote.site
\& PASS fwpass
\& USER user
\& PASS pass
.Ve
.IP 7 4
.IX Item "7"
.Vb 4
\& USER user@remote.host
\& PASS pass
\& AUTH fwuser
\& RESP fwpass
.Ve
.RE
.RS 4
.RE
.IP ftp_ext_passive 4
.IX Item "ftp_ext_passive"
.PD 0
.IP ftp_int_passive 4
.IX Item "ftp_int_passive"
.PD
FTP servers can work in passive or active mode. Active mode is when
you want to transfer data you have to tell the server the address and
port to connect to. Passive mode is when the server provide the
address and port and you establish the connection.
.Sp
With some firewalls active mode does not work as the server cannot
connect to your machine (because you are behind a firewall) and the firewall
does not re-write the command. In this case you should set \f(CW\*(C`ftp_ext_passive\*(C'\fR
to a \fItrue\fR value.
.Sp
Some servers are configured to only work in passive mode. If you have
one of these you can force \f(CW\*(C`Net::FTP\*(C'\fR to always transfer in passive
mode; when not going via a firewall, by setting \f(CW\*(C`ftp_int_passive\*(C'\fR to
a \fItrue\fR value.
.IP local_netmask 4
.IX Item "local_netmask"
A reference to a list of netmask strings in the form \f(CW"134.99.4.0/24"\fR.
These are used by the \f(CW\*(C`requires_firewall\*(C'\fR function to determine if a given
host is inside or outside your firewall.
.PP
The following entries are used during installation & testing on the
libnet package
.IP test_hosts 4
.IX Item "test_hosts"
If true then \f(CW\*(C`make test\*(C'\fR may attempt to connect to hosts given in the
configuration.
.IP test_exists 4
.IX Item "test_exists"
If true then \f(CW\*(C`Configure\*(C'\fR will check each hostname given that it exists
.SH EXPORTS
.IX Header "EXPORTS"
The following symbols are, or can be, exported by this module:
.IP "Default Exports" 4
.IX Item "Default Exports"
\&\f(CW%NetConfig\fR.
.IP "Optional Exports" 4
.IX Item "Optional Exports"
\&\fINone\fR.
.IP "Export Tags" 4
.IX Item "Export Tags"
\&\fINone\fR.
.SH "KNOWN BUGS"
.IX Header "KNOWN BUGS"
\&\fINone\fR.
.SH AUTHOR
.IX Header "AUTHOR"
Graham Barr <gbarr@pobox.com <mailto:gbarr@pobox.com>>.
.PP
Steve Hay <shay@cpan.org <mailto:shay@cpan.org>> is now maintaining
libnet as of version 1.22_02.
.SH COPYRIGHT
.IX Header "COPYRIGHT"
Copyright (C) 2000 Graham Barr. All rights reserved.
.PP
Copyright (C) 2013\-2014, 2016, 2020 Steve Hay. All rights reserved.
.SH LICENCE
.IX Header "LICENCE"
This module is free software; you can redistribute it and/or modify it under the
same terms as Perl itself, i.e. under the terms of either the GNU General Public
License or the Artistic License, as specified in the \fILICENCE\fR file.
.SH VERSION
.IX Header "VERSION"
Version 3.15
.SH DATE
.IX Header "DATE"
20 March 2023
.SH HISTORY
.IX Header "HISTORY"
See the \fIChanges\fR file.
|