Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use fixed sed script path #261

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions install/alternc.install
Expand Up @@ -259,9 +259,7 @@ PUBLIC_IP_BEGIN=$(echo $PUBLIC_IP|cut -c 1)
# Secret for PhpMyAdmin sessions
PHPMYADMIN_BLOWFISH="$(generate_string 32)"

# XXX: I assume this is secure if /tmp is sticky (+t)
# we should have a better way to deal with templating, of course.
SED_SCRIPT="/tmp/alternc.install.sedscript"
SED_SCRIPT=$(mktemp)
# Escape passwords for sed and restore afterwards
# Escaping '&' and '|' since those are used as special characters
MYSQL_PASS_ORIG="$MYSQL_PASS"
Expand Down Expand Up @@ -301,7 +299,7 @@ PHPMYADMIN_BLOWFISH="$PHPMYADMIN_BLOWFISH_ORIG"

# hook
test -d /usr/lib/alternc/install.d || mkdir -p /usr/lib/alternc/install.d
run-parts --arg=templates /usr/lib/alternc/install.d
run-parts --arg=templates --arg="$SED_SCRIPT" /usr/lib/alternc/install.d


######################################################################
Expand Down
16 changes: 13 additions & 3 deletions roundcube/roundcube-install
Expand Up @@ -22,16 +22,26 @@
# Purpose of file: Install roundcube conf files.
# ----------------------------------------------------------------------

if [ "$#" -ne 2 ]; then
echo "roundcube-install can't be ran, missing some parameters"
exit 2
fi

if [ -f "$2" ]
then
SED_SCRIPT="$2"
else
echo "roundcube-install can't be ran, sed_script is not a file"
exit 2
fi

if [ "$1" = "templates" ]
then
echo "Installing Roundcube Templates ..."

LOGIN="0000_roundcube"
PASSWORD="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)'`"
DESKEY="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..24)'`"
# "
# Add new variables to the sed script ...
SED_SCRIPT="/tmp/alternc-roundcube.sedscript"
# cf alternc.install for more explanations on this horror :
eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_USER/;s/password/MYSQL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my.cnf`
. /etc/alternc/local.sh
Expand Down