amindexd & java -> unexpected EOF/unprocessed input

2001-02-15 Thread Sebastian Frankfurt

Hello ;-)

I tried to connect to the amindexd service via Java. It is possible
to read what the Server first barfs out... but if I try to send
some commands (SECURITY root, HOST localhost, etc.) nothing happens
and the debug output of amindexd says, that there is an unexpected EOF
and some unprocessed input (the mentioned commands I sent before).

=
This is what the /tmp/amanda/amindexd.debug says:

< 220 kant AMANDA index server (2.4.1p1) ready.
? unexpected EOF
? unprocessed input:
-
? SECURITY root

-
amindexd: pid 5867 finish time Thu Feb 15 17:27:19 2001

=

I also tried to get a connection via Telnet, but the socket-port
of the telnet process is always to high, to be taken as a secure port
by the amindexd. Do you know a possibility of setting a portrange
to a telnet process?


Well, please have a look at the following (attached) tiny java program
and give me some hints, how to get a connection to the amindexd.



I want to write some interface from Java to amindexd for providing
a possibility for writing native java programs to take use of
the Amanda Backup Service ;-)


Please sent me a copy (CC:) to my private account ( mailto:[EMAIL PROTECTED])

thanx in advance,

Sebastian



import java.net.InetAddress;
import java.net.Socket;
import java.io.InputStream;
import java.io.PrintWriter;

public class testsock {

  public static String read(InputStream in) throws Exception {
StringBuffer sb = new StringBuffer();

while (true) {
  String str = "";
  while (in.available() > 0) {
byte b[] = new byte[in.available()];
in.read(b);
str = new String(b);
sb.append(str);
  }
  if (str.indexOf("AMANDA") > -1)
break;
  else if (str.indexOf("5") > -1)
break;
  else if (str.indexOf("2") > -1)
break;
}
return sb.toString();
  }

  public static void main(String args[]) throws Exception {
Socket s = new Socket("localhost", 10082, InetAddress.getLocalHost(), 1028);
System.out.println("localport: "+s.getLocalPort());
InputStream in  = s.getInputStream();

System.out.println("got: "+read(in));

PrintWriter out = new PrintWriter(s.getOutputStream(), true);
System.out.println("send: SECURITY root");
out.println("SECURITY root");

System.out.println("got: "+read(in));
  }

}

 testsock.class

#!/usr/bin/perl

use Net::Telnet();

$hostname = "localhost";

$port = 10082;

$t = new Net::Telnet ( Host => $hostname, Port => $port);
$t->open("$hostname");

do
{
  $data = $t->getline(Timeout => 40);
  print "got: $data";
  $t->print("SECURITY root\n");
} while (true);




Re: amrecover: cannot connect to host (connection refused)

2001-01-30 Thread Sebastian Frankfurt

Gerhard den Hollander wrote:

> * Sebastian Frankfurt <[EMAIL PROTECTED]> (Tue, Jan 30, 2001 at 10:27:41AM +0100)
> 
>> Mack Earnhardt wrote:
>> 
>> 
>>> I was getting connection refused on amrecover for a while.  The 
>>> ..amandahosts file allowed access to root@localhost, but amrecover would 
>>> use root@servername and fail.  My solution was to use the server name 
>>> explicitly in both .amandahosts and disklist.
>>> 
>>> Hope this help one of your problems. :)
>> 
>> Well thanx for the tip, but it doesn't matter, what I put into
>> the .amandahosts because the error I get is:
>> 
>>AMRECOVER Version 2.4.1p1. Contacting server on localhost ...
>>amrecover: Unexpected server end of file
> 
> 
> Did you check the files in /tmp/amanda 
> (on server and client) ?

I have had a look at them don't see anything wrong :-(


amrecover:

   amrecover: debug 1 pid 1554 ruid 0 euid 0 start time Tue Jan 30 
10:28:33 2001
   Error connecting to server
   amrecover: pid 1554 finish time Tue Jan 30 10:28:33 2001




I will attach all /tmp/amanda files.

thanx,

Sebastian

PS: rsh commands works properly for root and operator



amandad: debug 1 pid 1495 ruid 11 euid 11 start time Tue Jan 30 10:25:31 2001
amandad: version 2.4.1p1
amandad: build: VERSION="Amanda-2.4.1p1"
amandad:BUILT_DATE="Mon Aug 21 16:31:37 EDT 2000"
amandad:BUILT_MACH="Linux porky.devel.redhat.com 2.2.5-22smp #1 SMP Wed Jun 2 
09:11:51 EDT 1999 i686 unknown"
amandad:CC="gcc"
amandad: paths: bindir="/usr/bin" sbindir="/usr/sbin"
amandad:libexecdir="/usr/lib/amanda" mandir="/usr/share/man"
amandad:CONFIG_DIR="/etc/amanda" DEV_PREFIX="/dev/"
amandad:RDEV_PREFIX="/dev/r" DUMP="/sbin/dump"
amandad:RESTORE="/sbin/restore" SAMBA_CLIENT="/usr/bin/smbclient"
amandad:GNUTAR="/bin/tar" COMPRESS_PATH="/usr/bin/gzip"
amandad:UNCOMPRESS_PATH="/usr/bin/gzip" MAILER="/usr/bin/Mail"
amandad:listed_incr_dir="/var/lib/amanda/gnutar-lists"
amandad: defs:  DEFAULT_SERVER="localhost" DEFAULT_CONFIG="DailySet1"
amandad:DEFAULT_TAPE_SERVER="localhost"
amandad:DEFAULT_TAPE_DEVICE="/dev/null" HAVE_MMAP HAVE_SYSVSHM
amandad:LOCKING=POSIX_FCNTL SETPGRP_VOID DEBUG_CODE BSD_SECURITY
amandad:USE_AMANDAHOSTS CLIENT_LOGIN="operator" FORCE_USERID
amandad:HAVE_GZIP COMPRESS_SUFFIX=".gz" COMPRESS_FAST_OPT="--fast"
amandad:COMPRESS_BEST_OPT="--best" UNCOMPRESS_OPT="-dc"
got packet:

Amanda 2.4 REQ HANDLE 000-90D50508 SEQ 980846701
SECURITY USER operator
SERVICE sendbackup
OPTIONS hostname=localhost;
GNUTAR /etc 1 2001:1:27:2:25:7 OPTIONS 
|;bsd-auth;compress-fast;index;exclude-list=/usr/local/lib/amanda/exclude.gtar;


sending ack:

Amanda 2.4 ACK HANDLE 000-90D50508 SEQ 980846701


bsd security: remote host localhost user operator local user operator
amandahosts security check passed
amandad: running service "/usr/lib/amanda/sendbackup"
amandad: sending REP packet:

Amanda 2.4 REP HANDLE 000-90D50508 SEQ 980846701
CONNECT DATA 1297 MESG 1298 INDEX 1299
OPTIONS ;compress-fast;bsd-auth;index;exclude-list=/usr/local/lib/amanda/exclude.gtar;


amandad: got ack:

Amanda 2.4 ACK HANDLE 000-90D50508 SEQ 980846701


amandad: pid 1495 finish time Tue Jan 30 10:25:31 2001


amrecover: debug 1 pid 1639 ruid 0 euid 0 start time Tue Jan 30 10:59:36 2001
Error connecting to server
amrecover: pid 1639 finish time Tue Jan 30 10:59:36 2001


amtrmidx: debug 1 pid 1541 ruid 11 euid 11 start time Tue Jan 30 10:25:32 2001
/usr/lib/amanda/amtrmidx: version 2.4.1p1
Keeping 26 index files
localhost /etc
amtrmidx: pid 1541 finish time Tue Jan 30 10:25:40 2001


killpgrp: debug 1 pid 2007 ruid 11 euid 0 start time Sat Jan 27 03:16:49 2001
/usr/lib/amanda/killpgrp: version 2.4.1p1
sending SIGTERM to process group 2007
child process exited with status 3


runtar: debug 1 pid 1500 ruid 11 euid 0 start time Tue Jan 30 10:25:31 2001
gtar: version 2.4.1p1
running: /bin/tar: gtar --create --directory /etc --listed-incremental 
/var/lib/amanda/gnutar-lists/localhost_etc_1.new --sparse --one-file-system 
--ignore-failed-read --totals --file - . 


selfcheck: debug 1 pid 1453 ruid 11 euid 11 start time Tue Jan 30 10:20:01 2001
/usr/lib/amanda/selfcheck: version 2.4.1p1
checking disk /etc: device /etc: OK
selfcheck: pid 1453 finish time Tue Jan 30 10:20:01 2001


sendbackup: debug 1 pid 1496 ruid 11 euid 11 start time Tue Jan 30 10:25:31 2001
/usr/lib/amanda/sendbackup: got input request: GNUTAR /etc 1 2001:1

Re: amrecover: cannot connect to host (connection refused)

2001-01-30 Thread Sebastian Frankfurt

Mack Earnhardt wrote:

> I was getting connection refused on amrecover for a while.  The 
> ..amandahosts file allowed access to root@localhost, but amrecover would 
> use root@servername and fail.  My solution was to use the server name 
> explicitly in both .amandahosts and disklist.
> 
> Hope this help one of your problems. :)

Well thanx for the tip, but it doesn't matter, what I put into
the .amandahosts because the error I get is:

   AMRECOVER Version 2.4.1p1. Contacting server on localhost ...
   amrecover: Unexpected server end of file


That means, amrecover is able to connect to the localhost
and amandaidx has been started but unexpected closed
seen in the log:

   Jan 29 07:51:51 myhost xinetd[1318]: xinetd Version 2.1.8.9pre11
   started with
   Jan 29 07:51:51 myhost xinetd[1318]: libwrap
   Jan 29 07:51:51 myhost xinetd[1318]: options compiled in.
   Jan 29 07:51:51 myhost xinetd[1318]: Started working: 8 available
   services
   Jan 29 07:51:54 myhost xinetd: xinetd startup succeeded
   Jan 29 07:52:07 myhost xinetd[1318]: warning: can't get client
   address: Invalid argument
   Jan 29 07:52:07 myhost xinetd[1318]: file descriptor of service
   amandaidx has been closed
   Jan 29 07:52:07 myhost xinetd[1318]: select reported EBADF but no bad
   file descriptors were found

any other suggestions? I'm a bit confused about this.

thanx in advance,

Sebastian

> 
> -Mack
> 
> Sebastian Frankfurt wrote:
> 
>> Hello,
>> 
>> I am using RedHat 7.0 with xinetd-2.1.8.9pre11-1.
>> amcheck and amdump are working properly, but if I want
>> to restore files from dump using amrecover, the tool
>> is not working.
>> Everything is called from the same host (localhost).
>> 
>> This is what the amrecover sends to stdout:
>> 
>>AMRECOVER Version 2.4.1p1. Contacting server on localhost ...
>>amrecover: Unexpected server end of file
>> 
>> 
>> And this is what I found in /var/log/messages:
>> 
>>Jan 29 07:51:51 myhost xinetd[1318]: xinetd Version 2.1.8.9pre11
>> started with
>>Jan 29 07:51:51 myhost xinetd[1318]: libwrap
>>Jan 29 07:51:51 myhost xinetd[1318]: options compiled in.
>>Jan 29 07:51:51 myhost xinetd[1318]: Started working: 8 available
>> services
>>Jan 29 07:51:54 myhost xinetd: xinetd startup succeeded
>>Jan 29 07:52:07 myhost xinetd[1318]: warning: can't get client
>> address: Invalid argument
>>Jan 29 07:52:07 myhost xinetd[1318]: file descriptor of service
>> amandaidx has been closed
>>Jan 29 07:52:07 myhost xinetd[1318]: select reported EBADF but no bad
>> file descriptors were found
>> 
>> 
>> I think, the problem is:
>> 
>>  warning: can't get client address: Invalid argument
>> 
>> but do you know when this could happened?
>> 
>> 
>> This happens only the very first time, if I try to connect
>> via amrecover the next time, nothing happens in the syslog,
>> but the amrecover client barfs:
>> 
>>AMRECOVER Version 2.4.1p1. Contacting server on localhost ...
>>amrecover: Error connecting to server: Connection refused
>> 
>> 
>> It is possible for operator and root to do an rsh localhost .
>> 




amrecover: cannot connect to host (connection refused)

2001-01-28 Thread Sebastian Frankfurt

Hello,

I am using RedHat 7.0 with xinetd-2.1.8.9pre11-1.
amcheck and amdump are working properly, but if I want
to restore files from dump using amrecover, the tool
is not working.
Everything is called from the same host (localhost).

This is what the amrecover sends to stdout:

AMRECOVER Version 2.4.1p1. Contacting server on localhost ...
amrecover: Unexpected server end of file


And this is what I found in /var/log/messages:

Jan 29 07:51:51 myhost xinetd[1318]: xinetd Version 2.1.8.9pre11
started with
Jan 29 07:51:51 myhost xinetd[1318]: libwrap
Jan 29 07:51:51 myhost xinetd[1318]: options compiled in.
Jan 29 07:51:51 myhost xinetd[1318]: Started working: 8 available
services
Jan 29 07:51:54 myhost xinetd: xinetd startup succeeded
Jan 29 07:52:07 myhost xinetd[1318]: warning: can't get client
address: Invalid argument
Jan 29 07:52:07 myhost xinetd[1318]: file descriptor of service
amandaidx has been closed
Jan 29 07:52:07 myhost xinetd[1318]: select reported EBADF but no bad
file descriptors were found


I think, the problem is:

  warning: can't get client address: Invalid argument

but do you know when this could happened?


This happens only the very first time, if I try to connect
via amrecover the next time, nothing happens in the syslog,
but the amrecover client barfs:

AMRECOVER Version 2.4.1p1. Contacting server on localhost ...
amrecover: Error connecting to server: Connection refused


It is possible for operator and root to do an rsh localhost .

The permissions for /root/.rhosts
-rw---1 root root25 Jan 28 23:44 /root/.rhosts

The permissions for /root/.amandahosts
-rw---1 operator disk   107 Jan 29 00:29 /root/.amandahosts

Amanda-User: operator
User Operator is in 'disk' group.

If you need the information of /etc/xinet.d/am*
I will attach these files. I tried to use the amanda inetd-entries
w/o tcp_wrappers, but the errors are still the same.

I will also put the debug output of /tmp/amanda to this mail.

So, I am not subscribed to the mailing list, please
do a CC to mailto:[EMAIL PROTECTED]

Any suggestions?

thanx in advance,

Sebastian



# default: on
#
# description: Part of the Amanda server package

service amanda
{
socket_type = dgram
protocol= udp
wait= yes
user= operator
group   = disk
server  = /usr/lib/amanda/amandad 
disable = no
}



# default: off
#
# description: Part of the Amanda server package
#

service amandaidx
{
socket_type = stream
protocol= tcp
wait= yes
user= operator
group   = disk
server  = /usr/lib/amanda/amindexd 
disable = no
}



# default: off
#
# description: Part of the amanda server package
#

service amidxtape
{
socket_type = stream
protocol= tcp
wait= no
user= operator
group   = disk
server  = /usr/lib/amanda/amidxtaped
disable = no
}



amandad: debug 1 pid 932 ruid 11 euid 11 start time Mon Jan 29 07:34:19 2001
amandad: version 2.4.1p1
amandad: build: VERSION="Amanda-2.4.1p1"
amandad:BUILT_DATE="Mon Aug 21 16:31:37 EDT 2000"
amandad:BUILT_MACH="Linux porky.devel.redhat.com 2.2.5-22smp #1 SMP Wed Jun 2 
09:11:51 EDT 1999 i686 unknown"
amandad:CC="gcc"
amandad: paths: bindir="/usr/bin" sbindir="/usr/sbin"
amandad:libexecdir="/usr/lib/amanda" mandir="/usr/share/man"
amandad:CONFIG_DIR="/etc/amanda" DEV_PREFIX="/dev/"
amandad:RDEV_PREFIX="/dev/r" DUMP="/sbin/dump"
amandad:RESTORE="/sbin/restore" SAMBA_CLIENT="/usr/bin/smbclient"
amandad:GNUTAR="/bin/tar" COMPRESS_PATH="/usr/bin/gzip"
amandad:UNCOMPRESS_PATH="/usr/bin/gzip" MAILER="/usr/bin/Mail"
amandad:listed_incr_dir="/var/lib/amanda/gnutar-lists"
amandad: defs:  DEFAULT_SERVER="localhost" DEFAULT_CONFIG="DailySet1"
amandad:DEFAULT_TAPE_SERVER="localhost"
amandad:DEFAULT_TAPE_DEVICE="/dev/null" HAVE_MMAP HAVE_SYSVSHM
amandad:LOCKING=POSIX_FCNTL SETPGRP_VOID DEBUG_CODE BSD_SECURITY
amandad:USE_AMANDAHOSTS CLIENT_LOGIN="operator" FORCE_USERID
amandad:HAVE_GZIP COMPRESS_SUFFIX=".gz" COMPRESS_FAST_OPT="--fast"
amandad:COMPRESS_BEST_OPT="--best" UNCOMPRESS_OPT="-dc"
got packet:

Amanda 2.4 REQ HANDLE 000-90D50508 SEQ 980750029
SECURITY USER operator
SERVICE sendbackup
OPTIONS hostname=localhost;
GNUTAR /etc 1 2001:1:27:2:25:7 OPTIONS 
|;bsd-auth;compress-fast;index;exclude-list=/usr/local/lib/amanda/exclude.gtar;


sending ack:

Amanda 2.4 ACK HANDLE 000-90D50508 SEQ 980750029
-