Commit bce1614e authored by Marvin Scholz's avatar Marvin Scholz

First commit of new Docs, still WIP

parents
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.
Each of these functions requires HTTP authentication via the appropriate username and password. For mount-specific functions, you may use either the `<admin-username>` and `<admin-password>` 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.
# Admin Functions (mount specific)
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.
## Metadata Update
This function provides the ability for either a source client or any external program to update
the metadata information for a particular mountpoint.
Example:
`/admin/metadata?mount=/stream&mode=updinfo&song=ACDC+Back+In+Black`
## Fallback Update
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.
Example:
`/admin/fallbacks?mount=/stream.ogg&fallback=/fallback.ogg`
## List Clients
This function lists all the clients currently connected to a specific mountpoint. The results are sent
back in XML form.
Example:
`/admin/listclients?mount=/stream.ogg`
## Move Clients (Listeners)
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 *from* mountpoint) and destination
(the _to_ 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.
Example:
`/admin/moveclients?mount=/stream.ogg&destination=/newstream.ogg`
## Kill Client (Listener)
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 `id`. After processing this request, the listener will no longer be
connected to the mountpoint.
Example:
`/admin/killclient?mount=/mystream.ogg&id=21`
## Kill Source
This function will provide the ability to disconnect a specific mountpoint from the server. The mountpoint
to be disconnected is specified via the variable `mount`.
Example:
`/admin/killsource?mount=/mystream.ogg`
# Admin Functions (general)
## Stats
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.
Example:
`/admin/stats`
## List Mounts
The list mounts function provides the ability to view all the currently connected mountpoints.
Example:
`/admin/listmounts`
# Web-Based Admin Interface
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
`admin` directory and comes ready to use.
The main path for the Web-Based Admin Interface is:
`/admin/stats.xsl`
## Advanced
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.
__Modification of existing XSLT transforms in `/admin` is allowed, but new files cannot be created here.__
Creation of new XSLT transforms as well as modification of existing transforms is allowed in the `/web` directory.
These work using the document returned by the `/admin/stats` endpoint.
To see the XML document that is applied to each admin XSLT, just remove the .xsl in your request
(i.e. `/admin/listclients`). You can then code your XSL transform accordingly.
\ No newline at end of file
---
title: Config File
version: 2.4.99.1
---
{::options auto_ids="true" /}
<div class="article" markdown="1">
# Overview
This section will describe each section of the config file and is grouped into the following sections:
- [Limits](#limits)
- [Authentication](#authentication)
- [Stream Directory Settings](#yp)
- [Misc Server settings](#misc)
- [TCP-Port settings](#ports)
- [Global HTTP Headers](#global-headers)
- [Relay settings](#relay)
- [Mount Specific settings](#mountsettings)
- [File path settings](#path)
- [Logging](#log)
- [Security](#security)
</div>
<div class="article" markdown="1">
# A word of warning
Please note that, especially for new Icecast users, editing the config file can be quite tricky.
**It is thus recommended to make a backup of the original config file and then start by just changing all
passwords, nothing else.** You can then use the source-password to bring up an initial stream and get more
comfortable with how Icecast works.
Should you need to customize the configuration, then make a backup of your working config file, before you
make any changes. If Icecast refuses to start it is in most cases due to a malformed config file. In such a
case running the following command should point out most XML syntax problems.
xmllint icecast.xml
Also check the Icecast error.log for additional hints in case of all problems!
</div>
<div class="article" markdown="1">
# Limits
{:#limits}
{% highlight xml %}
<limits>
<clients>100</clients>
<sources>2</sources>
<queue-size>102400</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>10</source-timeout>
<burst-on-connect>1</burst-on-connect>
<burst-size>65536</burst-size>
</limits>
{% endhighlight %}
This section contains server level settings that, in general, do not need to be changed.
Only modify this section if you know what you are doing.
clients
: Total number of concurrent clients supported by the server. Listeners are considered clients,
but so are accesses to any static content (i.e. fileserved content) and also any requests to
gather stats. These are max concurrent connections for the entire server (not per mountpoint).
sources
: Maximum number of connected sources supported by the server. This includes active relays and source clients
queue-size
: This is the maximum size (in bytes) of the stream queue. A listener may temporarily
lag behind due to network congestion and in this case an internal queue is maintained for the
listeners. If the queue grows larger than this config value, then it is truncated and any listeners
found will be removed from the stream. This will be the default setting for the streams which is
512k unless overridden here. You can override this in the individual mount settings which can be
useful if you have a mixture of high bandwidth video and low bitrate audio streams.
client-timeout
: This does not seem to be used.
header-timeout
: The maximum time (in seconds) to wait for a request to come in once the client has made a connection
to the server. In general this value should not need to be tweaked.
source-timeout
: If a connected source does not send any data within this timeout period (in seconds),
then the source connection will be removed from the server.
burst-on-connect
: This setting is really just an alias for burst-size. When enabled the burst-size is 64 kbytes and
disabled the burst-size is 0 kbytes. This option is deprecated, use `burst-size` instead.
burst-size
: The burst size is the amount of data (in bytes) to burst to a client at connection time. Like burst-on-connect,
this is to quickly fill the pre-buffer used by media players. The default is 64 kbytes which is a typical size used by
most clients so changing it is not usually required. This setting applies to all mountpoints unless overridden in
the mount settings. Ensure that this value is smaller than queue-size, if necessary increase queue-size to be larger
than your desired burst-size. Failure to do so might result in aborted listener client connection attempts, due to
initial burst leading to the connection already exceeding the queue-size limit.
</div>
<div class="article" markdown="1">
# Authentication
{:#authentication}
<!-- FIXME -->
{% highlight xml %}
<authentication>
<source-password>hackme</source-password>
<relay-user>relay</relay-user>
<relay-password>hackme</relay-password>
<admin-user>admin</admin-user>
<admin-password>hackme</admin-password>
</authentication>
{% endhighlight %}
<!-- FIXME -->
This section contains all the usernames and passwords used for administration purposes or to connect sources and relays.
<!-- FIXME -->
role
: contains role definitions
<!-- FIXME -->
source-password
: The unencrypted password used by sources to connect to Icecast. The default username for all
source connections is 'source' but this option allows to specify a default password. This and the
username can be changed in the individual mount sections.
<!-- FIXME -->
relay-user
: Used in the master server as part of the authentication when a slave requests the list of streams
to relay. The default username is `relay`
<!-- FIXME -->
relay-password
: Used in the master server as part of the authentication when a slave requests the list of streams to relay.
<!-- FIXME -->
admin-user/admin-password
: The username/password used for all administration functions. This includes retrieving statistics, accessing the web-based
administration screens, etc. A list of these functions can be found in the "Administration" section of the manual.
</div>
<div class="article" markdown="1">
# Stream Directory Settings
{:#yp}
{% highlight xml %}
<directory>
<yp-url-timeout>15</yp-url-timeout>
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
</directory>
{% endhighlight %}
This section contains all the settings for listing a stream on any of the Icecast YP Directory servers.
Multiple occurances of this section can be specified in order to be listed on multiple directory servers.
yp-url-timeout
: This value is the maximum time Icecast will wait for a response from a particular directory server.
The recommended value should be sufficient for most directory servers.
yp-url
: The URL which Icecast uses to communicate with the Directory server.
The value for this setting is provided by the owner of the Directory server.
</div>
<div class="article" markdown="1">
# Misc Server Settings
{:#misc}
## Server wide settings
{% highlight xml %}
<hostname>localhost</hostname>
<location>earth</location>
<admin>icemaster@localhost</admin>
<fileserve>1</fileserve>
<server-id>icecast 2.4.1</server-id>
{% endhighlight %}
hostname
: This is the DNS name or IP address that will be used for the stream directory lookups or
possibily the playlist generation if a Host header is not provided. While localhost is shown as
an example, in fact you will want something that your listeners can use.
location
: This sets the location string for this Icecast instance. It will be shown e.g in the web interface.
admin
: This should contain contact details for getting in touch with the server administrator.
Usually this will be an email address, but as this can be an arbitrary string it could also
be a phone number. This will be shown e.g. in the web interface.
fileserve
: This flag turns on the icecast2 fileserver from which static files can be served. All files
are served relative to the path specified in the `<paths><webroot>` configuration setting.
By default the setting is enabled so that requests for the static files needed by the status
and admin pages, such as images and CSS are retrievable.
server-id
: This optional setting allows for the administrator of the server to override the default
server identification. The default is `icecast` followed by a version number and most will
not care to change it however this setting will allow this. It is not recommended to use this
setting, unless you have very good reasons and know what you are doing.
</div>
<div class="article" markdown="1">
# TCP Port settings
{:#ports}
The following shows how you can specify the listening settings for the server.
## Generic port setup
The first shows an example of a common and simple way to define a listening socket:
{% highlight xml %}
<listen-socket>
<port>8000</port>
</listen-socket>
{% endhighlight %}
Using this as a basis we can extend this with an `<bind-address>` setting to limit which address Icecast
will listen on. Most will not need to use bind-address and often get confused by using it when there is
no need. Another possibility is to use an `<ssl>` boolean setting which informs Icecast that a secured
connection is to be used. A common use for using a secure connection would be for admin page access.
## Backward compatibility with Shoutcast source clients
The following shows how we can extend a single listen-socket to work with Shoutcast style source clients.
There are two issues shoutcast source clients have over icecast source clients, one is the lack of mountpoint
and the second is the requirement of two ports. Both of these issues are handled by a simple addition in
the listen-socket.
{% highlight xml %}
<listen-socket>
<port>8000</port>
<shoutcast-mount>/live.mp3</shoutcast-mount>
</listen-socket>
{% endhighlight %}
As before the port specified is allocated but this time the shoutcast-mount implicity defines a second
listening socket whose port number is always one higher than the port defined, this also informs icecast
of which mountpoint the shoutcast source client on this socket will be using. Using this approach you can
allow multiple shoutcast source clients to connect at the same time.
## Old style Shoutcast source client compatible setup (deprecated)
The following is just to show the longer approach to defining shoutcast compatability.
{% highlight xml %}
<shoutcast-mount>/live.nsv</shoutcast-mount>
<!-- You may have multiple <listen-socket> elements -->
<listen-socket>
<port>8000</port>
</listen-socket>
<listen-socket>
<port>8001</port>
<shoutcast-compat>1</shoutcast-compat>
</listen-socket>
{% endhighlight %}
Note that multiple listen-socket sections may be configured in order to have Icecast listen on multiple network
interfaces or multiple ports. If a bind-address is not specified for a particular listen-socket, then the socket
will be bound to all interfaces (including IPv6 if available). For most people, the bind-address option will not
be required and often confuses people.
port
: The TCP port that will be used to accept client connections.
bind-address
: An optional IP address that can be used to bind to a specific network
card. If not supplied, then it will bind to all interfaces.
ssl
: If set to 1 will enable HTTPS on this listen-socket. Icecast must have been compiled against openSSL to be able to do so.
shoutcast-mount
: An optional mountpoint setting to be used when shoutcast DSP compatible clients connect. The default global setting
is `/stream` but can be overridden here to use an alternative name which may include an extension that some clients
require for certain formats.
Defining this within a listen-socket group tells Icecast that this port and the subsequent port are to be used for
Shoutcast compatible source clients. This is an alternative to the `shoutcast-compat` approach as this implicitly
defines the second listening socket and allows for specifying multiple sockets using different mountpoints for
shoutcast source clients. The `shoutcast-mount` outside of a `listen-socket` group is the global setting of the
mountpoint to use.
shoutcast-compat
: This optional flag will indicate that this port will operate in Shoutcast compatibility mode. Due to major differences
in the source client connection protocol, if you wish to use any of the shoutcast DJ tools, you will need to configure
at least one socket as shoutcast-compatible. Note that when in this mode, only source clients (and specifically shoutcast
source clients) will be able to attach to this port. All listeners may connect to any of the ports defined without this flag.
Also, for proper Shoutcast DSP compatibility, you must define a listen socket with a port one less than the one defined as
`shoutcast-compat`. This means if you define `8001` as `shoutcast-compat`, then you will need to define a listen port
of `8000` and it must not also be defined as `shoutcast-compat`. See the example config file in the distribution for more info.
</div>
<div class="article" markdown="1">
# Global HTTP headers
{:#global-headers}
{% highlight xml %}
<http-headers>
<header name="Access-Control-Allow-Origin" value="*" />
<header name="X-Robots-Tag" value="index, noarchive" />
<header name="foo" value="bar" status="200" />
<header name="Nelson" value="Ha-Ha!" status="404" />
</http-headers>
{% endhighlight %}
Icecast can be configured to send custom HTTP headers. This is available as a global setting and inside mountpoints. This section explains the global settings.
This functionality was introduced mainly to enable the use of simplified cross-origin resource sharing. The Icecast default configuration contains the first header, as seen in the above exmple, for this reason.
http-headers
: This element is placed anywhere inside the main section of the Icecast config. It will contain `<header>` child elements, that specify the actual headers one by one.
header
: This tag specifies the actual header to be sent to a HTTP client in response to every request.
This tag can contain the following attributes:
- `name` is required and its value specifies the HTTP header field name.
- `value` is required and its value specifies the HTTP header field value.
- `status` is optional and limits sending the header to certain HTTP status codes. If not specified, the default is to return the header for every HTTP status code. This attribute is only available for global headers, at the moment.
At the moment only global headers will be sent in case the HTTP status is not "200". This is subject to change in the future.
Avoid placing comments inside `<http-headers>` as, in this release, it will prevent Icecast from parsing further `<header>` tags.
</div>
<div class="article" markdown="1">
# Relaying Streams
{:#relay}
This section contains the servers relay settings. The relays are implemented using a pull system where the receiving
server connects as if it's a listener to the sending server.
There are two types of relay setups:
a "Master server relay" or a "Specific Mountpoint relay."
## Master Relay
A Master server relay is only supported between Icecast servers and is used to relay a number of
mountpoints from a remote Icecast server.
{% highlight xml %}
<master-server>127.0.0.1</master-server>
<master-server-port>8001</master-server-port>
<master-update-interval>120</master-update-interval>
<master-username>relay</master-username>
<master-password>hackme</master-password>
<relays-on-demand>0</relays-on-demand>
{% endhighlight %}
The following diagram shows the basics of using a Master relay.
Please note that the slave is configured with the `<master-server>`, `<master-server-port>`, etc… settings
and the master is the Icecast server from which the slave will pull mountpoints and relay them. Using a
Master server relay, all non-hidden mountpoints on the master can be
relayed using this mechanism.
![Master-Slave server diagram](img/masterslave.png)
A server is configured as a Master Server relay by specifying the `<master-server>`, `<master-server-port>`,
`<master-update-interval>`, `<master-password>` values in the config file. The server that is being relayed
does not need any special configuration.
master-server
: This is the IP for the server which contains the mountpoints to be relayed (Master Server).
master-server-port
: This is the TCP Port for the server which contains the mountpoints to be relayed (Master Server).
master-update-interval
: The interval (in seconds) that the Relay Server will poll the Master Server for any new mountpoints to relay.
master-username
: This is the relay username on the master server. It is used to query the server for a list of mountpoints to
relay. If not specified then `relay` is used.
master-password
: This is the relay password on the Master server. It is used to query the server for a list of mountpoints to
relay.
relays-on-demand
: Global on-demand setting for relays. Because you do not have individual relay options when using a master server
relay, you still may want those relays to only pull the stream when there is at least one listener on the slave.
The typical case here is to avoid surplus bandwidth costs when no one is listening.
## Specific Mountpoint Relay
If only specific mountpoints need to be relayed, then you can configure Icecast with a "Specific Mountpoint Relay".
The following diagram shows the basics of using a Specific Mountpoint relay. Note that the relaying Icecast is
configured with the `<relay>` settings and will pull the specified mountpoint(s) and relay them to the listeners.
Using a Specific Mountpoint Relay, only those mountpoints specified will be relayed.
![Relay server diagram](img/relay.png)
Specific Mountpoint Relays can be configured to relay from an Icecast 2 server, as well as Icecast 1.x and Shoutcast.
A server is configured as a Specific Mountpoint Server relay by specifying a `<relay>` XML chunk in the config file
for each mountpoint to be relayed. The server that is being relayed does not need any special configuration.
{% highlight xml %}
<relay>
<server>127.0.0.1</server>
<port>8001</port>
<mount>/example.ogg</mount>
<local-mount>/different.ogg</local-mount>
<username>joe</username>
<password>soap</password>
<relay-shoutcast-metadata>0</relay-shoutcast-metadata>
<on-demand>1</on-demand>
</relay>
{% endhighlight %}
server
: This is the IP for the server which contains the mountpoint to be relayed.
port
: This is the TCP Port for the server which contains the mountpoint to be relayed.
mount
: The mountpoint located on the remote server. If you are relaying a shoutcast stream,
this should be a `/` or `/name`.
local-mount
: The name to use for the local mountpoint. This is what the mount will be named on the relaying server.
By default the remote mountpoint name is used.
username
: The source of the relay may require authentication itself, if so state the username here.
password
: The source of the relay may require authentication itself, if so state the password here.
relay-shoutcast-metadata
: If you are relaying a Shoutcast stream, you may want to specify this indicator to also relay the metadata
(song titles) that are part of the Shoutcast data stream. By default this is enabled
but it is up to the remote server on whether it sends any.
`1`: enabled, `0`: disabled
on-demand
: An on-demand relay will only retrieve the stream if there are listeners requesting the stream.
`1`: enabled, `0`: disabled (default is `<relays-on-demand>`). This is useful in cases where you want to
limit bandwidth costs when no one is listening.
</div>
<div class="article" markdown="1">
# Mount Specific Settings
{:#mountsettings}
<!-- FIXME -->
{% highlight xml %}
<mount type="normal">
<mount-name>/example-complex.ogg</mount-name>
<username>othersource</username>
<password>hackmemore</password>
<max-listeners>1</max-listeners>
<max-listener-duration>3600</max-listener-duration>
<dump-file>/tmp/dump-example1.ogg</dump-file>
<intro>/intro.ogg</intro>
<fallback-mount>/example2.ogg</fallback-mount>
<fallback-override>1</fallback-override>
<fallback-when-full>1</fallback-when-full>
<charset>ISO8859-1</charset>
<public>1</public>
<stream-name>My audio stream</stream-name>
<stream-description>My audio description</stream-description>
<stream-url>http://some.place.com</stream-url>
<genre>classical</genre>
<bitrate>64</bitrate>
<type>application/ogg</type>
<subtype>vorbis</subtype>
<hidden>1</hidden>
<burst-size>65536</burst-size>
<mp3-metadata-interval>4096</mp3-metadata-interval>
<authentication type="xxxxxx">
<!-- See authentication documentation -->
</authentication>
<http-headers>
<header name="Access-Control-Allow-Origin" value="*" />
<header name="X-Robots-Tag" value="index, noarchive" />
<header name="foo" value="bar" status="200" />
<header name="Nelson" value="Ha-Ha!" status="404" />
</http-headers>
<on-connect>/home/icecast/bin/source-start</on-connect>
<on-disconnect>/home/icecast/bin/source-end</on-disconnect>
</mount>
{% endhighlight %}
This section contains the settings which apply only to a specific mountpoint and applies to an incoming
stream whether it is a relay or a source client. The purpose of the mount definition is to state certain
information that can override either global/default settings or settings provided from the incoming stream.
A mount does not need to be stated for each incoming source although you may want to specific certain settings
like the maximum number of listeners or a mountpoint specific username/password. As a general rule, only define
what you need to but each mount definition needs at least the mount-name. Changes to most of these will apply
across a configuration file re-read even on active streams, however some only apply when the stream starts or
ends.
type
: The type of the mount point (default: "normal"). A mount of type "default"
can be used to specify common values for multiple mountpoints.
Note that default mountpoints won't merge with other mount blocks.
You only get those values if no `type="normal"` mount block exists
corresponding to your mountpoint.
mount-name
: The name of the mount point for which these settings apply.
MUST NOT be used in case of mount type "default".
<!-- FIXME -->
username
: An optional value which will set the username that a source must use to connect using this mountpoint.
Do not set this value unless you are sure that the source clients connecting to the mount point can be
configured to send a username other than `source`.
If this value is not present the default username is `source`.
<!-- FIXME -->
password
: An optional value which will set the password that a source must use to connect using this mountpoint.
There is also a [URL based authentication method](auth.html#stream-auth) for sources that can be used instead.
max-listeners
: An optional value which will set the maximum number of listeners that can be attached to this mountpoint.
max-listener-duration
: An optional value which will set the length of time a listener will stay connected to the stream.
An auth component may override this.
dump-file
: An optional value which will set the filename which will be a dump of the stream coming through
on this mountpoint. This filename is processed with strftime(3). This allows to use variables like `%F`.
intro
: An optional value which will specify the file those contents will be sent to new listeners when they