Help - Search - Members - Calendar
Full Version: foo_controlserver
Hydrogenaudio Forums > Hosted Forums > foobar2000 > 3rd Party Plugins - (fb2k)
Mr_Rabid_Teddybear
I just found and tried foo_controlserver. [EDIT] The downloadsite is down now, but you can find it here. [/EDIT]
QUOTE
This is a simple plugin that acts as a server to control Foobar2000. Connect with a simple telnet client and execute ASCII commands to play tracks, search the playlist, and many other tasks.

It's quite brilliant for me since I'm using the Oddcast plugin and Icecast2 server with foobar2000. That way I also got a nice control interface from a remote location with a Windows telnet client like PuTTY. Very nifty smile.gif

But there's still a couple of features which I am missing and would further enhance it's usability for me - if they are possible to implement, that is:

1) Ability to define a password for logging onto a session. Like it is now anybody that got my IP and knows which port I'm using for it could control fb2k's playback. So if one could define a password necessary for starting a session that would be good.

2) Support for the playbackmodes added by kode54's foo_shuffle, like "shuffle", "shuffle album", etc.

3) Ability to list and switch between open playlists.

Thanks! cool.gif
foosion
QUOTE(Mr_Rabid_Teddybear @ Jun 7 2004, 11:20 PM)
1) Ability to define a password for logging onto a session. Like it is now anybody that got my IP and knows which port I'm using for it could control fb2k's playback. So if one could define a password necessary for starting a session that would be good.

You're already using PuTTY, so why not set up an SSH server on your machine, and connect to foo_controlserver through an SSH tunnel? Sending a password over an unencrypted connection is insecure. cool.gif
Mr_Rabid_Teddybear
QUOTE(foosion @ Jun 9 2004, 01:30 PM)
QUOTE(Mr_Rabid_Teddybear @ Jun 7 2004, 11:20 PM)
1) Ability to define a password for logging onto a session. Like it is now anybody that got my IP and knows which port I'm using for it could control fb2k's playback. So if one could define a password necessary for starting a session that would be good.

You're already using PuTTY, so why not set up an SSH server on your machine, and connect to foo_controlserver through an SSH tunnel? Sending a password over an unencrypted connection is insecure. cool.gif

Sure, foosion. tongue.gif Can I do that? So good. It would solve my most important problems here (telnet is unencrypted, right?). All I needs to figure out now is how to do that.... But I got some enlightened friends, and this forum.... maybe I could work it out (SSH server with tunnel, yes, googeling is good, yes, yes.... hmmmm..............)
Mr_Rabid_Teddybear
OK. I give up. smile.gif
I am running my foobar2000 on a XPsp1 machine, so I downloaded and installed and managed to set up this version of the OpenSSH server for Windows.
If I then close port 3333 (or whatever port I got foo_controlserver listening on) in my firewall from internett access it should only be possible to reach it on my local machine/network, right? (Which I trust.) So from my position away (anywhere on the internet) I can access my SSH server on port 22 with all the encryption strength of SSH, password and the works. I can not access telnet *myIP* 3333 from remote position, so it's secured. So far, soo good. Problem is simply: How do I dig that tunnel? How do I go about to get from logging on to the OpenSSH server to entering foo_controlserver and it's controls? I just can't figure it out....
Mr_Rabid_Teddybear
With a little help from my friends.... tongue.gif I finally figured this out. (Thanks to the stout-drinking fellowship of BLUG for the advices that solved the mystery!)
Well I might as well post a description, with the slight possibility it could be useful for someone else:

Kind of half-baked tutorial...

OK. What I want to do is to be able to sit at a computer AWAY (anywhere on the internet) and control my stream that's played by foobar2000 and streamed out by Icecast2 from my computer HOME. I can control fb2k playback with foo_controlserver, but since it's over the internet I want a secure channel so that noone else can hijack my stream.

Well first I have fb2k up and running with foo_controlserver listening on port 3333 (where it listens by default, look in Preferences to change). I now have to CLOSE port 3333 and OPEN port 22 (SSH server listens on port 22) in the firewall that separates my machine HOME/my private network from the internet. This is essential!

Then I have to set up the SSH server. In my case I chose to set it up on my computer HOME where fb2k, the Icecast2 server and the music files resides. I'm running XPsp1 on HOME. Therfore I chose the minimal Cygwin installation of OpenSSH as linked to in the post above. (Later I'm gonna build a dedicated SSH server box for my private network that's gonna run on some true Linux/BSD, but I haven't gotten that far yet.) Installation and setup of different SSH servers might differ, so read the manual.

In my case (using SSHWindows) it was simply a matter of running the installer, then create the group and passwd files in /etc/. This is very well described in readme.txt in /docs/, so I won't go any closer into it here.
EDIT: On second thought, since this have turned into a kind of newbie tutorial, I will give the example of how I did it anyways (in my example I use the -l switch for local, you can also use, or replace it with, the -d switch for domain. If you use both you must edit out duplicate lines afterwards. For me running -l was enough). OK. Let's set it up for user "joefoo":
First you must open a command prompt (Run > cmd.exe). Then you must CD into "installpath"\OpenSSH\bin and run first this command:
CODE
mkgroup -l >> ..\etc\group

and then this command:
CODE
mkpasswd -l -u joefoo >> ..\etc\passwd

NOTE: If you will use SSHWindows, you must specify user and password for the account (e.g. "joefoo") that you want to use in Windows own Controlpanel > User Accounts before creating the group and passwd files if your gonna have a password (if you havent done so already). (It's possible that you can use keypairs and such instead, in that case you'll have to read up on it yourself.)
NOTE2: SSHWindows will choke if there are more than one instance of cygwin1.dll in %PATH%. Use SEARCH and delete the older one(s) to remedy this. SSHWindows will also choke if you have the regular Cygwin installation installed on your box. In that case use their OpenSSH server instead. Also: you should check if quietcmd.bat found in /bin/ have the right path to cmd.exe. On my XP box it was wrong ("c:\winnt\system32" instead of "c:\windows\system32"). Edit if necessary.

IMPORTANT: Now you'll have to edit the sshd_config file found in /etc/ and uncomment the line "AllowTcpForwarding yes" (this will look fairly the same on all SSH servers I think). This option MUST be enabled! There are also other options in that configfile that might be of interest (like "ClientAliveInterval"?). For further explanation of the meaning of the switches you can look e.g. here.
ELABORATION: "edit" means with notepad or any text editor. Preferably something like Vim or EditPlus that, unlike notepad, will display the file correctly and respect it's native format when saving it back (it's those Unix - Windows LF - CR/LF line ending issues again...). And make sure no extension are added to the file when saving it back!
"uncomment" means remove the # from the beginning of a line to make it active.
"/etc/" means the directory named etc in the Unix-structure of the installation.

Then you simply have to start the SSH server. For me that meant typing in "net start opensshd" at Command Promt. Or making batch files:
CODE
@echo off
net start opensshd
pause
exit
CODE
@echo off
net stop opensshd
pause
exit

In other SSH server implementations much might be different (?)

-------------------------------------------

Well. Then I leave the house and go traveling. Suddenly I'm sitting by the machine AWAY. AWAY is a Windows machine and I'm gonna use PuTTY as the client program.

First you start one Putty session. In the startup panel under Session you simply choose Protocol "SSH", Port "22" and in the Host Name field you'll have to enter HOME's IP or domain name (in my case a DynDNS domain), e.g. "joefoo.dnsalias.com".
Then you'll have to go to Connection > SSH > Tunnels > Port forwarding:
Of the switches Local/Remote/Dynamic choose "Local".
In Source port enter: "3333" [without the quotes - that goes for all of this] (BTW: you can choose any arbitrary port really. It must be higher than 1024, and should be above 3000).
In Destination enter: "localhost:3333" (or whatever port foo_controlserver are listening on at HOME. It must be higher than 1024, and should be above 3000. If foo_controlserver sits on a different machine than the SSH server on your local network you must enter the local network IP for the machine foo_controlserver sits on instead of localhost, e.g. "10.0.0.4:3333").
In some cases, if e.g. more than two machines are involved you might have to tick one or both of the "Local ports accept connections from other hosts" and "Remote ports do the same" options in order to make it work. Experiment, or just tick them both to be on the safe (but maybe not quite as secure???) side....
Now you MUST remember to click "Add", so that you see the field:
QUOTE
L3333       localhost:3333

Then you can just press "Open" to start the session. Log on to HOME the usual way (username, password and such). Then if you click in uppermost left corner of PuTTY window you can choose "Event log" to check whether the tunnel really are established. You should see something like this in there:
QUOTE
2004-06-19 18:47:19 Local port 3333 forwarding to localhost:3333

Now just start a second PuTTY session and minimize (not close!) the first PuTTY session window.

In the new startup panel, under "Session" choose:
Hostname "localhost" Protocol "Telnet" Port "3333" (Or whatever port you earlier specified for "Source port").

Other options you might want to take a look at:
Connection; Seconds beween keepalives: I set this to 30. If you don't enter anything here your connection will get killed after a while, and you must logon again.
Connection > Telnet: Unchecking "Return key sends telnet New Line instead of ^M" seems to improve on foo_controlservers ability to take orders....
Window; Lines of scrollback: How long are your playlist? I just as well sat this to 10000.
Window > Translation: If you want those non-ASCII characters in your playlist to display correctly, choose UTF-8.
Window > Apperance: Font?
(Under PuTTY menu you can also change these settings during session with "Change settings...")

Now just press "Open", and TADA! youre logged onto foo_controlserver through a secure tunnel over the internet!

cool.gif
seanyseansean
Mate, i'm sorry we were no help with your problem, but I share your pain with VPNs. We have an XP machine setup at work to dialin to our customers networks. Obviously, some won't let us in over the internet, so we need to do a direct phone connection rolleyes.gif , via a modem. They all use different VPN clients and they don't interoperate very well. I know full well that if I run the securemote install, we can't get to one customer via PC Anywhere. wtf?!!?!!
Mr_Rabid_Teddybear
Why should you be sorry? I'm just happy I did figure out how to make this work in the end biggrin.gif
Ofcourse this setup won't work everywhere. Some businesses and uni's and such probably sport firewalls that will refuse this sort of traffic. But it seems to work fine with normal homeusers firewalls. At least here in Norway. Encrypted lines (SSH) are legal here too, as far as I know... In some countries this might be against the law (?)

Anyways, that took care of point 1) on my wishlist. smile.gif

And now for something completely different, a BUGREPORT (uuuuhuuuhh):

foo_controlserver seems currently to exhibit the same behavior that happend with foo_scroll after 0.8.1 (thread here) and that musicmusic later fixed, namely that it lags one behind. Meaning: foo_controlserver displays (in my PuTTY or CMD window, or probably any terminal) the the last played track instead of the currently playing track.

Another issue (that doesn't necessarily have to be foo_controlservers fault): often I have to issue a command on the commandline 2-3 times before it "takes" (i.e. returns requested action).

It's probably quite lame to fill your own thread up with your own postings unsure.gif - but what the heck, I'll take my chances. After all I've provided both a feature request and a small tutorial as well as a bugreport.... It's not like I'm just bumping it, or.... wink.gif
Anyways I'm probably not getting anywhere further with this, as foo_controlservers author; Bluestat seems to be unavailable. His total of 1 postings imply that he's not too active on these forums. I tried to e-mail him from the forum at the time I started this thread, but no reply. Neither are there any sourcecode to be found or any clue as to where the author might be hiding out....
So I guess this marks the end of this attempt unless the author resurfaces, or anybody else got any other ideas.....

rolleyes.gif

EDIT: Downloadsite for foo_controlserver are currently down (another sign that it's been abandoned?). Therefor it's currently uploaded here.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.