- Configure Icecast headers and SSL certificates
- Insert HTML in Widget for display
You can skip this part if you are not using SSL. Also note Apache and Icecast are running on the same server. Since my site defaults to SSL (https) I have to configure Icecast for SSL.
The first step is to create the proper SSL certificate file format that Icecast uses. It requires a Public/Private keypair file. I used my Let’s Encrypt certificates and concatenated them together into one file.
cd /usr/share/icecast cat /etc/letsencrypt/live/autonarcosis.com/cert.pem > icecast.pem cat /etc/letsencrypt/live/autonarcosis.com/privkey.pem >> icecast.pem chown icecast.icecast icecast.pem chmod go-r icecast.pem
<listen-socket> <port>8002</port> <ssl>1</ssl> </listen-socket> <http-headers> <header name="Access-Control-Allow-Origin" value="*" /> </http-headers> <paths> <ssl-certificate>/usr/share/icecast/icecast.pem</ssl-certificate> </paths
Save the icecast.xml file. Enable the new port in the firewall.
firewall-cmd --permanent --add-port=8002/tcp firewall-cmd --reload
Restart Icecast, which will now be listening on an SSL port.
systemctl restart icecast.service
You can view Icecast error log file /var/log/icecast/error.log to see if the SSL certificate loaded properly. You should see something similar to this.
[2016-03-11 15:41:45] INFO connection/get_ssl_certificate SSL certificate found at /usr/share/icecast/icecast.pem [2016-03-11 15:41:45] INFO connection/get_ssl_certificate SSL using ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA2 56:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-R SA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SH A384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA25 6:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-S HA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-S HA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
Add the HTML to the widget so the information will be displayed.
<p> </br> Listeners: <span id="listeners">00</span></br> Current track: <span id="track-title">LIVE</span> </p>
That’s all there is to it. There could possibly be a better way or function to do this.
I used this blog entry as a base for figuring this out; https://linge-ma.ws/update-listeners-track-on-a-website-using-icecast-jsonp-and-jquery/