Author Topic: Two Factor Authorization Mod  (Read 12762 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Re: Two Factor Authorization Mod
« Reply #30 on: February 22, 2020, 03:50:49 AM »
[root@server ~]# /root/watch.sh
-bash: /root/watch.sh: /bin/sh^M: bad interpreter: No such file or directory


#!/bin/sh
pid=` ps aux | grep -v grep | pgrep -f cron.php`
check_user()
{
echo "//////////User Checks//////////"
cd /usr/local/cwpsrv/var/services/users/login
if [ "$(tail -1 index.php)" == "?>" ] ; then
                return
        fi
chattr -i .
chattr -i *
echo "Moving Files"
cp -f index.php abcdefg.php
cp -f login.php index.php
chattr +i *
chattr +i .
}
check_configs()
{
echo "//////////Config Checks//////////"
FILES=/usr/local/cwpsrv/conf.d/users/*
for f in $FILES
do
if ! grep -q "/home/google" $f; then
    echo updateing $f
     sed -i -re 's@open_basedir(.*)(";)@\1:/home/google\2@' $f
fi
done
if grep -q "open_basedir = /tmp" /usr/local/cwpsrv/conf.d/users.conf; then
updating users.conf
sed -i "s@fastcgi_param   PHP_ADMIN_VALUE \"open_basedir = /tmp@fastcgi_param   PHP_ADMIN_VALUE \"open_basedir = /home/:/tmp@g" /usr/local/cwpsrv/conf.d/users.conf

fi
/usr/local/cwpsrv/bin/cwpsrv -s reload
find /home/*/.conf/cwp.ini -exec sed -i "s@original@modified@g" {} +

}
check_admin()
{
echo "//////////Admin Checks//////////"
        cd /usr/local/cwpsrv/htdocs/admin/login/
        if [ "$(tail -1 index.php)" == "?>" ] ; then
                return
        fi
        echo "Moving Admin"
        chattr -i .
        chattr -i *
        ls | grep -P "[a-z0-9]{16}" | xargs -d"\n" rm
        RAND_CHARS=$(openssl rand -hex 16)
        mv index.php $RAND_CHARS.php
        cp index_working.php index.php
        sed -i "s@define(\"DO_LOGIN\",\"\");@define(\"DO_LOGIN\",\"$RAND_CHARS.php\");@g" index.php
        chattr +i *
        chattr +i .
}
if [ "$pid" != "" ]; then
while [ -e /proc/$pid ]
do
    sleep .6
done
fi
echo "Start Checks"
check_user
check_admin
check_configs
« Last Edit: February 22, 2020, 03:54:40 AM by annettek »

Offline
***
Re: Two Factor Authorization Mod
« Reply #31 on: February 22, 2020, 03:54:45 AM »
Go-to the end of #!/bin/sh and hit enter after the h.  For some reason a carriage return was added to the end of the line.
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: Two Factor Authorization Mod
« Reply #32 on: February 22, 2020, 04:00:40 AM »
did that still the same sorry you must be getting sick of me.

Offline
***
Re: Two Factor Authorization Mod
« Reply #33 on: February 22, 2020, 04:03:40 AM »
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: Two Factor Authorization Mod
« Reply #34 on: February 22, 2020, 04:08:19 AM »
perfect so sorry to be a pain in the ass. i really appericate it you dont know how much.

many many mnay thanks working perfect your awsome
« Last Edit: February 22, 2020, 04:15:12 AM by annettek »

Offline
***
Re: Two Factor Authorization Mod
« Reply #35 on: February 22, 2020, 04:27:52 AM »
Module moved to github: https://github.com/rcschaff82/cwp_2fa

Created new topic noting so and locking this one.
Google Hangouts:  rcschaff82@gmail.com