View previous topic :: View next topic |
Author |
Message |
luca066
Joined: 01 Dec 2011 Posts: 42
|
Posted: Wed Jun 17, 2015 10:05 am Post subject: authentication using url |
|
|
Hello,
I know that authentication using an url works, but it is not working on my server and I don't know why (Icecast is running on a Windows server).
This is the mount configuration:
Code: |
<relay>
<server>localhost</server>
<port>XXXX</port>
<mount>/</mount>
<local-mount>/mount_test</local-mount>
<on-demand>0</on-demand>
<relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<mount>
<mount-name>/mount_test</mount-name>
<password>xxxxx</password>
<max-listeners>100</max-listeners>
<stream-description>AUTH Test</stream-description>
<authentication type="url">
<option name="mount_add" value="http://www.domain1.com/auth_ice/dummy.php"/>
<option name="mount_remove" value="http://www.domain1.com/auth_ice/dummy.php"/>
<option name="listener_add" value="http://www.domain1.com/auth_ice/add_listener.php"/>
<option name="listener_remove" value="http://www.domain1.com/auth_ice/dummy.php"/>
<option name="username" value="user"/>
<option name="password" value="pass"/>
<option name="auth_header" value="icecast-auth-user: 1"/>
<option name="timelimit_header" value="icecast-auth-timelimit:"/>
</authentication>
</mount>
|
And this is the php script (the script is on a different server, and on a different domain of the icecast server).
To debug this issue I've added some rows to write on a text file all the variables coming from the POST:
Code: |
<?php
$action = $_POST["action"];
$server = $_POST["server"];
$port = $_POST["port"];
$client = $_POST["client"];
$mount = $_POST["mount"];
$port = $_POST["port"];
$u = $_POST["user"];
$p = $_POST["pass"];
$ip = $_POST["ip"];
$agent = $_POST["agent"];
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, "begin\n");
fwrite($myfile, $u);
fwrite($myfile, $p);
fwrite($myfile, $action);
fwrite($myfile, $server);
fwrite($myfile, $port);
fwrite($myfile, $client);
fwrite($myfile, $mount);
fwrite($myfile, $ip);
fwrite($myfile, $agent);
fwrite($myfile, "end\n");
fclose($myfile);
if ($userid == "ACCOUNT" && $password == "DEMO") {
header("icecast-auth-user: 1");
} else {
header("icecast-auth-user: 0");
}
?>
|
On the debug file I see all the parameters, but userid and password are empty.
And, $mount variable has got the mount name with userid and password used on the url of the media player.
On VLC I use http://icecast_url/mount_test?userid=ACCOUNT&password=DEMO
On $mount I see: /mount_test?userid=ACCOUNT&password=DEMO
So, it seems that Icecast is not getting the userid and the password from the url used by VLC.
What am I doing wrong?
Thanks for your help
Luca |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Jun 17, 2015 10:50 pm Post subject: |
|
|
that format is not http basic auth, the style for basic auth is
http://user:password@host:port/mount_test
you can have the format you specified but you will have to split out the required query parameters in the php from the mount setting. After all there is no requirment for the query parameters to be userid and password, they could be
http://...?where=US&who=me&key=123456789
karl. |
|
Back to top |
|
|
luca066
Joined: 01 Dec 2011 Posts: 42
|
Posted: Wed Jun 17, 2015 10:57 pm Post subject: |
|
|
Hi Karl,
thanks for your answer.
It's clear to me that if I split the mount information, I get userid and password and everything else I write in the url.
I've set the <authentication type="url"> , so I was thinking that userid and password have to be set on the url after the mount name.
I've tried to use the basic auth, but my customer use Windows Media Player that doesn't support http://userid:password@server/mount
While seems to be working with http://server/mount?userid=user&password=pass
Luca |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Jun 18, 2015 7:31 am Post subject: |
|
|
the basic auth style for setting user and pass has always been a case of not quite implemented right in win32. To avoid some stupid trickery they disabled the whole feature. You should get a 401 response to open a user/pass word box though.
karl. |
|
Back to top |
|
|
luca066
Joined: 01 Dec 2011 Posts: 42
|
Posted: Thu Jun 18, 2015 8:35 am Post subject: |
|
|
Thank you Karl,
using the mount variable I'm able to manage this situation.
Thanks
Luca |
|
Back to top |
|
|
|