ELS - Easy Linux Security script

kke, you're always welcome.

Version 2.0.2 released. It contais 3 new features (disablephpfunc, dadovecot and chmodfiles) and few bugfixes.
 
Just a note, when trying to use --rkhuntercron I got

Code:
/usr/local/bin/els: line 2937: [: !=: unary operator expected

And then it fails as it doesn't get an email input

Line 2937 is

Code:
if [ $DOALL != 1 ]; then

for it to work as expected the line should be changed to

Code:
if [ "$DOALL" != 1 ]; then

Looking at it, I think you will also have to change it on some other lines too.

Thanks,
Grant
 
I was at the time of posting using the latest version ( 2.0.2 - where the bug was present). Just ran the update again and now using 2.0.2.1 where you have fixed it.

Thanks,
Grant
 
--roundcube added :) It can install roundcube mail on DirectAdmin servers.
 
While running this I typed my email incorrectly by one character, it would not let me fix it. I typed N for it not being correct, it still went ahead and installed it with that incorrect email. I now can not edit the file with the incorrect email address.

.bash_profile

I have tried running the program again, it however will not fix it, keeps stating it's already setup. I try to edit the file 'am logged in as root' it however will not allow me to edit it.

Any suggestions?
 
When running --roundcube, I get this:

tar: roundcube-0.1beta2.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
Chmoding needed directories...
/usr/local/els/roundcube.sh: line 63: cd: roundcube: No such file or directory
chown: cannot access `/var/www/html/roundcube/temp': No such file or directory
chown: cannot access `/var/www/html/roundcube/logs': No such file or directory
chown: cannot access `/var/www/html/roundcube/db.inc.php': No such file or directory
chmod: cannot access `temp': No such file or directory
chmod: cannot access `logs': No such file or directory
chmod: cannot access `db.inc.php': No such file or directory
Inserting data to mysql and creating database/user for roundcube...
ERROR at line 1: Failed to open file 'SQL/mysql.initial.sql', error: 2
Database created, da_roundcube password is TxEfRPHk
/usr/local/els/roundcube.sh: line 81: -c: command not found
/usr/local/els/roundcube.sh: line 82: syntax error near unexpected token `elif'
/usr/local/els/roundcube.sh: line 82: `elif [ -d roundcube-backup ]; then'
 
Try:
Code:
# cd /usr/local/els
# rm -f roundcube.sh
# wget http://servermonkeys.com/projects/els/els/roundcube.sh
# chmod 750 roundcube.sh
# els --roundcube
 
Try:
Code:
# cd /usr/local/els
# rm -f roundcube.sh
# wget http://servermonkeys.com/projects/els/els/roundcube.sh
# chmod 750 roundcube.sh
# els --roundcube

tar: roundcube-0.1beta2.2.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
Chmoding needed directories...
/usr/local/els/roundcube.sh: line 63: cd: roundcube: No such file or directory
chown: cannot access `/var/www/html/roundcube/temp': No such file or directory
chown: cannot access `/var/www/html/roundcube/logs': No such file or directory
chown: cannot access `/var/www/html/roundcube/db.inc.php': No such file or directory
chmod: cannot access `temp': No such file or directory
chmod: cannot access `logs': No such file or directory
chmod: cannot access `db.inc.php': No such file or directory
da_roundcube exists. Please remove the database if you want to do a fresh reinstall.
/usr/local/els/roundcube.sh: line 81: -c: command not found
/usr/local/els/roundcube.sh: line 82: syntax error near unexpected token `elif'
/usr/local/els/roundcube.sh: line 82: `elif [ -d roundcube-backup ]; then'
 
smtalk, here's a patch to fix the entire roundcube.sh file. It fixes about every error I found.

Code:
--- roundcube.sh        2007-02-15 16:30:48.000000000 -0500
+++ roundcube.sh1       2007-02-15 21:51:20.000000000 -0500
@@ -9,7 +9,7 @@
 ROUNDCUBE_DB=da_roundcube
 ROUNDCUBE_DB_USER=da_roundcube
 ROUNDCUBE_DB_PASS=`perl -le'print map+(A..Z,a..z,0..9)[rand 62],0..7'`;
-ROUNDCUBEVERSION=0.1beta2.2
+ROUNDCUBEVERSION=0.1beta2.1
 ROUNDCUBETARVERSION=0.1beta2
 MYSQLUSER=`grep "^user=" $MYSQL_CONF_PATH | cut -d= -f2`
 MYSQLPASSWORD=`grep "^passwd=" $MYSQL_CONF_PATH | cut -d= -f2`
@@ -45,26 +45,28 @@
     echo "Roundcube has already been downloaded, skipping step."
 fi
 
-if [ -d roundcube-backup ]; then
+if [[ -d roundcube-backup ]]; then
     rm -rf roundcube-backup
-else
+elif [[ -e roundcube-backup ]]; then
     rm -rf roundcube
     mv roundcube* roundcube-backup
 fi
 
-tar xzf roundcube-$ROUNDCUBEVERSION.tar.gz
+tar -xzf roundcubemail-$ROUNDCUBEVERSION.tar.gz
 
 # Remove archive and link roundcube folder to roundcube
 ln -s roundcubemail-$ROUNDCUBETARVERSION roundcube
 
+mkdir roundcube/apache
+
 # Chmod needed directories
 echo "Chmoding needed directories..."
 chown -R root:root $ROUNDCUBEPATH
 cd roundcube
-chown -R apache $ROUNDCUBEPATH/temp $ROUNDCUBEPATH/logs $ROUNDCUBEPATH/db.inc.php
+chown -R root:root apache temp logs config/db.inc.php.dist
 chmod -R 700 temp
 chmod -R 700 logs
-chmod 600 db.inc.php
+chmod 600 config/db.inc.php.dist
 
 # Insert data to mysql and create database/user for roundcube
 if [ ! -d /var/lib/mysql/$ROUNDCUBE_DB ]; then
@@ -78,27 +80,23 @@
 fi
 
 # Edit roundcube configuration
-COUNTEDIT=`$GREP -c -e "mysql://roundcube:pass@localhost/roundcubemail" db.inc.php`
-elif [ -d roundcube-backup ]; then
+if [[ -d roundcube-backup ]]; then
     echo "Roundcube backup directory exists (roundcube-backup). Moving configuraiton files..."
     mv --force ../roundcube-backup/config/db.inc.php config/db.inc.php
     mv --force ../roundcube-backup/config/main.inc.php config/main.inc.php
-elif [ "$COUNEDIT" = "0" ]; then
+else
     echo "Editing roundcube configuration..."
     cd config
     mv db.inc.php.dist db.inc.php
     mv main.inc.php.dist main.inc.php
-    perl -pi -e "s|mysql://roundcube:pass@localhost/roundcubemail|mysql://$ROUNDCUBE_DB_USER:$ROUNDCUBE_DB_PASS@localhost/$ROUNDCUBE_DB|" > db.inc.php > /dev/null
-    perl -pi -e "s|'enable_caching'] = TRUE|'enable_caching'] = FALSE|" main.inc.php > /dev/null
-    perl -pi -e "s|'default_host'] = ''|'default_host'] = 'localhost'|" main.inc.php > /dev/null
+    sed -i "s|mysql://roundcube:pass@localhost/roundcubemail|mysql://$ROUNDCUBE_DB_USER:$ROUNDCUBE_DB_PASS@localhost/$ROUNDCUBE_DB|" db.inc.php
+    sed -i "s|\['enable_caching'\] = TRUE|\['enable_caching'\] = FALSE|" main.inc.php
+    sed -i "s|\['default_host'\] = ''|\['default_host'\] = 'localhost'|" main.inc.php
     echo "Roundcube has been installed successfully"
-else
-    echo "Can not edit configuration file."
-    exit
 fi
 
 # Writing alias to httpd.conf
-COUNTALIAS=`$GREP -c -e "Alias /roundcube" $HTTPDCONF`
+COUNTALIAS=$(grep -c -e "Alias /roundcube" $HTTPDCONF)
 if [ "$COUNTALIAS" = "0" ]; then
    echo "" >> $HTTPDCONF
    echo "# Modified by ELS" >> $HTTPDCONF
 
Sorry, but I can't use your "fix" :) There are some unneeded characters etc. Also, roundcubemail the latest version is 0.1beta2.2 :) Try to update your els ( els --update ), and then try again, maybe you have an older version.
 
You must have updated it after I was working on the old version. Anyways, I get this now: Can not download roundcubemail-0.1beta2 - though it did download.
 
Thank you for this bug report :) It's fixed now. Try els --update and run it again.
 
Back
Top