first stab at icecast password change on install
This commit is contained in:
parent
1c2906f5ab
commit
5d3295c86c
|
@ -79,6 +79,7 @@ class DatabaseSetup extends Setup {
|
||||||
$this->setNewDatabaseConnection(self::$_properties["dbname"]);
|
$this->setNewDatabaseConnection(self::$_properties["dbname"]);
|
||||||
$this->checkSchemaExists();
|
$this->checkSchemaExists();
|
||||||
$this->createDatabaseTables();
|
$this->createDatabaseTables();
|
||||||
|
$this->updateIcecastPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,5 +176,25 @@ class DatabaseSetup extends Setup {
|
||||||
array(self::DB_NAME,));
|
array(self::DB_NAME,));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Updates the icecast password in the database based upon the temp file created during install
|
||||||
|
* @throws AirtimeDatabaseException
|
||||||
|
*/
|
||||||
|
private function updateIcecastPassword() {
|
||||||
|
if (!file_exists(LIBRETIME_CONF_DIR . '/icecast_pass')) {
|
||||||
|
throw new AirtimeDatabaseException("The Icecast Password file was not accessible", array());
|
||||||
|
};
|
||||||
|
$icecastPass = file_get_contents(LIBRETIME_CONF_DIR . '/icecast_pass', true);
|
||||||
|
error_log($icecastPass);
|
||||||
|
$statement = self::$dbh->prepare("UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's1_pass' AND SET value = :icecastpass WHERE keyname = 's1_admin_pass'; "
|
||||||
|
. "UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's2_pass'; "
|
||||||
|
. "UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's2_admin_pass'; "
|
||||||
|
. "UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's3_pass'; "
|
||||||
|
. "UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's3_admin_pass'; "
|
||||||
|
. "INSERT INTO cc_pref (keystr, valstr) VALUES ('default_icecast_password', :icecastpass )");
|
||||||
|
if (!$statement->execute(array(":icecastpass" => $icecastPass))) {
|
||||||
|
throw new AirtimeDatabaseException("Could not update the database with icecast password!", array());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
9
install
9
install
|
@ -894,6 +894,12 @@ if [ "$icecast" = "t" ]; then
|
||||||
else
|
else
|
||||||
icecast_unit_name="icecast"
|
icecast_unit_name="icecast"
|
||||||
fi
|
fi
|
||||||
|
icecast_pass=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-12};echo;)
|
||||||
|
echo $icecast_pass > /tmp/icecast_pass
|
||||||
|
xmlstarlet ed --inplace -u /icecast/authentication/source-password -v $icecast_pass /etc/icecast2/icecast.xml
|
||||||
|
xmlstarlet ed --inplace -u /icecast/authentication/relay-password -v $icecast_pass /etc/icecast2/icecast.xml
|
||||||
|
xmlstarlet ed --inplace -u /icecast/authentication/admin-password -v $icecast_pass /etc/icecast2/icecast.xml
|
||||||
|
|
||||||
# restart in case icecast was already started (like is the case on debian)
|
# restart in case icecast was already started (like is the case on debian)
|
||||||
systemInitCommand restart ${icecast_unit_name}
|
systemInitCommand restart ${icecast_unit_name}
|
||||||
verbose "...Done"
|
verbose "...Done"
|
||||||
|
@ -1100,6 +1106,9 @@ if [ ! -d "/etc/airtime" ]; then
|
||||||
mkdir /etc/airtime
|
mkdir /etc/airtime
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# need to copy the icecast_pass from temp to /etc/airtime so installer can read it
|
||||||
|
cp /tmp/icecast_pass /etc/airtime/icecast_pass
|
||||||
|
|
||||||
|
|
||||||
chown -R ${web_user}:${web_user} /etc/airtime
|
chown -R ${web_user}:${web_user} /etc/airtime
|
||||||
|
|
||||||
|
|
|
@ -67,3 +67,5 @@ liquidsoap
|
||||||
libopus0
|
libopus0
|
||||||
|
|
||||||
systemd-sysv
|
systemd-sysv
|
||||||
|
|
||||||
|
xmlstarlet
|
||||||
|
|
|
@ -63,3 +63,5 @@ libopus0
|
||||||
|
|
||||||
sysvinit
|
sysvinit
|
||||||
sysvinit-utils
|
sysvinit-utils
|
||||||
|
|
||||||
|
xmlstarlet
|
||||||
|
|
|
@ -67,3 +67,5 @@ liquidsoap
|
||||||
libopus0
|
libopus0
|
||||||
|
|
||||||
systemd-sysv
|
systemd-sysv
|
||||||
|
|
||||||
|
xmlstarlet
|
||||||
|
|
|
@ -81,3 +81,5 @@ build-essential
|
||||||
libssl-dev
|
libssl-dev
|
||||||
libffi-dev
|
libffi-dev
|
||||||
python-dev
|
python-dev
|
||||||
|
|
||||||
|
xmlstarlet
|
||||||
|
|
|
@ -70,3 +70,5 @@ liquidsoap-plugin-pulseaudio
|
||||||
liquidsoap-plugin-taglib
|
liquidsoap-plugin-taglib
|
||||||
liquidsoap-plugin-voaacenc
|
liquidsoap-plugin-voaacenc
|
||||||
liquidsoap-plugin-vorbis
|
liquidsoap-plugin-vorbis
|
||||||
|
|
||||||
|
xmlstarlet
|
||||||
|
|
|
@ -81,3 +81,5 @@ build-essential
|
||||||
libssl-dev
|
libssl-dev
|
||||||
libffi-dev
|
libffi-dev
|
||||||
python-dev
|
python-dev
|
||||||
|
|
||||||
|
xmlstarlet
|
||||||
|
|
|
@ -76,3 +76,5 @@ build-essential
|
||||||
libssl-dev
|
libssl-dev
|
||||||
libffi-dev
|
libffi-dev
|
||||||
python-dev
|
python-dev
|
||||||
|
|
||||||
|
xmlstarlet
|
||||||
|
|
Loading…
Reference in New Issue