Commit 3b857f78 authored by Marvin Scholz's avatar Marvin Scholz
Browse files

Updated trunk docs

parent a8f2d0d3
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Interface - Icecast Docs</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../css/theme.css" type="text/css" />
<link rel="stylesheet" href="../css/theme_extra.css" type="text/css" />
<link rel="stylesheet" href="../css/highlight.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script type="text/javascript" src="../js/highlight.pack.js"></script>
<script src="../js/theme.js"></script>
<style>
body {font-size: 90%;}
pre, code {font-size: 100%;}
h3, h4, h5, h6 {color: #2980b9; font-weight: 300}
</style>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-nav-search">
<a href=".." class="icon icon-home"> Icecast Docs</a>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1 ">
<a class="" href="..">Introduction</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../basic_setup">Basic Setup</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../config_file">Configuration File</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../server_stats">Server Statistics</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../auth">Authentication</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../relaying">Relaying</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../yp">Listing in a YellowPage Directory</a>
</li>
<li class="toctree-l1 current">
<a class="current" href=".">Admin Interface</a>
<ul>
<li class="toctree-l3"><a href="#admin-functions-mount-specific">Admin Functions (mount specific)</a></li>
<li><a class="toctree-l4" href="#metadata-update">Metadata Update</a></li>
<li><a class="toctree-l4" href="#fallback-update">Fallback Update</a></li>
<li><a class="toctree-l4" href="#list-clients">List Clients</a></li>
<li><a class="toctree-l4" href="#move-clients-listeners">Move Clients (Listeners)</a></li>
<li><a class="toctree-l4" href="#kill-client-listener">Kill Client (Listener)</a></li>
<li><a class="toctree-l4" href="#kill-source">Kill Source</a></li>
<li class="toctree-l3"><a href="#admin-functions-general">Admin Functions (general)</a></li>
<li><a class="toctree-l4" href="#stats">Stats</a></li>
<li><a class="toctree-l4" href="#list-mounts">List Mounts</a></li>
<li class="toctree-l3"><a href="#web-based-admin-interface">Web-Based Admin Interface</a></li>
<li><a class="toctree-l4" href="#advanced">Advanced</a></li>
</ul>
</li>
<li class="toctree-l1 ">
<a class="" href="../win32">Windows Specific</a>
</li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="..">Icecast Docs</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="..">Docs</a> &raquo;</li>
<li>Admin Interface</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">
<p>This section contains information about the admin interface of Icecast. Through this interface the user can manipulate many server features. From it you can gather statistics, move listeners from one mountpoint to another, disconnect connected sources or listeners and many other activities. Each function is enumerated here as well as an example usage of the function.</p>
<p>Each of these functions requires HTTP authentication via the appropriate username and password. For mount-specific functions, you may use either the <code>&lt;admin-username&gt;</code> and <code>&lt;admin-password&gt;</code> specified in the Icecast config file, or the username and password specified for that mountpoint (if any). For general functions (not specific to a single mountpoint), you must use the admin username and password.</p>
<h1 id="admin-functions-mount-specific">Admin Functions (mount specific)</h1>
<p>All these admin functions are mount specific in that they only apply to a particular mountpoint
(as opposed to applying to the entire server). Each of these functions requires a mountpoint to
be specified as input.</p>
<h2 id="metadata-update">Metadata Update</h2>
<p>This function provides the ability for either a source client or any external program to update
the metadata information for a particular mountpoint.</p>
<p>Example:<br />
<code>/admin/metadata?mount=/stream&amp;mode=updinfo&amp;song=ACDC+Back+In+Black</code></p>
<h2 id="fallback-update">Fallback Update</h2>
<p>This function provides the ability for either a source client or any external program to update the
“fallback mountpoint” for a particular mountpoint. Fallback mounts are those that are used in the even
of a source client disconnection. If a source client disconnects for some reason that all currently
connected clients are sent immediately to the fallback mountpoint.</p>
<p>Example:<br />
<code>/admin/fallbacks?mount=/stream.ogg&amp;fallback=/fallback.ogg</code></p>
<h2 id="list-clients">List Clients</h2>
<p>This function lists all the clients currently connected to a specific mountpoint. The results are sent
back in XML form.</p>
<p>Example:<br />
<code>/admin/listclients?mount=/stream.ogg</code></p>
<h2 id="move-clients-listeners">Move Clients (Listeners)</h2>
<p>This function provides the ability to migrate currently connected listeners from one mountpoint to another.
This function requires 2 mountpoints to be passed in: mount (the <em>from</em> mountpoint) and destination
(the <em>to</em> mountpoint). After processing this function all currently connected listeners on mount will
be connected to destination. Note that the destination mountpoint must exist and have a sounce client
already feeding it a stream.</p>
<p>Example:<br />
<code>/admin/moveclients?mount=/stream.ogg&amp;destination=/newstream.ogg</code></p>
<h2 id="kill-client-listener">Kill Client (Listener)</h2>
<p>This function provides the ability to disconnect a specific listener of a currently connected mountpoint.
Listeners are identified by a unique id that can be retrieved by via the “List Clients” admin function.
This id must be passed in to the request via the variable <code>id</code>. After processing this request, the listener will no longer be
connected to the mountpoint.</p>
<p>Example:<br />
<code>/admin/killclient?mount=/mystream.ogg&amp;id=21</code></p>
<h2 id="kill-source">Kill Source</h2>
<p>This function will provide the ability to disconnect a specific mountpoint from the server. The mountpoint
to be disconnected is specified via the variable <code>mount</code>.</p>
<p>Example:<br />
<code>/admin/killsource?mount=/mystream.ogg</code></p>
<h1 id="admin-functions-general">Admin Functions (general)</h1>
<h2 id="stats">Stats</h2>
<p>The stats function provides the ability to query the internal statistics kept by the Icecast server.
Almost all information about the internal workings of the server such as the mountpoints connected,
how many client requests have been served, how many listeners for each mountpoint, etc. are available
via this admin function.</p>
<p>Example:<br />
<code>/admin/stats</code></p>
<h2 id="list-mounts">List Mounts</h2>
<p>The list mounts function provides the ability to view all the currently connected mountpoints.</p>
<p>Example:<br />
<code>/admin/listmounts</code></p>
<h1 id="web-based-admin-interface">Web-Based Admin Interface</h1>
<p>As an alternative to manually invoking these URLs, there is a web-based admin interface.
This interface provides the same functions that were identified and described above but presents them in
a nicer way. The web-based admin Interface to Icecast is shipped with Icecast provided in the
<code>admin</code> directory and comes ready to use.</p>
<p>The main path for the Web-Based Admin Interface is:<br />
<code>/admin/stats.xsl</code></p>
<h2 id="advanced">Advanced</h2>
<p>The web-based admin interface is a series of XSL-Transform files which are used to display all the XML obtained
via the URL admin interface. This can be changed and modified to suit the user's need. Knowledge of
XSLT and transformations from XML to HTML are required in order to make changes to these scripts.</p>
<p><strong>Modification of existing XSLT transforms in <code>/admin</code> is allowed, but new files cannot be created here.</strong></p>
<p>Creation of new XSLT transforms as well as modification of existing transforms is allowed in the <code>/web</code> directory.
These work using the document returned by the <code>/admin/stats</code> endpoint.<br />
To see the XML document that is applied to each admin XSLT, just remove the .xsl in your request
(i.e. <code>/admin/listclients</code>). You can then code your XSL transform accordingly.</p>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../win32" class="btn btn-neutral float-right" title="Windows Specific"/>Next <span class="icon icon-circle-arrow-right"></span></a>
<a href="../yp" class="btn btn-neutral" title="Listing in a YellowPage Directory"><span class="icon icon-circle-arrow-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
<!-- Copyright etc -->
</p>
</div>
Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" style="cursor: pointer">
<span class="rst-current-version" data-toggle="rst-current-version">
<span><a href="../yp" style="color: #fcfcfc;">&laquo; Previous</a></span>
<span style="margin-left: 15px"><a href="../win32" style="color: #fcfcfc">Next &raquo;</a></span>
</span>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Authentication - Icecast Docs</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../css/theme.css" type="text/css" />
<link rel="stylesheet" href="../css/theme_extra.css" type="text/css" />
<link rel="stylesheet" href="../css/highlight.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script type="text/javascript" src="../js/highlight.pack.js"></script>
<script src="../js/theme.js"></script>
<style>
body {font-size: 90%;}
pre, code {font-size: 100%;}
h3, h4, h5, h6 {color: #2980b9; font-weight: 300}
</style>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-nav-search">
<a href=".." class="icon icon-home"> Icecast Docs</a>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1 ">
<a class="" href="..">Introduction</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../basic_setup">Basic Setup</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../config_file">Configuration File</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../server_stats">Server Statistics</a>
</li>
<li class="toctree-l1 current">
<a class="current" href=".">Authentication</a>
<ul>
</ul>
</li>
<li class="toctree-l1 ">
<a class="" href="../relaying">Relaying</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../yp">Listing in a YellowPage Directory</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../admin_interface">Admin Interface</a>
</li>
<li class="toctree-l1 ">
<a class="" href="../win32">Windows Specific</a>
</li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="..">Icecast Docs</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="..">Docs</a> &raquo;</li>
<li>Authentication</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">
<hr />
<p>title: Authentication
version: 2.4.99.1</p>
<hr />
<p>{::options auto_ids="true" /}</p>
<div class="article" markdown="1">
# Listener Authentication
Listener authentication is a feature of Icecast which allows you to secure a certain mountpoint such that in order to listen,
a listener must pass some verification test. With this feature, a simple pay-for-play operation (eg. user/pass), or some filtering
based on the listener connection can be performed. This section will show you the basics of setting up and maintaining this component.
To define listener authentication, a group of tags are specified in the `<mount>` group relating to the mountpoint. This means
that authentication can apply to listeners of source clients or relays.
The following authentication mechanisms can apply to listeners:
<!-- FIXME -->
* htpasswd: lookup a named file for a matching username and password
* URL: issue web requests (eg. PHP) to match authentication
The listener authentication within a specified mount in the icecast XML configuration can apply to either to a stream from a
source client, relay or a webroot based file. They do apply to intro files or fallback streams.
</div>
<div class="article" markdown="1">
# htpasswd Listener Authentication
In order to use listener authentication, you __must__ configure a mount specific option. This means that you have to provide
a `<mount>` section in the main icecast config file. The following is an example:
<!-- FIXME -->
{% highlight xml %}
<mount>
<mount-name>/example.ogg</mount-name>
<authentication type="htpasswd">
<option name="filename" value="myauth"/>
<option name="allow_duplicate_users" value="0"/>
</authentication>
</mount>
{% endhighlight %}
To support listener authentication you __must__ provide at a minimum `<mount-name>` and `<authentication>`.
The `mount-name` is the name of the mountpoint that you will use to connect your source client with and `authentication` configures
what type of Icecast authenticator to use.
Currently, only `htpasswd` and `url` are implemented. Each authenticator has a variable number of options that are required and
these are specified as shown in the example.
The htpasswd authenticator requires a few parameters:
The first, `filename`, specifies the name of the file to use to store users and passwords. Note that this file need not exist
(and probably will not exist when you first set it up).
Icecast has built-in support for managing users and passwords via the web admin interface. More on this later in this section.
The second option, `allow_duplicate_users`, if set to `0`, will prevent multiple connections using the same username. Setting this
value to `1` will enable mutltiple connections from the same username on a given mountpoint.
Note there is no way to specify a “max connections” for a particular user.
Icecast supports a mixture of streams that require listener authentication and those that do not.
## Configuring Users and Passwords
Once the appropriate entries are made to the config file, connect your source client (using the mountpoint you named in
the config file). To configure users and passwords for this stream you must use the web-based admin interface. Navigate to
`http://server:ip/admin/stats.xsl` to begin. If you have configured everything properly, you should see a screen like the
following:
![Screenshot of Admin Stats](img/listener_auth1.png)
You will see a lock in front of all mountpoint configured for listener authentication. Also note that this page will
only show _connected_ mountpoints.
To manage users and passwords for this mountpoint, click on the “Manage Authentication” link. The following screen will be shown:
![Screenshot of Manage Authentication](img/listener_auth2.png)
This screen will show all the users configured for this mountpoint. Adding users is as simple as entering a username and password
in the fields and clicking “Add”.
Note that usernames __must__ be unique and there are __no__ restrictions on passwords. You can delete users by clicking the appropriate
delete link next to each user.
## Finishing it all off
Ok, so you've created your users, and you have everything setup properly, how do your users login? Well, we've provided a simple login
form that you can use for this purpose. This page (`http://server:port/auth.xsl`) will bring up a form that users can use to enter their
username and password.
![Screenshot of Auth Page](img/listener_auth3.png)
This page will serve a m3u with the username and password and in most cases should open the correct media player and begin playing
your stream.
</div>
<div class="article" markdown="1">
# URL
Authenticating listeners via the URL method involves Icecast, when a listener connects, issuing requests to a web server
and checking the response headers. If a certain header is sent back then the listener connecting is allowed to continue,
if not, an error is sent back to the listener.
The URLs specified will invoke some web server scripts like PHP to do any work that they may choose to do. All that is
required of the scripting language is that POST information can be handled and response headers can be sent back.
libcurl is used for the requesting so https connections may be possible, but be aware of the extra overhead involved.
The useragent sent in each curl request will represent the Icecast server version. The response headers will depend on
whether the listener is to be accepted. In the case of rejection, a response header
`Icecast-Auth-Message: Reason`
should also be returned for placing in the log files.
In order to use URL based listener authentication, you __must__ configure a mount specific option. This means that you
have to provide a `<mount>` section in the main Icecast config file. The following shows the list of options available:
<!-- FIXME -->
{% highlight xml %}
<mount>
<mount-name>/example.ogg</mount-name>
<authentication type="url">
<option name="mount_add" value="http://auth.example.org/stream_start.php"/>
<option name="mount_remove" value="http://auth.example.org/stream_end.php"/>
<option name="listener_add" value="http://auth.example.org/listener_joined.php"/>
<option name="listener_remove" value="http://auth.example.org/listener_left.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:"/>
<option name="headers" value="x-pragma,x-token"/>
<option name="header_prefix" value="ClientHeader."/>
<option name="stream_auth" value="http://auth.example.org/source.php"/>
</authentication>
</mount>
{% endhighlight %}
The options are described below in more detail, each of which is optional, but in each case, within the POST data,
the value for each setting is encoded.
<!-- FIXME -->
## mount_add
This URL is for informing the auth server of a stream starting. No listener information is passed for this,
but it can be used to initialise any details the auth server may have.
### POST Details
action
: `mount_add`
mount
: the mountpoint starting up
server
: the server name (`<hostname>`)
port
: the server port
### Example
`action=mount_add&mount=/live&server=icecast.example.org&port=8000`
## mount_remove
This URL is for informing the auth server of a stream finishing, like the start option, no listener details
are passed.
### POST Details
action
: `mount_remove`
mount
: the mountpoint being removed
server
: the server name (`<hostname>`)
port
: the server port
### Example
`action=mount_remove&mount=/live&server=icecast.example.org&port=8000`
## listener_add
This is most likely to be used if anything. When a listener connects, before anything is sent back to them, this
request is processed. The default action is to reject a listener unless the auth server sends back a response header
which may be stated in the `header` option.