LINUX.ORG.RU

[ubuntu] saned работает сам по себе и не работает из-под xinetd


0

1

Собственно, сабж.

Запускаю на машине, к которой подцеплен сканер (далее сервер)

server~# /etc/init.d/xinetd stop
 * Stopping internet superserver xinetd 
server~# saned -d128
[saned] main: starting debug mode (level 128)
[saned] main: trying to get port for service `sane-port' (getaddrinfo)
[saned] main: [0] socket () using IPv4
[saned] main: [0] setsockopt ()
[saned] main: [0] bind () to port 6566
[saned] main: [0] listen ()
[saned] main: [1] socket () using IPv6
[saned] main: [1] socket failed: Address family not supported by protocol
[saned] main: waiting for control connection
Запускаю на клиенте
client~$scanimage -L
device `net:192.168.102.77:hpaio:/usb/HP_LaserJet_Professional_M1212nf_MFP?serial=000000000QJ48B4TPR1a' is a Hewlett-Packard HP_LaserJet_Professional_M1212nf_MFP all-in-one
Т.е. девайс видится. На сервере тоже отклик в логах соответствует ожиданию:
[saned] saned (AF-indep+IPv6) from sane-backends 1.0.19 ready
[saned] check_host: access by remote host: 192.168.102.200
[saned] check_host: remote host is not IN_LOOPBACK nor IN6_LOOPBACK
[saned] check_host: local hostname: secretar
[saned] check_host: local hostname(s) (from DNS): secretar
[saned] check_host: local hostname(s) (from DNS): (null)
[saned] check_host: local hostname(s) (from DNS): (null)
[saned] check_host: remote host doesn't have same addr as local
[saned] check_host: opening config file: /etc/hosts.equiv
[saned] check_host: can't open config file: /etc/hosts.equiv (No such file or directory)
[saned] check_host: opening config file: saned.conf
[saned] check_host: config file line: `#'
[saned] check_host: config file line: `# saned.conf'
[saned] check_host: config file line: `#'
[saned] check_host: config file line: `# The contents of the saned.conf  file  is  a  list  of  host  names,  IP'
[saned] check_host: config file line: `# addresses or IP subnets (CIDR notation) that are permitted to use local'
[saned] check_host: config file line: `# SANE devices. IPv6 addresses must be enclosed in brackets,  and  should'
[saned] check_host: config file line: `# always  be specified in their compressed form.'
[saned] check_host: config file line: `#'
[saned] check_host: config file line: `# The hostname matching is not case-sensitive.'
[saned] check_host: config file line: `#'
[saned] check_host: config file line: `#scan-client.somedomain.firm'
[saned] check_host: config file line: `#192.168.0.1'
[saned] check_host: config file line: `#192.168.0.1/29'
[saned] check_host: config file line: `#[2001:7a8:185e::42:12]'
[saned] check_host: config file line: `#[2001:7a8:185e::42:12]/64'
[saned] check_host: config file line: `192.168.102.0/24'
[saned] check_host: subnet with base IP = 192.168.102.0, CIDR netmask = 24
[saned] check_host: access granted from IP address 192.168.102.200 (in subnet 192.168.102.0/24)
[saned] init: access granted
[saned] init: access granted to strangeman@192.168.102.200
[saned] process_request: waiting for request
[saned] process_request: got request 1
[saned] process_request: waiting for request
[saned] process_request: got request 10
[saned] quit: exiting

Как только включаю xinetd на сервере - сканер видеться перестает, scanimage ничего не находит. sane-find-scanner ничего не находит (да и не уверен, что должен) в обоих случаях.

Конфиги сервера:

server~# cat /etc/xinetd.d/saned 
service saned 
{
    socket_type = stream
    server = /usr/sbin/saned
    protocol = tcp
    user = saned
    group = scanner
    wait = no
    disable = no
}

server~# cat /etc/services | grep saned
sane-port	6566/tcp	sane saned	# SANE network scanner daemon

На клиенте в /etc/sane.d/net.conf IP сервера прописан.

Где туплю?

Ответ на: комментарий от tiandrey

Добавил порт, стало лучше, но ненамного. scanimage -L и sane-find-scanner все также молчат, но в логах сервера начали появляться проблески надежды. Реакция сервера на запуск scanimage -L на клиенте:

~# tail /var/log/daemon.log
Jan 24 17:53:10 secretar saned[20948]: saned (AF-indep+IPv6) from sane-backends 1.0.19 ready 
Jan 24 17:53:10 secretar saned[20948]: check_host: access by remote host: 192.168.102.200 
Jan 24 17:53:10 secretar saned[20948]: init: access granted to strangeman@192.168.102.200 
Jan 24 17:53:10 secretar saned[20948]: quit: exiting 
Т.е. сервер запрос получает, а вот обратно до клиента это не доходит.

client~$ nmap -v -A 192.168.102.77

Starting Nmap 5.21 ( http://nmap.org ) at 2012-01-24 17:57 VLAT
NSE: Loaded 36 scripts for scanning.
Initiating Ping Scan at 17:57
Scanning 192.168.102.77 [2 ports]
Completed Ping Scan at 17:57, 0.00s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 17:57
Completed Parallel DNS resolution of 1 host. at 17:57, 0.00s elapsed
Initiating Connect Scan at 17:57
Scanning 192.168.102.77 [1000 ports]
Discovered open port 5900/tcp on 192.168.102.77
Discovered open port 22/tcp on 192.168.102.77
Discovered open port 631/tcp on 192.168.102.77
Discovered open port 6566/tcp on 192.168.102.77
Discovered open port 901/tcp on 192.168.102.77

Следовательно, порт saned на сервере открыт.

strangeman ★★★★ ()
Ответ на: комментарий от strangeman

Хотел было сказать «фига ты халявщик», но посмотрел профиль и передумал ^_^ Какая у вас там временная зона?

tiandrey ★★★★★ ()

когда ты его «сам по себе» запускаешь, ты делаешь это от рута, а из xinetd он у тебя работает от user = saned group = scanner. гугли в сторону пермишенов на устройство-сканер.
(тред не читал)

aol ★★★★★ ()
Ответ на: комментарий от tiandrey
client~$ SANE_DEBUG_NET=128 scanimage -L
[sanei_debug] Setting debug level of net to 128.
[net] sane_init: authorize = 0x804d860, version_code = 0xbf8f007c
[net] sane_init: SANE net backend version 1.0.14 (AF-indep+IPv6) from sane-backends 1.0.21
[net] sane_init: Client has little endian byte order
[net] sane_init: searching for config file
[net] sane_init: connect timeout set to 60 seconds
[net] sane_init: trying to add 192.168.102.77
[net] add_device: adding backend 192.168.102.77
[net] add_device: backend 192.168.102.77 added
[net] sane_init: done reading config
[net] sane_init: evaluating environment variable SANE_NET_HOSTS
[net] sane_init: evaluating environment variable SANE_NET_TIMEOUT
[net] sane_init: done
[net] sane_get_devices: local_only = 0
[net] connect_dev: trying to connect to 192.168.102.77
[net] connect_dev: [0] connection succeeded (IPv4)
[net] connect_dev: sanei_w_init
[net] connect_dev: net_init (user=strangeman, local version=1.0.3)
[net] connect_dev: freeing init reply (status=Success, remote version=1.0.3)
[net] connect_dev: done
[net] sane_get_devices: finished (0 devices)

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
[net] sane_exit: exiting
[net] net_avahi_cleanup: stopping thread
[net] net_avahi_cleanup: done
[net] sane_exit: closing dev 0x90e25c0, ctl=6
[net] sane_exit: finished.

На сервере из-под обычного пользователя, у которого сканер работает:

server~$ SANE_DEBUG_NET=128 scanimage -L
[sanei_debug] Setting debug level of net to 128.
[net] sane_init: authorize = 0x804aed0, version_code = 0xbff6f5e8
[net] sane_init: SANE net backend version 1.0.14 (AF-indep+IPv6) from sane-backends 1.0.19
[net] sane_init: Client has little endian byte order
[net] sane_init: searching for config file
[net] sane_init: done reading config
[net] sane_init: evaluating environment variable SANE_NET_HOSTS
[net] sane_init: evaluating environment variable SANE_NET_TIMEOUT
[net] sane_init: done
[net] sane_get_devices: local_only = 0
[net] sane_get_devices: finished (0 devices)
device `hpaio:/usb/HP_LaserJet_Professional_M1212nf_MFP?serial=000000000QJ48B4TPR1a' is a Hewlett-Packard HP_LaserJet_Professional_M1212nf_MFP all-in-one
[net] sane_exit: exiting
[net] sane_exit: finished.

Смущает, что в обоих случаях идет [net] sane_get_devices: finished (0 devices)

strangeman ★★★★ ()
Ответ на: комментарий от strangeman

Гуглеж показал, что это, судя по-всему, бага убунты 8.04. Работает только от рута. Ладно, ну и хрен с ним пока.

strangeman ★★★★ ()
Ответ на: комментарий от strangeman

Так у тебя локальный, наверное, не только через сеть работает, поэтому через сеть 0 devices, а напрямую - всё работает.

tiandrey ★★★★★ ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.