0

On a physical server I have Apache and an WebDav server (PyWebDav3) running. This is a Ubuntu 14.04 server, so with all graphical tools.

The WebDav server is started with the default configuration :

davserver -D /tmp -n

The documentation shows a different host can be used :

-H, --host Host where to listen on (default: localhost)

I need a FQDN. So I execute :

bernard@p7:~$ hostname -f
p7
bernard@p7:~$ 

And used this when starting WebDav :

bernard@p7:/etc$ davserver -D /tmp -n -H "p7"
2016-07-27 15:42:32,716 WARNING Authentication disabled!
Listening on p7 (8008)

I can access this server local with Firefox with "localhost" in the URLbar. And remote with "192.168.1.101" in the URLbar.

Locally I can access in Firefox localhost:8008. And use Nautilus as WebClient as Fileserver. This works good.

I disabled the firewall on the server with ufw, and now the ufw status is disabled :

bernard@p7:~$ sudo ufw status
Status: inactive
bernard@p7:~$ 

I check which port is open with :

bernard@p7:~$ sudo netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1087/dnsmasq    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      701/cupsd       
tcp        0      0 127.0.1.1:8008          0.0.0.0:*               LISTEN      3465/python3    
tcp6       0      0 :::80                   :::*                    LISTEN      1131/apache2    
tcp6       0      0 ::1:631                 :::*                    LISTEN      701/cupsd       
bernard@p7:~$ 

So PyWebDav3 (which is a Python program) seems to be open on port 8008, but still, after using the "p7" as host only for 127.0.1.1

When using :

davserver -H 192.168.1.101 -D /tmp -n

And tested :

bernard@p7:~$ sudo netstat -plnt Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 1087/dnsmasq
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 701/cupsd
tcp 0 0 192.168.1.101:8008 0.0.0.0:* LISTEN 3743/python3
tcp6 0 0 :::80 :::* LISTEN 1131/apache2
tcp6 0 0 ::1:631 :::* LISTEN 701/cupsd
bernard@p7:~$

Remote telnet call :

bernard@vbox11:~$ telnet 192.168.1.101 8008
telnet: Unable to connect to remote host: Connection timed out
bernard@vbox11:~$

Remote I can not access 192.168.1.101:8008 with Firefox as client it seems to hang. Access with firefox is the same action which I did on the server itself, and did work on the server.

Then I check on the server what happened (message from PyWebDav3) :

Exception happened during processing of request from ('192.168.1.66', 42801)
Traceback (most recent call last):
  File "/usr/lib/python3.4/socketserver.py", line 617, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.4/socketserver.py", line 344, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.4/socketserver.py", line 673, in __init__
    self.handle()
  File "/usr/lib/python3.4/http/server.py", line 398, in handle
    self.handle_one_request()
  File "/usr/lib/python3.4/http/server.py", line 368, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "/usr/lib/python3.4/socket.py", line 374, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
----------------------------------------

So it seems the PyWebDav3 server is not able to handle the request.

In the server in /var/log/auth.log is do not see a message about this refusal.

Two questions :

  1. What causes this refusal
  2. How can this be solved
  • Welcome to SuperUser! Your question is about Ubuntu. You would probably get better expertise, and therefore better answers on Ask Ubuntu. Please flag your question to be migrated, or delete your question and re-ask it over there. Please do not cross-post (i.e. ask your question on Ask Ubuntu before you delete here or your question is migrated). You may ask your question there once you have deleted your question here. – fosslinux Jul 28 '16 at 1:18
0

There are 2 things to confirm/try: Firstly confirm that the port is actually open and being served to remote addresses. seems like in the following file there is a hostname defined..and im guessing you are not trying to access the webdav from a remote machine by typing "localhost" so i guess the solution is to:

Update the hostname to a valid FQDN by: sudo nano <pywebdavroot>/server/config.ini

You can confirm what address/port is open using netstat: sudo netstat -plnt

Let me know if this helps.

  • @Cornpadre I added the result of sudo netstat -plnt and the port seems to be open. I do not need a Fully Qualified Domain Name an IP address is for me sufficient. So a bit more info, but no solution yet. – Bernard Jul 27 '16 at 11:53
  • @Bernard you can see the difference between the 2 services in your pasted output apache is responding to "*:80" whereas the webdav software seems only to be responding to "127.0.0.1:8008" ... this matches what you have described as the problem...as such i would ask you to try the solution of setting a valid hostname in the config file and restarting the software. – cormpadre Jul 27 '16 at 11:56
  • @Compadre PyWebDav3 does not have a config.ini file But it can be configurated when starting. I followed the instruction in the documentation, but this created an error, see the added section. So it seems to be PyWebDav3 specific problem, not a firewall problem. – Bernard Jul 27 '16 at 12:19
  • @Bernard Looks like it to me...like it is only serving to localhost (or responding to requests to localhost from another perspective).... I would test to see if making the change in configuration will have desired outcome. It may yet work and should work locally and remote. – cormpadre Jul 27 '16 at 13:25
  • @Bernard One more thought, when you said you launch using davserver -D /tmp -n -H test I would like to confirm that in the remote web browser the address you are typing to access it is in fact "test" ...name resolution can be done via adding a line to /etc/hosts to test... but the request header counts not just the IP address.. as you had trouble connecting with telnet i guess this is not the case but worth confirming. – cormpadre Jul 27 '16 at 13:40
0

Try running it like to listen on all interfaces:

davserver -D /tmp -H 0.0.0.0 -n

I wasn't able to reproduce the problem as described initially, setting -H to my network interface did make it listen on the right ip:port as per netstat, similarly setting -H to my hostname works as well, but I do have my hosts file set up to ensure that the external ip is resolved by default, typically a hostname will resolve to localhost on a linux box.

Run as above on all interfaces, I have not problem wget'ting the server from another computer, which wasn't very interesting but did get an index page no worries, and the server logs the request. So it's working for me.

ps. I've the maintainer for Pywebdav3 which is a direct port of pywebdav to python 3, all features should work exactly that same on both projects.

  • @Andrew_Leech It seems to work. Remote I can open in Firefox 192.168.1.101:8008 An application is ask to open a dummy file with. I choose (as WebDav client) /usr/bin/nautilus The map is opened. So it seems to work. But the content remote and local is different. All local /tmp/mozilla_bernard0 paths are maded. No shared content as would be expected. – Bernard Jul 28 '16 at 9:41
  • Yep, it appears there's a problem uploading files from some clients, it doesn't work with the built in Finder client on OSX either. See here for more details: github.com/andrewleech/PyWebDAV3/issues/1 If this is different from the error printed on the console by your davserver instance, copy the exception text here. I'll try to look into the issue in the coming days. – coronafire Jul 28 '16 at 21:39
  • Yes the the error is different then what you shown. I added this in the original question. – Bernard Jul 29 '16 at 7:41
  • Hmm, unfortunately the stack trace is all in the python base library socket handling, ie doesn't really point to a part of the webdav server code with an issue. I'll have to try to do some testing at my end. – coronafire Jul 31 '16 at 2:14
  • Could you try again with pywebdav3 installed directly form my repo? "pip install github.com/andrewleech/PyWebDAV3/archive/master.zip" I've added a unit test which has identified a number of porting issues, now mostly fixed. – coronafire Aug 2 '16 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.