 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
pabegue Guest
|
Posted: Wed Oct 01, 2003 7:26 pm Post subject: Socket : security and accept ... |
|
|
I want to accept connection only if the host of the clients of the
sockets are members of a restricted list. This list is specified on my
server.
For instance, my server is waiting on accept().
My client is trying to connect using connect(). If the client is
hosted by an unauthorized host, I want the client to catch an
IOException (connection refused by foreign host) on the connect call.
I think that I need to use SecurityManager but I really do not know
how to do that ...
If someone could give me a sample code ...
Thanks by advance
Pascal BEGUE
|
|
| Back to top |
|
 |
Gordon Beaton Guest
|
Posted: Thu Oct 02, 2003 8:23 am Post subject: Re: Socket : security and accept ... |
|
|
On 1 Oct 2003 12:26:58 -0700, pabegue wrote:
| Quote: | I want to accept connection only if the host of the clients of the
sockets are members of a restricted list. This list is specified on my
server.
For instance, my server is waiting on accept().
My client is trying to connect using connect(). If the client is
hosted by an unauthorized host, I want the client to catch an
IOException (connection refused by foreign host) on the connect call.
|
This is only possible in some limited sense, when a (multihomed)
server only accepts connections on a specific network interface.
Connections to the specific interface will be accepted, but attempts
to connect to the other interfaces will result in "connection
refused". Unless your list of approved clients coincides with the
topology of your network, this isn't your solution.
In the normal case, the server cannot prevent connections from
succeeding. It has to accept each connection, but can see where it
comes from, check against the list, and close it if necessary.
The client won't get "connection refused" in this case, but if you
write both server and client code, then the server can tell the client
why it closes the connection, and the client can deal with that
information in an appropriate way.
/gordon
--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
|
|
| Back to top |
|
 |
Pankaj Kumar Guest
|
Posted: Thu Oct 02, 2003 7:08 pm Post subject: Re: Socket : security and accept ... |
|
|
If you are running your server program on a Linux (2.4 kernel) then
you can use "iptables" to set the packet filtering rules so that all
incoming connections from a specified set of IP addresses are DROPPED.
Pankaj Kumar,
Author, "J2EE Security ..." (www.j2ee-security.net)
[email]pabegue (AT) airfrance (DOT) fr[/email] (pabegue) wrote in message news:<ce62cbd2.0310011126.d1ed14a (AT) posting (DOT) google.com>...
| Quote: | I want to accept connection only if the host of the clients of the
sockets are members of a restricted list. This list is specified on my
server.
For instance, my server is waiting on accept().
My client is trying to connect using connect(). If the client is
hosted by an unauthorized host, I want the client to catch an
IOException (connection refused by foreign host) on the connect call.
I think that I need to use SecurityManager but I really do not know
how to do that ...
If someone could give me a sample code ...
Thanks by advance
Pascal BEGUE
|
|
|
| Back to top |
|
 |
Sven Boeckelmann Guest
|
Posted: Tue Oct 07, 2003 10:56 am Post subject: Re: Socket : security and accept ... |
|
|
Why don't you consider unsing SSLSocket.
If you build a proper PKI (private key infrastructure)
you can have the clients to authenticate themselves by
using the TrustManager. All the data being transferred will also
be encrypted. That's much better and basically more flexible than
just using plain IP-Address based authentication.
Cheers,
Sven
On Wed, 01 Oct 2003 12:26:58 -0700, pabegue wrote:
| Quote: | I want to accept connection only if the host of the clients of the
sockets are members of a restricted list. This list is specified on my
server.
For instance, my server is waiting on accept().
My client is trying to connect using connect(). If the client is
hosted by an unauthorized host, I want the client to catch an
IOException (connection refused by foreign host) on the connect call.
I think that I need to use SecurityManager but I really do not know
how to do that ...
If someone could give me a sample code ...
Thanks by advance
Pascal BEGUE
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|