Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
MPD refusing connection. [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dartleader
n00b
n00b


Joined: 21 Apr 2019
Posts: 36

PostPosted: Wed Jul 17, 2019 1:16 am    Post subject: MPD refusing connection. [SOLVED] Reply with quote

Hello everyone, I am running MPD as my music server on my main box. The port I am using (6660) is listed as open when I scan ports on the localhost with nmap. However, when I attempt to connect to MPD with ncmpcpp or vimpc from my laptop, the connection is refused. Upon inspection with nmap, the port 6660 is closed when viewed from another computer on the same LAN. This was working correctly prior to a system update a couple months ago. I have checked the relevant dotfiles and the correct ports are specified.

I have tried adding the port to my iptables and accepting TCP connections but have had no success.

What should I try next?


Last edited by dartleader on Sat Aug 03, 2019 8:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14922

PostPosted: Wed Jul 17, 2019 1:43 am    Post subject: Reply with quote

Please show the output of ss -npl for port 6660 on whichever protocol(s) MPD uses. If I were to guess, I would say it is bound to localhost, so it can only be reached from localhost. This is a reasonable security default, so it is possible that upstream changed this on purpose to improve security of the default installation.
Back to top
View user's profile Send private message
dartleader
n00b
n00b


Joined: 21 Apr 2019
Posts: 36

PostPosted: Wed Jul 17, 2019 4:20 am    Post subject: Reply with quote

Output of ss -npl | ack 6660:

Code:
tcp  LISTEN 0      0                                       127.0.0.1:6660                   0.0.0.0:*                                                           
tcp  LISTEN 0      0                                           [::1]:6660                         *:*                                                           
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14922

PostPosted: Thu Jul 18, 2019 1:28 am    Post subject: Reply with quote

That confirms it. Your server is now listening on localhost, so the kernel will not permit connections from remote systems. To fix this, tell MPD to bind to the wildcard address instead of localhost.
Back to top
View user's profile Send private message
dartleader
n00b
n00b


Joined: 21 Apr 2019
Posts: 36

PostPosted: Thu Jul 18, 2019 6:10 pm    Post subject: Reply with quote

Hu wrote:
That confirms it. Your server is now listening on localhost, so the kernel will not permit connections from remote systems. To fix this, tell MPD to bind to the wildcard address instead of localhost.
Could you direct me to where I could learn to do that? All the results I've found by searching for wildcards just points me to command-line globbing and wildcard expansion, nothing about IP addresses and config files. I have tried changing the host from "localhost" to "*" without success.

Thank you for your time.
Back to top
View user's profile Send private message
BT
Guru
Guru


Joined: 13 Jun 2004
Posts: 311

PostPosted: Fri Jul 19, 2019 12:46 am    Post subject: Reply with quote

It seems that MPD 0.21 listens on $XDG_RUNTIME_DIR/mpd/socket by default if no bind_to_address setting exists. See the MPD listeners documentation for more information.

I don't know if MPD can bind to a wildcard address. Instead you can add the following to the MPD configuration file:
Code:
bind_to_address         "192.168.0.1"

Change 192.168.0.1 to the IP address of the system running MPD.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14922

PostPosted: Fri Jul 19, 2019 1:20 am    Post subject: Reply with quote

If MPD can take a specific address to bind, then passing 0.0.0.0 as the address to bind should be a wildcard bind.
Back to top
View user's profile Send private message
dartleader
n00b
n00b


Joined: 21 Apr 2019
Posts: 36

PostPosted: Sat Aug 03, 2019 8:07 pm    Post subject: Reply with quote

Hu wrote:
If MPD can take a specific address to bind, then passing 0.0.0.0 as the address to bind should be a wildcard bind.
Upon binding the address to 0.0.0.0 in /etc/mpd.conf, I get the following results from ss -npl | ack 6660:

Code:
tcp  LISTEN 0      0                                         0.0.0.0:6660                   0.0.0.0:*


Now my mpd server is working as expected, thank you for your help!

Although, now I am having an unrelated issue with ncmpcpp, addressed in this thread:

https://forums.gentoo.org/viewtopic-t-1100192-highlight-.html[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
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