1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-30 06:35:23 +00:00
Commit Graph

136 Commits

Author SHA1 Message Date
Philipp Schafft
4d7a60d588 Feature: Added basic support for auth backends to manipulate the client 2018-09-19 13:32:58 +00:00
Philipp Schafft
0af45ebf26 Cleanup: Replace and remove leftover old COMMAND_*s 2018-09-13 08:38:12 +00:00
Philipp Schafft
bfcac5d30c Feature: Unifiy response root node generation a bit and make the module list universally available 2018-08-08 14:10:08 +00:00
Philipp Schafft
d782eb4c21 Feature: Allow admin commands to have embedded parameters 2018-07-09 10:42:14 +00:00
Marvin Scholz
9897567ea0 Update: Add debug logging for admin auth error 2018-07-09 03:34:53 +02:00
Philipp Schafft
7742bf0a21 Fix: Report correct listen URL to client.
The URL is constructed considering Protocol, TLS Mode, Host, and Port.

This considers:
 - The Host:-header as provided by the client,
 - The effective listensocket of the client,
 - Global configuration.

This works for:
 - Playlist generation,
 - Admin authed playlist generation,
 - Stats based XSLT.

It also unifies code:
 - Default stats values.

Not yet included:
 - YP requests.
2018-06-30 13:12:30 +00:00
Philipp Schafft
1a426f7f81 Cleanup: Renamed *_TRANSFORMED* to *_HTML* 2018-06-29 15:25:12 +00:00
Philipp Schafft
32a410bdd6 Feature: Allow xslt_transform() to send non-200 status 2018-06-27 15:54:30 +00:00
Philipp Schafft
a466900ae1 Feature: Allow POST for admin requests 2018-06-19 13:44:07 +00:00
Philipp Schafft
059bfdc7ce Cleanup: Corrected headers used in code 2018-06-17 12:47:35 +00:00
Philipp Schafft
5c3e7760c5 Cleanup: Corrected headers used in headers 2018-06-17 12:28:38 +00:00
Philipp Schafft
0bb65ed090 Feature: Allow OPTIONS on admin requests 2018-06-16 17:59:11 +00:00
Philipp Schafft
822057ca57 Feature: Allow registering new admin commands on the fly 2018-06-09 12:43:09 +00:00
Philipp Schafft
bc38c93545 Update: Check admin command table before use 2018-06-09 12:43:09 +00:00
Philipp Schafft
86154bc6d9 Feature: Set foundation for having multiple admin/ sub-directories 2018-06-09 12:43:09 +00:00
Philipp Schafft
9fb26c4607 Fix: Allow non-1-byte PATH_SEPARATOR in admin_send_response() 2018-06-09 11:11:29 +00:00
Philipp Schafft
442960ac4a Feature: Added admin format ADMIN_FORMAT_AUTO 2018-06-09 10:43:57 +00:00
Philipp Schafft
88ca36545e Update: Converted the response format for admin requests into a enum 2018-06-09 10:34:34 +00:00
Philipp Schafft
b42378abc4 Feature: Generate errors based on IDs.
This generates error pages based on IDs. This allows to reuse errors
and add more advanced information to them.

This patch also makes Icecast send in plain text OR HTML based
on the clients Accept:-string.
2018-05-07 16:28:46 +00:00
Marvin Scholz
cf21756035 Refactor admin.c handlers 2018-05-06 14:22:51 +02:00
Marvin Scholz
e99ebfae3a Move helper macros in admin.c to the top 2018-05-05 07:26:37 +00:00
Philipp Schafft
fb3678b0ca Fix: Do not access request type when we have no parser (slaves) 2018-05-05 06:42:34 +00:00
Philipp Schafft
789dd06762 Feature: Export used protocol in status XML 2018-03-01 10:41:52 +00:00
Philipp Schafft
a6eb48e44d Update: Abstracted TLS support in tls.c 2017-07-23 13:14:48 +00:00
Marvin Scholz
3a73f9c146 More hardening of XML output against invalid entities
This replaces the add node function with the one intended for text nodes
to prevent that invalid entities are not encoded and therefore could
break the XML output.

(See d739c65e54 and #2255)
2016-02-10 20:56:56 +01:00
Marvin Scholz
d739c65e54 Fix invalid entities in listclient xml
This fixes a bug where listener Referer or User-Agent strings containing
a sequence like `&T;` was not escaped properly and therefore made the
whole XML document invalid.
Injecting new XML nodes (<foo></foo>) was not possible, it seems in the
worse case all it could cause was that the XML failed to parse.

Fix #2255
2016-02-08 23:02:02 +01:00
Philipp Schafft
c1f0eaff8a Fix: Fixed some smaller bugs such as leaks and performance improvements.
This is a first commit to correct minor problmes reported by
Denis Denisov. There is likely another commit to correct some more
such problems.

Thank you Denis Denisov.
2015-04-08 09:36:59 +00:00
Philipp Schafft
225c6f240a Fix: do not FTBFS in case OpenSSL support is not compiled in 2015-02-23 21:43:07 +00:00
Philipp Schafft
91eb78fc3a Feature: Expose TLS status in <listener> tags.
This exposes the TLS status as <tls> tag in the <listener> tag.
The tag contains a bool ("true" or "false"). TLS mode, version and
other parameters are out of the scope of this tag and may be added
as independed tags in later commits.
2015-02-09 12:14:16 +00:00
Philipp Schafft
927ccf5213 Cleanup: corrected comment TAGs 2015-02-09 12:06:29 +00:00
Philipp Schafft
c89a5714fb Cleanup: Converted tag <Listeners> to lowercase.
This converts the <Listeners> tag to lowercase on listclients admin
command. This is to align with stats.xml which already uses lowercase.
See: #2097
2015-02-09 12:03:00 +00:00
Philipp Schafft
8941de3273 Fix: Added some more HTTP/1.1 headers
This adds to all responses:
 * "Accept-Encoding: identity"
 * "Connection: close"
 * "Allow: GET, SOURCE" or "Allow: GET" (on admin pages)

This is to generate some infrastructure for Icecast to tell futur
source clients what is supported.

"Upgrade: TLS/1.0" should be added later when upgrade support is present.

See: #2152
2015-02-01 11:56:03 +00:00
Marvin Scholz
0dfc7c5b6a Cleanup codestyle
This commit cleanups codestyle a bit, yet there is still some work to be done
2015-01-25 19:57:27 +01:00
Philipp Schafft
3b4e3ed0ed Cleanup: more cleanly define blocks for admin command IDs
This adds info to the blocks about their size.
Also added two more blocks:
* for experimental features such as in private branches or
  or feature branches. This is for command IDs that are going to
  be merged with master some day. At merge they need to be changed
  and put into the regular position.
* for private features that are not going to be merged into master.
  e.g. specific features for a very specific user that are not
  useful for general audiance.

This should help keeping stuff sorted and largey reducing the risk
of command ID collissions on merges of branches.
Also this should make the merger's job a little bit more easy as
there are less likely any conflicts on merge if someone else got
a number closeby and those change is within the diff's context lines.
2015-01-13 08:42:02 +00:00
Philipp Schafft
11d5dffd49 Cleanup: Removed tailing spaces 2015-01-10 18:53:44 +00:00
Philipp Schafft
e9a90f9918 Cleanup: converted tabs into spaces 2015-01-10 01:48:15 +00:00
Philipp Schafft
b638d3c939 Fix: Added support to admin/ interface to list <role>s
This adds support to list global and per mount roles on stats.xsl.
This isn't nicest formated but works.
This also adds <source>-like <authentication> with <role>s to
root node.
Closes: #2133
2014-12-26 21:57:50 +00:00
Philipp Schafft
55d429a6c8 Fix: Corrected display of "login" on status page
This corrects the creation of <authenticator> in the status output
and this way fixes the display of login link on status page.
Closes #1939
2014-12-20 09:39:26 +00:00
Philipp Schafft
0eb466b76d Feature: Allow mangement of <role>s via admin/ interface.
This allows to manage <role>s via admin interface if the role supports.
Also format of admin/manageauth has been changed:
- <source> was renamed to <role>.
- mount parameter was removed.
- <role> got new parameters: type, name,
  can-adduser, can-deleteuser, can-listuser.
- can-* parameters are bools ("true" or "false"). They should be used
  to show or hide elements on the admin interface.

Ticket #2123 is nearly complet with this, just admin/manageauth.xsl
needs up be updated. Please close the bug in the commit that updates
admin/manageauth.xsl.
See #2123
2014-12-19 16:14:35 +00:00
Philipp Schafft
4a0c399bf3 Added 'lagcay' mode stats.xml.
Add '?omode=legacy' to any URI or <resource ... omode="legacy" />.
Please test.
closes #2097
2014-12-18 09:56:54 +00:00
Philipp Schafft
dc016bc017 Fix: Fixed compiler warnings
This fixes some compiler warnings. The code should be warning free
if gcc with -Wall is used but for the following:
{{{
admin.c: In function 'command_manageauth':
admin.c:790: warning: unused variable 'mountinfo'
}}}
This warning is due <role> migration. See #2123 for more details on
this warning. Please test with care. closes 2063
2014-12-14 19:18:22 +00:00
Philipp Schafft
d67f0f5d91 Fix: Send Content-Disposition:-header correctly, closes #1953 2014-12-14 11:01:39 +00:00
Philipp Schafft
8f706a4c1e Cleanup: Moved config re-read function into right place
Renamed event_config_read() into config_reread_config() and moved
it into cfgfile.c. This allowed to delete event.[ch].
event.[ch] will later be used to implement <event>.
2014-12-07 10:54:34 +00:00
Philipp Schafft
93194594f7 better coding style, patch by ePirat. refs #2059
svn path=/icecast/trunk/icecast/; revision=19376
2014-11-30 20:32:30 +00:00
Philipp Schafft
23a47c8ffc in <listener>:
- Added <role>.
- Converted <Referer> to <referer>.
- Set id="nnn" in addition to <ID>nnn</ID>.
- Added TAGged comments about next steps.

refs #2097

svn path=/icecast/trunk/icecast/; revision=19364
2014-11-29 10:16:36 +00:00
Philipp Schafft
a642cac542 Wow. Mega patch!
This patch *replaces* the authentication system completly.

What is new:
 - <authentication> in mount section is now a container object.
 - <authentication> in root and mount section may hold any number of <role>-Tags.
 - <role> tags:
   Those tags define a 'role' and it's ACL rules.
   A role is a instance of an authentication module (see below).
   <role> takes the following options. All but type are optional.
   - authentication related:
     - type: Type of the authentication module (values: anonymous, static, legacy-password, url or htpasswd;
             symbolic constants in auth.h)
     - name: Name for the role. For later matching. (values: any string; default: (none))
     - method: This rule is only active on the given list of HTTP methods.
               (list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
   - ACL related:
     - allow-method: Allowed HTTP methods.
       (list of enum values: methods as recognized by httpp/ (e.g: get,post); default: get)
     - deny-method: Rejected HTTP methods.
       (list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
     - allow-admin: Allowed admin commands. (list of enum values: admin command; default: buildm3u)
     - deny-admin: Rejected admin commands. (list of enum values: admin command; default: *)
     - allow-web: Allowed web pages. (values: empty or *; default: *)
     - deny-web: Rejected web pages. (values: empty or *; default: (empty))
     - connections-per-user: maximum number of simultaneous connections per role and username.
       This is only active on active sources.  (values: unlimited or number of connections; default: unlimited)
     - connection-duration: maximum time of a connection. This is only active on active sources.
       (values: unlimited or number of secounds; default: unlimited)
   <role> takes <option> child tags. <option> tags contain a name and a value option.
   Meaning of <option> tags is up to the authentication module.
 - <role>s are considered to build a stack. If a role returns with AUTH_NOMATCH the next one will be tried.
 - <role>s are tested in this order: mount specific, default mount specific, global, internal fallback.
   Internal fallback is set to allow web/ access via GET, POST and HEAD (only GET supported by this time)
   and rejects all other requests.
 - New authentication module: anonymous
   This module matches all requests. No options taken.
 - New authentication module: static
   This module matches with a static username and password.
   It takes two <option>s. One with name="username" and one with name="password" to set username and password.
   This replaces old style <*-username> and <*-password> tags.
 - New authentication module: legacy-password
   This module matches with a statich password.
   It takes one <option> with name="password" to set password.
   This replaces old ICE and ICY (shoutcast compat mode) authentication.
 - Parsing <authentication> in <mount> with a type set in a special way to allow 100% backward compatibility.
 - Parsing of <source-password>, <admin-password>, <admin-user>, <relay-password> and <relay-user> in global
   <authentication> for 100% backward compatibility.
 - <alias> is now proccessed very early. This enables them to be used for all kinds of requests.

To Do List & What does not yet work:
 - type="url" auth: mount_add and mount_remove.
   This should be replaced by an unique feature I would call '<event>'.
 - Admin commands manageauth and manageauth.xsl are disabled as they need more review:
   This code needs to be ported to support multiple <role>s per <mount>.
 - url authentication module can not yet return AUTH_NOMATCH.
   This needs to be reviewed and discussed on how to handle this case best way.
 - Default config files needs to be updated to reflect the changes.
   As this is quite some political act it should be done in dicussion with the whole team
   and permission of the release manager.
 - Docs need to be updated to reflect the changes.

How does it work:
 Code has been changed so that authentification is done early for all clients.
 This allows accessing the ACL data (client->acl) from nearly everywhere in the code.

 After accept() and initial client setup the request is parsed. In the next step
 all <alias>es are resolved. After this the client is passed for authentication.
 After authentication it is passed to the corresponding subsystem depending on kind of request.

 All authentication instances have a thread running for doing the authentication.
 This thread works on a queue of clients.

Hints for testers:
 - Test with default config.
 - Test with diffrent authentication modules in <mount>.
 - Test shoutcast compatibility mode.
 - Test with new style <authentication> and any amount of <role> (zero to quite some).
 - Test <alias> lookup on all kinds of objects.
 - Test source level credential login into the admin interface.
 - Test shoucast style meta data updates.
 - Test playlist generation.

Thank you for reading this long commit message. Have fun reading the full patch!

svn path=/icecast/trunk/icecast/; revision=19358
2014-11-28 23:46:08 +00:00
Philipp Schafft
637af17f82 some more changes for ACL framework: exported admin_get_command() and ADMIN_COMMAND_ERROR as well as introduced ADMIN_COMMAND_ANY
svn path=/icecast/trunk/icecast/; revision=19349
2014-11-22 05:42:36 +00:00
Philipp Schafft
0df154f3bf remove client_send_[0-9]{3}() in favor of client_send_error(). Please test
svn path=/icecast/trunk/icecast/; revision=19344
2014-11-21 18:05:17 +00:00
Philipp Schafft
237eb4f770 first part of patch to allow kh like admin stats with listener tags inside
svn path=/icecast/trunk/icecast/; revision=19343
2014-11-21 15:37:50 +00:00
Philipp Schafft
6dca08ee5d (sync with my branch) Support for reloading server config using admin interface. close #2018
svn path=/icecast/trunk/icecast/; revision=19337
2014-11-20 18:34:41 +00:00