Two Factor Authorization Mod

Started by rcschaff, February 06, 2020, 12:48:12 AM

Previous topic - Next topic

rcschaff

I have built a Two Factor Authorization Module for CWP.  I have tested it, but please consider this is BETA.   All Issues should be reported to me on this post.

Pre-Requisites.
You need an API key created with ACCOUNT-> list created
After installation, make sure you change User Account -> Themes to the modified theme, and don't allow them to change

Please not that this system works around the CWP login system, and therefore is not infallible, though I did my best to hide that it's there.

TO install:
From root user via ssh:
wget https://schaffner.org/cwp2fa.tar.gz
tar -xzf cwp2fa.tar.gz
cd cwp_2fa/
./install.sh
When prompted, put in your API key
That's it. 

Now log into CWP and you should see a new menu 2Factor Auth directly under Server Settings Menu


Users Menu Appears under CWP Settings
Google Hangouts:  rcschaff82@gmail.com

Jamshed Datori

Zip File is corrupt. Kindly check again

rcschaff

Google Hangouts:  rcschaff82@gmail.com

rcschaff

Fixed now.  Not sure why it corrupted.
Google Hangouts:  rcschaff82@gmail.com

rcschaff

Here are the checksums for the file cwp2fa.tar.gz
MD5:  a3b85cbb5f67022da228de61224560fc
sha1:  65d80e3cd034d54ef0cf144ae236a42b84468366
sha256:  edb57a36d2df601e1ef4d02020d7c11a1e74109b7d3a895fee53808e510a57e1 
Google Hangouts:  rcschaff82@gmail.com

thenob

Works great!

Only I bumped into 2 things
-1 Couldn't copy
/usr/local/cwpsrv/htdocs/admin/design/ was read-only due to an SE-linux setting, maybe check it? (ls -Z)

-2 Local time on the server was off with 2 minutes, so every login failed.
Solved it with installing ntpd
So maybe do a check if ntpdate is installed?

rcschaff

md5sum 2b158a964d064639df93697c9aee0b42
sha1sum 5a3cb827e7cc8e9ff7b6892b88c5cb333820af19
sha256sum af36c7e02c5de41d911477fdecdc806d43db8c59e94432488335bc013d4f5e6e

The only update I made was to check for ntp, and install it if it's not installed.

If you have selinux installed, then you must know what you are doing, as CWP disables it by default.
Google Hangouts:  rcschaff82@gmail.com

annettek

#7
i am gertting this error in cwp admin

Warning: require_once(design/googleAuthenticator.php): failed to open stream: No such file or directory in /usr/local/cwpsrv/htdocs/resources/admin/modules/cwp2fa.php on line 106

Fatal error: require_once(): Failed opening required 'design/googleAuthenticator.php' (include_path='.:/usr/local/cwp/php71/lib/php') in /usr/local/cwpsrv/htdocs/resources/admin/modules/cwp2fa.php on line 106

when trying to create a key

it has stopped me from loggin into my user control panel. also the file manager only loads this /home/google
phpqrcode  not my site files

i reinstalled it to try that now i have 2 entries in the left menu. sorry to be a pain

any help would be great as i really want the use of this mod

rcschaff

make sure you are on the root account
go to where you untarred cwp_2fa

try these
cp -v admin/googleAuthenticator.php /usr/local/cwpsrv/htdocs/admin/design/
cp -v admin/showQRCode.php /usr/local/cwpsrv/htdocs/admin/design/

If you cannot copy them, try chattr -i /usr/local/cwpsrv/htdocs/admin/design and see if they will copy.   It's also possible you have selinux activated.
If it is, you can do
setenforce 0
copy the files
then
setenforce 1
Google Hangouts:  rcschaff82@gmail.com

annettek

se linux disabled

setenforce: SELinux is disabled

the files are in the correct dir

still same error

/usr/local/cwpsrv/htdocs/admin/design

googleAuthenticator.php
showQRCode.php

rcschaff

Install script has been updated.

Redownload, and rerun the install.

md5sum 8f0f50679d5a37fd49610227b840db60
Google Hangouts:  rcschaff82@gmail.com

annettek

workd nowe how do i remove the 2 extra entries in left menu i have  now lol.

thanks

so much appericated for this.

rcschaff

#12
Edit

/usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php

remove the extra lines ;)

It starts with <noscript>  20 lines or so, end with </script>
Google Hangouts:  rcschaff82@gmail.com

annettek

#13
ok one last part

/home/google
phpqrcode

the file manager is user control panel loads these dir not the user files home/public_html ect

thanks for the support awsome many many thanks

rcschaff

Correct.  The login user uses /home/google
Google Hangouts:  rcschaff82@gmail.com