You are not logged in.

#1 2013-05-22 10:59:34

stefanwilkens
Member
From: Enschede, the Netherlands
Registered: 2008-12-10
Posts: 624

[SOLVED] Samba SWAT and xinetd.d - connection refused

Hello,

I'm setting up SWAT (http://www.samba.org/samba/docs/man/Sam … /SWAT.html) and ran into a small issue with xinet.d.

As I understand it, xinetd reads config from /etc/xinetd.d/* as configured in /etc/xinetd.conf:

#
# /etc/xinetd.conf
#

 ....[snip]....

includedir /etc/xinetd.d/

Here's the xinetd.d file for swat:

service swat
{
        port                    = 1001
        socket_type             = stream
        wait                    = no
        user                    = root
        server                  = /usr/bin/swat
        log_on_success          += HOST DURATION
        log_on_failure          += HOST
        disable                 = no
}

Using systemctl, xinetd.service starts cleanly.

However, SWAT isn't available from 127.0.0.1 or any other originating source. The connection is simply refused. The fix is simple, adding the port / protocol / service to /etc/services.

...
swat        1001/tcp
...

The question: Why am I required to add the service to /etc/services at all? Shouldn't this be read from the /etc/xinetd.d/swat file?

Last edited by stefanwilkens (2013-05-22 13:21:01)


Arch i686 on Phenom X4 | GTX760

Offline

#2 2013-05-22 11:26:22

progandy
Member
Registered: 2012-05-17
Posts: 2,151

Re: [SOLVED] Samba SWAT and xinetd.d - connection refused

An entry in /etc/services should only be necessary if you want to use getportbyname("swat")
The manpage requires the entry. Maybe swat reads the port it uses from this file.

PS: With systemd, you should replace xinetd with a systemd socket unit and use a service to run swat.
https://bugs.archlinux.org/task/33268

Last edited by progandy (2013-05-22 11:32:47)

Offline

#3 2013-05-22 12:30:55

stefanwilkens
Member
From: Enschede, the Netherlands
Registered: 2008-12-10
Posts: 624

Re: [SOLVED] Samba SWAT and xinetd.d - connection refused

Well that was quick smile

Thanks for pointing me to the systemd files progandy, it seems the arch wiki hadn't caught up yet. I'll update the page.

The solution, for future readers:

1. Start the systemd service providing the socket:

# systemctl start swat.socket

Or, should you want to, enable this socket at boot time:

# systemctl enable swat.socket

SWAT is now available on http://127.0.0.1:901/ (locahost)

Should you want to make this available to external users, you should edit the swat.socket unit file:

/usr/lib/systemd/system/swat.socket

[Unit]
Description=SWAT Samba Web Admin Tool

[Socket]
ListenStream=127.0.0.1:901
Accept=true

[Install]
WantedBy=sockets.target
[/quote]

Replace

ListenStream=127.0.0.1:901

with

ListenStream=<ipadress>:901

Last edited by stefanwilkens (2013-05-22 12:37:12)


Arch i686 on Phenom X4 | GTX760

Offline

#4 2013-05-22 13:45:04

stefanwilkens
Member
From: Enschede, the Netherlands
Registered: 2008-12-10
Posts: 624

Re: [SOLVED] Samba SWAT and xinetd.d - connection refused

I've updated the wiki to reflect this, I encourage greater minds than my own to review it:
https://wiki.archlinux.org/index.php/Sa … .28SWAT.29


Arch i686 on Phenom X4 | GTX760

Offline

Board footer

Powered by FluxBB