├── pkg
├── icon
│ └── ico-security-advisor.png
├── appconfig
│ └── securityadvisor.conf
├── uninstall
├── bin
│ └── upgrade
├── Cpanel
│ └── Security
│ │ ├── Advisor
│ │ ├── Assessors
│ │ │ ├── Iptables.pm
│ │ │ ├── Tomcat.pm
│ │ │ ├── Symlinks.pm
│ │ │ ├── Permissions.pm
│ │ │ ├── Passwords.pm
│ │ │ ├── _Self.pm
│ │ │ ├── PHP.pm
│ │ │ ├── SSH.pm
│ │ │ ├── Spam.pm
│ │ │ ├── Jail.pm
│ │ │ ├── Brute.pm
│ │ │ ├── Scgiwrap.pm
│ │ │ ├── ClamAV.pm
│ │ │ ├── Usernames.pm
│ │ │ ├── Mysql.pm
│ │ │ └── Processes.pm
│ │ └── Assessors.pm
│ │ └── Advisor.pm
├── install
├── cgi
│ └── addon_securityadvisor.cgi
├── install-dist
└── templates
│ └── main.tmpl
├── .perltidyrc
├── .gitignore
├── Makefile
├── README.md
├── LICENSE
├── t
├── lib
│ ├── Cpanel
│ │ └── Security
│ │ │ └── Advisor
│ │ │ └── Assessors
│ │ │ ├── MockLoadFail.pm
│ │ │ ├── MockNewFail.pm
│ │ │ └── MockAssessor.pm
│ └── Test
│ │ ├── Assessor.pm
│ │ └── Mock
│ │ └── SecurityAdvisor.pm
├── pkg-Cpanel-Security-Advisor-Assessors-Apache.t
├── pkg-Cpanel-Security-Advisor-Assessors-_Self.t
├── pkg-Cpanel-Security-Advisor.t
├── pkg-Cpanel-Security-Advisor-Assessors-Imunify360.t
└── pkg-Cpanel-Security-Advisor-Assessors-Processes.t
└── CONTRIBUTING.md
/pkg/icon/ico-security-advisor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CpanelInc/addon_securityadvisor/HEAD/pkg/icon/ico-security-advisor.png
--------------------------------------------------------------------------------
/.perltidyrc:
--------------------------------------------------------------------------------
1 | -l=400
2 | -i=4
3 | -dt=4
4 | -it=4
5 | -bar
6 | -nsfs
7 | -nolq
8 | --break-at-old-comma-breakpoints
9 | --format-skipping
10 | --format-skipping-begin='#\s*tidyoff'
11 | --format-skipping-end='#\s*tidyon'
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore perltidy files
2 | *.bak
3 | *.ERR
4 | # Ignore SVN
5 | *.svn*
6 | *.pyc
7 | *.so
8 | # Ignore tags files.
9 | tags
10 | TAGS
11 | # Ignore GCC generated files
12 | *.o
13 | *.gcno
14 | *.gcda
15 | gmon.out
16 | # Ignore perl tidy backup files
17 | *.tdy
18 | # Ignore patch files
19 | *.rej
20 | *.orig
21 | # ignore vim swap files.
22 | *.swp
23 | # Ignore Apple AFP files
24 | .DS_Store
25 |
--------------------------------------------------------------------------------
/pkg/appconfig/securityadvisor.conf:
--------------------------------------------------------------------------------
1 | # name
2 | name=securityadvisor
3 |
4 | # Service that will serve this app
5 | service=whostmgr
6 |
7 | # Physical path: /usr/local/cpanel/3rdparty/Foo.php
8 | # Literal URL path: $server:$port/$cpsession/3rdparty/Foo.php
9 | url=/cgi/addons/securityadvisor/
10 | url2=/cgi/addon_securityadvisor.cgi
11 |
12 | # System user to run process as
13 | user=root
14 |
15 | # Required acls
16 | acls=all
17 |
18 | # Display name as show in the service ui
19 | displayname=Security Advisor Tool
20 |
21 | # Url to show in the service ui (relative to install path for whm this is cgi/)
22 | entryurl=addons/securityadvisor/index.cgi
23 |
24 | upgradecall=/var/cpanel/addons/securityadvisor/bin/upgrade
25 |
26 | icon=ico-security-advisor.png
27 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | IS_SANDBOX=$(shell perl -e 'print "yes" if -e q{/var/cpanel/dev_sandbox}')
2 | PKG=$(shell pwd)/pkg
3 |
4 | all:
5 | @echo 'This Makefile is only used during the build process.'
6 | @echo 'Please update to cPanel & WHM 11.40 or use the pkg/install script.'
7 |
8 | define build_rules
9 | @[ $(IS_SANDBOX) = yes ] || exit 1
10 | rm -fr $(1)/Cpanel/Security/Advisor.pm $(1)/Cpanel/Security/Advisor $(1)/whostmgr/templates/securityadvisor
11 | mkdir -p $(1)/Cpanel/Security/Advisor/Assessors $(1)/whostmgr/docroot/templates/securityadvisor
12 | for i in $(PKG)/Cpanel/Security/Advisor.pm \
13 | $(PKG)/Cpanel/Security/Advisor/Assessors.pm $(PKG)/Cpanel/Security/Advisor/Assessors/*.pm; do \
14 | stripped=`echo $$i | sed -e 's,^$(PKG),,'`; \
15 | rm -fr $(1)/$$stripped; $(2) $$i $(1)/$$stripped; \
16 | done
17 | for i in $(PKG)/templates/*.tmpl; do \
18 | stripped=`basename $$i`; \
19 | cp -f $$i $(1)/whostmgr/docroot/templates/securityadvisor/$$stripped; \
20 | perl -i -pe 's{/addon_plugins/}{}g' $(1)/whostmgr/docroot/templates/securityadvisor/$$stripped; \
21 | done
22 | $(2) $(PKG)/icon/ico-security-advisor.png $(1)/whostmgr/docroot/themes/x/icons/
23 | mkdir -m 700 -p $(1)/whostmgr/docroot/cgi/securityadvisor
24 | $(2) $(PKG)/cgi/addon_securityadvisor.cgi $(1)/whostmgr/docroot/cgi/securityadvisor/index.cgi
25 | endef
26 |
27 | sandbox:
28 | $(call build_rules,/usr/local/cpanel,ln -sf)
29 |
30 | publish:
31 | [ -n "$(DESTDIR)" ] || exit 1
32 | $(call build_rules,$(DESTDIR)/cpanel,cp -f)
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # cPanel Security Advisor README
2 |
3 | The cPanel Security Advisor analyzes the configuration of a cPanel & WHM system to make recommendations that improve system security.
4 |
5 | ## Installation
6 |
7 | Installing from the GitHub repository is only needed if you want to contribute to the development of the security advisor, or you simply want the latest changes before they are distributed with cPanel & WHM. To install from here, you need to clone the repository, then run the installer.
8 |
9 | 1. /usr/local/cpanel/3rdparty/bin/git clone https://github.com/Cpanelinc/addon_securityadvisor.git
10 | 2. cd addon_securityadvisor/pkg
11 | 3. ./install
12 |
13 | The next time cPanel & WHM updates it will over write your changes. To keep the GitHub version you need to create a *postupcp* hook that re-runs the installer at the end of the update.
14 |
15 | ## Usage
16 |
17 | The Security Advisor is found within the Security Center of WHM. It requires root privileges to access. There are two ways to find the Advisor.
18 |
19 | 1. Log into WHM with root privileges
20 | 2. Click Security Center
21 | 3. Click Security Advisor
22 |
23 | OR
24 |
25 | 1. Log into WHM with root privileges
26 | 2. Search for Security Advisor
27 | 3. Click Security Advisor
28 |
29 | Accessing the Security Advisor begins the analysis of your system.
30 |
31 | ## Contributing
32 |
33 | Contributions are welcome.
34 |
35 | Please carefully read the [Contribution Document](CONTRIBUTING.md) for workflow and contributing developer information.
36 |
37 | ## License
38 |
39 | See the LICENSE file in the project root directory.
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2013, cPanel, Inc.
2 | # All rights reserved.
3 | # http://cpanel.net
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions are met:
7 | # * Redistributions of source code must retain the above copyright
8 | # notice, this list of conditions and the following disclaimer.
9 | # * Redistributions in binary form must reproduce the above copyright
10 | # notice, this list of conditions and the following disclaimer in the
11 | # documentation and/or other materials provided with the distribution.
12 | # * Neither the name of the owner nor the names of its contributors may
13 | # be used to endorse or promote products derived from this software
14 | # without specific prior written permission.
15 | #
16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
20 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
--------------------------------------------------------------------------------
/t/lib/Cpanel/Security/Advisor/Assessors/MockLoadFail.pm:
--------------------------------------------------------------------------------
1 | package Cpanel::Security::Advisor::Assessors::MockLoadFail;
2 |
3 | # Copyright (c) 2020, cPanel, L.L.C.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 | use warnings;
31 | use base 'Cpanel::Security::Advisor::Assessors';
32 |
33 | die 'No assessor for you!';
34 |
35 | 1;
36 |
--------------------------------------------------------------------------------
/t/lib/Cpanel/Security/Advisor/Assessors/MockNewFail.pm:
--------------------------------------------------------------------------------
1 | package Cpanel::Security::Advisor::Assessors::MockNewFail;
2 |
3 | # Copyright (c) 2020, cPanel, L.L.C.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 | use warnings;
31 | use base 'Cpanel::Security::Advisor::Assessors';
32 |
33 | sub new {
34 | die 'No new for you!';
35 | }
36 |
37 | 1;
38 |
--------------------------------------------------------------------------------
/pkg/uninstall:
--------------------------------------------------------------------------------
1 | #!/usr/local/cpanel/3rdparty/bin/perl
2 | # Copyright (c) 2013, cPanel, Inc.
3 | # All rights reserved.
4 | # http://cpanel.net
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are met:
8 | # * Redistributions of source code must retain the above copyright
9 | # notice, this list of conditions and the following disclaimer.
10 | # * Redistributions in binary form must reproduce the above copyright
11 | # notice, this list of conditions and the following disclaimer in the
12 | # documentation and/or other materials provided with the distribution.
13 | # * Neither the name of the owner nor the names of its contributors may
14 | # be used to endorse or promote products derived from this software
15 | # without specific prior written permission.
16 | #
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
28 | use Cpanel::Version ();
29 |
30 | unlink("/usr/local/cpanel/whostmgr/docroot/cgi/addon_securityadvisor.cgi");
31 | unlink("/usr/local/cpanel/whostmgr/docroot/cgi/securityadvisor/index.cgi");
32 | unlink("/usr/local/cpanel/whostmgr/docroot/addon_plugins/ico-security-advisor.png");
33 | unlink("/var/cpanel/apps/securityadvisor.conf");
34 |
35 | system "/bin/rm", "-rf", "--", "/var/cpanel/addons/securityadvisor/";
36 | system "/bin/rm", "-rf", "--", "/usr/local/cpanel/whostmgr/docroot/cgi/addons/securityadvisor";
37 |
38 | if ( -x '/usr/local/cpanel/bin/unregister_appconfig' ) {
39 | system '/usr/local/cpanel/bin/unregister_appconfig', "appconfig/securityadvisor.conf";
40 | }
41 |
42 | print "cPanel Security Advisor uninstalled from WHM.\n";
43 |
44 | exit(0);
45 |
--------------------------------------------------------------------------------
/pkg/bin/upgrade:
--------------------------------------------------------------------------------
1 | #!/usr/local/cpanel/3rdparty/bin/perl
2 | # Copyright (c) 2013, cPanel, Inc.
3 | # All rights reserved.
4 | # http://cpanel.net
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are met:
8 | # * Redistributions of source code must retain the above copyright
9 | # notice, this list of conditions and the following disclaimer.
10 | # * Redistributions in binary form must reproduce the above copyright
11 | # notice, this list of conditions and the following disclaimer in the
12 | # documentation and/or other materials provided with the distribution.
13 | # * Neither the name of the owner nor the names of its contributors may
14 | # be used to endorse or promote products derived from this software
15 | # without specific prior written permission.
16 | #
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
28 | package addon::securityadvisor::upgrade;
29 |
30 | use strict;
31 | use Cpanel::SafeRun::Simple ();
32 |
33 | run(@ARGV) unless caller;
34 |
35 | sub run {
36 | my ( $previousversion, $currentversion ) = @_;
37 |
38 | if ( -x '/usr/local/cpanel/bin/is_registered_with_appconfig' && Cpanel::SafeRun::Simple::saferun( '/usr/local/cpanel/bin/is_registered_with_appconfig', 'whostmgr', 'securityadvisor' ) ) {
39 |
40 | if ( !-e "/usr/local/cpanel/whostmgr/docroot/cgi/addons/securityadvisor/index.cgi" && -e "/usr/local/cpanel/whostmgr/docroot/cgi/addon_securityadvisor.cgi" ) {
41 | mkdir( "/usr/local/cpanel/whostmgr/docroot/cgi/addons/securityadvisor", 0700 );
42 | rename(
43 | "/usr/local/cpanel/whostmgr/docroot/cgi/addon_securityadvisor.cgi",
44 | "/usr/local/cpanel/whostmgr/docroot/cgi/addons/securityadvisor/index.cgi"
45 | );
46 | }
47 | }
48 |
49 | return;
50 | }
51 |
--------------------------------------------------------------------------------
/t/lib/Cpanel/Security/Advisor/Assessors/MockAssessor.pm:
--------------------------------------------------------------------------------
1 | package Cpanel::Security::Advisor::Assessors::MockAssessor;
2 |
3 | # Copyright (c) 2020, cPanel, L.L.C.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 | use warnings;
31 | use base 'Cpanel::Security::Advisor::Assessors';
32 |
33 |
34 | sub version {
35 | return '9.99';
36 | }
37 |
38 | sub generate_advice {
39 | my ($self) = @_;
40 | $self->add_good_advice(
41 | 'key' => 'example_good_advice',
42 | 'text' => 'This is good.',
43 | 'suggestion' => 'A suggestion.'
44 | );
45 | $self->add_info_advice(
46 | 'key' => 'example_info_advice',
47 | 'text' => 'This is info.',
48 | 'suggestion' => 'A suggestion.'
49 | );
50 | $self->add_warn_advice(
51 | 'key' => 'example_warn_advice',
52 | 'text' => 'This is a warning.',
53 | 'suggestion' => 'A suggestion.'
54 | );
55 | $self->add_bad_advice(
56 | 'key' => 'example_bad_advice',
57 | 'text' => 'This is bad.',
58 | 'suggestion' => 'A suggestion.'
59 | );
60 | return 1;
61 | }
62 |
63 | 1;
64 |
--------------------------------------------------------------------------------
/pkg/Cpanel/Security/Advisor/Assessors/Iptables.pm:
--------------------------------------------------------------------------------
1 | package Cpanel::Security::Advisor::Assessors::Iptables;
2 |
3 | # Copyright (c) 2013, cPanel, Inc.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 | use base 'Cpanel::Security::Advisor::Assessors';
31 | use Cpanel::SafeRun::Simple;
32 |
33 | sub generate_advice {
34 | my ($self) = @_;
35 | $self->_is_iptables_active();
36 |
37 | return 1;
38 | }
39 |
40 | sub _is_iptables_active {
41 |
42 | my ($self) = @_;
43 |
44 | my $security_advisor_obj = $self->{'security_advisor_obj'};
45 |
46 | if ( -x '/etc/init.d/iptables' ) {
47 | my $status_check = `/etc/init.d/iptables status`;
48 |
49 | # need a better way to check this
50 | if ( $status_check =~ m/not running/i ) {
51 | $security_advisor_obj->add_advice(
52 | {
53 | 'key' => 'Iptables_firewall_not_running',
54 | 'type' => $Cpanel::Security::Advisor::ADVISE_BAD,
55 | 'text' => $self->_lh->maketext('Firewall is not running'),
56 | 'suggestion' => $self->_lh->maketext('This might be a simple matter of executing "/etc/init.d/iptables start"'),
57 | },
58 | );
59 | }
60 | }
61 |
62 | return 1;
63 | }
64 |
65 | 1;
66 |
--------------------------------------------------------------------------------
/pkg/Cpanel/Security/Advisor/Assessors/Tomcat.pm:
--------------------------------------------------------------------------------
1 | package Cpanel::Security::Advisor::Assessors::Tomcat;
2 |
3 | # Copyright (c) 2016, cPanel, Inc.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 | use base 'Cpanel::Security::Advisor::Assessors';
31 |
32 | sub generate_advice {
33 | my ($self) = @_;
34 | $self->_is_tomcat5_installed();
35 |
36 | return 1;
37 | }
38 |
39 | sub _is_tomcat5_installed {
40 | my ($self) = @_;
41 | my $security_advisor_obj = $self->{'security_advisor_obj'};
42 |
43 | if ( -l '/usr/local/jakarta/tomcat' ) {
44 | $security_advisor_obj->add_advice(
45 | {
46 | 'key' => q{Tomcat_installed_5_5_version_is_EOL},
47 | 'type' => $Cpanel::Security::Advisor::ADVISE_BAD,
48 | 'text' => $self->_lh->maketext('Tomcat 5.5 is installed, but is EOL.'),
49 | 'suggestion' => $self->_lh->maketext(
50 | 'Rebuild “[output,url,_1,EasyApache,_2,_3]” without Tomcat 5.5.x selected (or select the newest version of Tomcat), and manually remove the old Tomcat files.',
51 | $self->base_path('cgi/easyapache.pl?action=_pre_cpanel_sync_screen'), 'target', '_blank',
52 | ),
53 | }
54 | );
55 | }
56 |
57 | return 1;
58 | }
59 |
60 | 1;
61 |
--------------------------------------------------------------------------------
/pkg/Cpanel/Security/Advisor/Assessors/Symlinks.pm:
--------------------------------------------------------------------------------
1 | package Cpanel::Security::Advisor::Assessors::Symlinks;
2 |
3 | # Copyright (c) 2016, cPanel, Inc.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 | use warnings;
31 |
32 | use Cpanel::Sys::Uname ();
33 |
34 | use base 'Cpanel::Security::Advisor::Assessors';
35 |
36 | sub generate_advice {
37 | my ($self) = @_;
38 |
39 | if ( $self->has_cpanel_hardened_kernel() ) {
40 | $self->add_warn_advice(
41 | 'key' => 'Symlinks_protection_no_longer_support_hardened_kernel',
42 | 'text' => $self->_lh->maketext('Unsupported cPanel hardened kernel detected.'),
43 |
44 | 'suggestion' => $self->_lh->maketext(
45 | "[asis,cPanel] no longer supports the hardened kernel. We recommend that you use [asis,KernelCare's] free symlink protection. In order to enable [asis,KernelCare], you must replace the hardened kernel with a standard kernel. For instructions, please read the document on [output,url,_1,How to Manually Remove the cPanel-Provided Hardened Kernel,_2,_3].",
46 | 'https://go.cpanel.net/uninstallhardenedkernel', 'target', '_blank'
47 | ),
48 | );
49 |
50 | }
51 | return 1;
52 | }
53 |
54 | sub has_cpanel_hardened_kernel {
55 | my $self = shift;
56 | my $kernel_uname = ( Cpanel::Sys::Uname::get_uname_cached() )[2];
57 | my $ret;
58 | if ( $kernel_uname =~ m/(?:cpanel|cp)6\.x86_64/ ) {
59 | $ret = 1;
60 | }
61 | return $ret;
62 | }
63 |
64 | 1;
65 |
--------------------------------------------------------------------------------
/t/lib/Test/Assessor.pm:
--------------------------------------------------------------------------------
1 | package Test::Assessor;
2 |
3 | # Copyright (c) 2017, cPanel, Inc.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 | use warnings;
31 |
32 | use Cpanel::Locale ();
33 | use Cpanel::Security::Advisor (); # For ADVISE_GOOD, et. al.
34 |
35 | sub new {
36 | my ( $class, %options ) = @_;
37 |
38 | my $module_name = "Cpanel::Security::Advisor::Assessors::$options{assessor}";
39 |
40 | my $self = bless {
41 | locale => Cpanel::Locale->get_handle(),
42 | advice => [],
43 | }, $class;
44 |
45 | eval "require $module_name" or die $@; ##no critic (ProhibitStringyEval) -- require $module_name; doesn't work for some reason.
46 | my $assessor = "$module_name"->new($self);
47 | $self->{assessor} = $assessor;
48 |
49 | return $self;
50 | }
51 |
52 | sub generate_advice {
53 | my ($self) = @_;
54 | return $self->{assessor}->generate_advice();
55 | }
56 |
57 | sub add_advice {
58 | my ( $self, $advice ) = @_;
59 |
60 | # Some assessor modules call methods directly on instances of this class,
61 | # and some use wrapper methods, so try to figure out the module name
62 | # regardless of which path we took.
63 | my ( $module, $function );
64 | foreach my $level ( 1, 3 ) {
65 | my $caller = ( caller($level) )[3];
66 | if ( $caller =~ /(Cpanel::Security::Advisor::Assessors::.+)::([^:]+)$/ ) {
67 | ( $module, $function ) = ( $1, $2 );
68 | last;
69 | }
70 | }
71 |
72 | push @{ $self->{advice} }, {
73 | module => $module,
74 | function => $function,
75 | advice => $advice,
76 | };
77 |
78 | return;
79 | }
80 |
81 | sub get_advice {
82 | my ($self) = @_;
83 | return $self->{advice};
84 | }
85 |
86 | sub clear_advice {
87 | my ($self) = @_;
88 | $self->{advice} = [];
89 | return;
90 | }
91 |
92 | 1;
93 |
--------------------------------------------------------------------------------
/pkg/install:
--------------------------------------------------------------------------------
1 | #!/usr/local/cpanel/3rdparty/bin/perl
2 | # Copyright (c) 2013, cPanel, Inc.
3 | # All rights reserved.
4 | # http://cpanel.net
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are met:
8 | # * Redistributions of source code must retain the above copyright
9 | # notice, this list of conditions and the following disclaimer.
10 | # * Redistributions in binary form must reproduce the above copyright
11 | # notice, this list of conditions and the following disclaimer in the
12 | # documentation and/or other materials provided with the distribution.
13 | # * Neither the name of the owner nor the names of its contributors may
14 | # be used to endorse or promote products derived from this software
15 | # without specific prior written permission.
16 | #
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
28 | mkdir( "/usr/local/cpanel/whostmgr/docroot/cgi/addons", 0755 );
29 | mkdir( "/usr/local/cpanel/whostmgr/docroot/cgi/addons/securityadvisor", 0700 );
30 |
31 | mkdir( "/var/cpanel/apps", 0755 );
32 | mkdir( "/var/cpanel/addons", 0755 );
33 | mkdir( "/var/cpanel/addons/securityadvisor", 0700 );
34 | mkdir( '/var/cpanel/addons/securityadvisor/perl', 0700 );
35 |
36 | system '/usr/bin/rsync', '-rlptD', 'templates', '/var/cpanel/addons/securityadvisor/';
37 | system '/usr/bin/rsync', '-rlptD', 'bin', '/var/cpanel/addons/securityadvisor/';
38 | system '/usr/bin/rsync', '-rlptD', 'Cpanel', '/var/cpanel/addons/securityadvisor/perl/';
39 |
40 | if ( -x '/usr/local/cpanel/bin/register_appconfig' ) {
41 | install( "-o", "root", "-g", "wheel", "-m" . "0700", "cgi/addon_securityadvisor.cgi", "/usr/local/cpanel/whostmgr/docroot/cgi/addons/securityadvisor/index.cgi" );
42 | unlink("/usr/local/cpanel/whostmgr/docroot/cgi/addon_securityadvisor.cgi") if -e "/usr/local/cpanel/whostmgr/docroot/cgi/addon_securityadvisor.cgi";
43 | system '/usr/local/cpanel/bin/register_appconfig', "appconfig/securityadvisor.conf";
44 | }
45 | else {
46 | install( "-o", "root", "-g", "wheel", "-m" . "0700", "cgi/addon_securityadvisor.cgi", "/usr/local/cpanel/whostmgr/docroot/cgi/addon_securityadvisor.cgi" );
47 | install( "-o", "root", "-g", "wheel", "-m" . "0600", "appconfig/securityadvisor.conf", "/var/cpanel/apps/securityadvisor.conf" );
48 | }
49 |
50 | mkdir( "/usr/local/cpanel/whostmgr/docroot/addon_plugins", 0755 ) if !-e "/usr/local/cpanel/whostmgr/docroot/addon_plugins";
51 | install( "-o", "root", "-g", "wheel", "-m" . "0600", "icon/ico-security-advisor.png", "/usr/local/cpanel/whostmgr/docroot/addon_plugins/ico-security-advisor.png" );
52 |
53 | print "cPanel Security Advisor installed into WHM.\n";
54 |
55 | exit(0);
56 |
57 | sub install {
58 | system( "/usr/bin/install", @_ );
59 | }
60 |
61 |
--------------------------------------------------------------------------------
/t/pkg-Cpanel-Security-Advisor-Assessors-Apache.t:
--------------------------------------------------------------------------------
1 | #!/usr/local/cpanel/3rdparty/bin/perl
2 |
3 | # Copyright (c) 2018, cPanel, L.L.C.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 | use warnings;
31 |
32 | use FindBin;
33 | use lib "$FindBin::Bin/lib", "$FindBin::Bin/../pkg";
34 |
35 | use Test::More;
36 | use Cpanel::Version ();
37 | use Cpanel::Version::Tiny ();
38 |
39 | plan skip_all => 'Requires cPanel & WHM v66 or later' if Cpanel::Version::compare( Cpanel::Version::getversionnumber(), '<', '11.65' );
40 | plan tests => 4;
41 |
42 | use Cpanel::Security::Advisor::Assessors::Apache ();
43 |
44 | my %doesnot_doea3 = (
45 | 75 => 0,
46 | 76 => 0,
47 | 77 => 1,
48 | 78 => 1,
49 | );
50 |
51 | for my $v (qw(75 76 77 78)) {
52 | local $Cpanel::Version::Tiny::major_version = $v;
53 |
54 | my @calls;
55 | no warnings "redefine";
56 | local *Cpanel::Security::Advisor::Assessors::Apache::_check_for_easyapache3_eol = sub { push @calls, '_check_for_easyapache3_eol' };
57 | local *Cpanel::Security::Advisor::Assessors::Apache::_check_for_apache_chroot = sub { push @calls, '_check_for_apache_chroot' };
58 | local *Cpanel::Security::Advisor::Assessors::Apache::_check_for_easyapache_build = sub { push @calls, '_check_for_easyapache_build' };
59 | local *Cpanel::Security::Advisor::Assessors::Apache::_check_for_eol_apache = sub { push @calls, '_check_for_eol_apache' };
60 | local *Cpanel::Security::Advisor::Assessors::Apache::_check_for_symlink_protection = sub { push @calls, '_check_for_symlink_protection' };
61 |
62 | Cpanel::Security::Advisor::Assessors::Apache->generate_advice();
63 |
64 | if ( $doesnot_doea3{$v} ) {
65 | is_deeply \@calls, [ '_check_for_apache_chroot', '_check_for_symlink_protection' ], "v$v does not do ea3 specific checks";
66 | }
67 | else {
68 | is_deeply \@calls, [ '_check_for_easyapache3_eol', '_check_for_apache_chroot', '_check_for_easyapache_build', '_check_for_eol_apache', '_check_for_symlink_protection' ], "v$v does do ea3 specific checks";
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/pkg/Cpanel/Security/Advisor/Assessors/Permissions.pm:
--------------------------------------------------------------------------------
1 | package Cpanel::Security::Advisor::Assessors::Permissions;
2 |
3 | # Copyright (c) 2016, cPanel, Inc.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 |
31 | use base 'Cpanel::Security::Advisor::Assessors';
32 |
33 | sub generate_advice {
34 | my ($self) = @_;
35 | $self->_check_for_unsafe_permissions();
36 |
37 | return 1;
38 | }
39 |
40 | sub _check_for_unsafe_permissions {
41 | my ($self) = @_;
42 |
43 | my %test_files = (
44 | '/etc/shadow' => { 'perms' => [ 0200, 0600 ], 'uid' => 0, 'gid' => 0 },
45 | '/etc/passwd' => { 'perms' => [0644], 'uid' => 0, 'gid' => 0 }
46 | );
47 |
48 | for my $file ( keys %test_files ) {
49 | my $expected_attributes = $test_files{$file};
50 | my ( $current_mode, $uid, $gid ) = ( stat($file) )[ 2, 4, 5 ];
51 | my $perms_ok = 0;
52 | foreach my $allowed_perms ( @{ $expected_attributes->{'perms'} } ) {
53 | if ( ( $allowed_perms & 07777 ) == ( $current_mode & 07777 ) ) {
54 | $perms_ok = 1;
55 | last;
56 | }
57 | }
58 | if ( !$perms_ok ) {
59 | my $expected_mode = join( ' ', map { sprintf( '%04o', $_ ) } @{ $expected_attributes->{'perms'} } );
60 | my $actual_mode = sprintf( "%04o", $current_mode & 07777 );
61 | $self->add_warn_advice(
62 | 'key' => q{Permissions_are_non_default},
63 | 'text' => $self->_lh->maketext( "[_1] has non default permissions. Expected: [_2], Actual: [_3].", $file, $expected_mode, $actual_mode ),
64 | 'suggestion' => $self->_lh->maketext( "Review the permissions on [_1] to ensure they are safe", $file ),
65 | );
66 | }
67 |
68 | if ( $uid != $expected_attributes->{'uid'} or $gid != $expected_attributes->{'gid'} ) {
69 | $self->add_warn_advice(
70 | 'key' => q{Permissions_has_non_root_users},
71 | 'text' => $self->_lh->maketext( "[_1] has non root user and/or group", $file ),
72 | 'suggestion' => $self->_lh->maketext( "Review the ownership permissions on [_1]", $file ),
73 | );
74 | }
75 | }
76 |
77 | return 1;
78 | }
79 |
80 | 1;
81 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | Please contribute using [GitHub Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/cpanelinc/addon_securityadvisor/compare/).
4 |
5 | # Contributing Developer Notes
6 |
7 | ## Assessor Modules
8 |
9 | The Security Advisor encapsulates all of its checks inside of the Perl modules that are located in the [Assessors directory](pkg/Cpanel/Security/Advisor/Assessors).
10 |
11 | Each module is a subclass of [Cpanel::Security::Advisor::Assessors](pkg/Cpanel/Security/Advisor/Assessors.pm), as such each module has access to the methods that can add to the notifications.
12 |
13 | ### Adding New Checks
14 |
15 | Please evaluate the list of [Assessors](pkg/Cpanel/Security/Advisor/Assessors) to see if the check you wish to add fits in an existing module.
16 |
17 | For existing modules, it is usually preferable to your new check as an isolated subroutine that can be called from the `generate_advice` subroutine. This is the "main" subroutine that is called to drive all the checks.
18 |
19 | If you must create a new module, please study the structure of existing modules. Be prepared to justify why a new module is required and why an existing module is no place for the new check.
20 |
21 | ## Advice on Advice
22 |
23 | ### All Advisory Messages Require Unique Static Keys
24 |
25 | There are four types of advice defined in `pkg/Cpanel/Security/Advisor/Assessors.pm`, they are:
26 |
27 | * `$Cpanel::Security::Advisor::Assessors::ADVISE_GOOD`
28 | * `$Cpanel::Security::Advisor::Assessors::ADVISE_INFO`
29 | * `$Cpanel::Security::Advisor::Assessors::ADVISE_WARN`
30 | * `$Cpanel::Security::Advisor::Assessors::ADVISE_BAD`
31 |
32 | They are pretty self explanatory, but it is preferred that any message type of `ADVISE_WARN` or `ADVISE_BAD` also include a `suggestion` for further explanation of the message and what actions may be taken.
33 |
34 | Example,
35 |
36 | ```perl
37 | $security_advisor_obj->add_advice(
38 | {
39 | 'key' => 'EntropyChat_is_running', #<-- required, globally unique static message key
40 | 'type' => $Cpanel::Security::Advisor::ADVISE_BAD,
41 | 'text' => ['Entropy Chat is running.'],
42 | 'suggestion' => [
43 | 'Turn off Entropy Chat in the “[output,url,_1,Service Manager,_2,_3]” page.',
44 | $self->base_path('scripts/srvmng'),
45 | 'target',
46 | '_blank'
47 | ],
48 | }
49 | );
50 | ```
51 |
52 | ### All Advisory Messages Require Unique Static Keys
53 |
54 | The general method available to add an Advisory Message is called add_advice. You must specify the advice text and a globally unique static key that is shared by no other messages.
55 |
56 | Pull requests that contain new messages without this globally unique static key will be rejected.
57 |
58 | The convention being used for determining the static key is as follows. The key must begin with name of the assessor. For example, all keys in `Cpanel::Security::Advisor::Assessors::SSH` begin with *SSH*. What follows is a terse, but meaningful phrase using underscores rather than spaces.
59 |
60 | Here are some additional examples of helpful keys that are currently in use:
61 |
62 | * `Apache_vhosts_not_segmented`
63 | * `Brute_protection_enabled`
64 | * `Kernel_kernelcare_update_available`
65 |
66 | Once a pull request is merged into master, the static keys should never change. The keys are used to track message history, and changing them will result in the same issue that they are meant to solve; i.e., duplicate notifications for previously reported alerts.
67 |
68 | ### Preventing notification of some advice
69 |
70 | It may be desirable, in some cases, to have a piece of advice available interactively from WHM, but not send automated notifications about it. If so, you can direct this behavior in the advice creation:
71 |
72 | ```perl
73 | $security_advisor_obj->add_advice(
74 | {
75 | 'key' => 'EntropyChat_is_running',
76 | 'block_notify' => 1, # <--- any defined, nonzero value will do!
77 | 'type' => $Cpanel::Security::Advisor::ADVISE_BAD,
78 | 'text' => ['Entropy Chat is running.'],
79 | 'suggestion' => [
80 | 'Turn off Entropy Chat in the “[output,url,_1,Service Manager,_2,_3]” page.',
81 | $self->base_path('scripts/srvmng'),
82 | 'target',
83 | '_blank'
84 | ],
85 | }
86 | );
87 | ```
88 |
89 | It won't change the behavior when Security Advisor is used in WHM, but the automated notification script will skip this advice.
90 |
--------------------------------------------------------------------------------
/pkg/Cpanel/Security/Advisor/Assessors/Passwords.pm:
--------------------------------------------------------------------------------
1 | package Cpanel::Security::Advisor::Assessors::Passwords;
2 |
3 | # Copyright (c) 2013, cPanel, Inc.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 |
31 | use base 'Cpanel::Security::Advisor::Assessors';
32 |
33 | sub generate_advice {
34 | my ($self) = @_;
35 | $self->_check_for_low_pwstrength;
36 |
37 | return 1;
38 | }
39 |
40 | sub _check_for_low_pwstrength {
41 | my ($self) = @_;
42 |
43 | my $security_advisor_obj = $self->{'security_advisor_obj'};
44 |
45 | if ( !$security_advisor_obj->{'cpconf'}->{'minpwstrength'} || $security_advisor_obj->{'cpconf'}->{'minpwstrength'} < 25 ) {
46 | $security_advisor_obj->add_advice(
47 | {
48 | 'key' => 'Passwords_weak_permitted',
49 | 'type' => $Cpanel::Security::Advisor::ADVISE_BAD,
50 | 'text' => $self->_lh->maketext('Trivially weak passwords are permitted.'),
51 | 'suggestion' => $self->_lh->maketext(
52 | 'Configure Password Strength requirements in the “[output,url,_1,Password Strength Configuration,_2,_3]” area',
53 | $self->base_path('scripts/minpwstrength'),
54 | 'target',
55 | '_blank'
56 | ),
57 | }
58 | );
59 |
60 | }
61 | elsif ( $security_advisor_obj->{'cpconf'}->{'minpwstrength'} < 50 ) {
62 | $security_advisor_obj->add_advice(
63 | {
64 | 'key' => 'Passwords_strength_requirements_are_low',
65 | 'type' => $Cpanel::Security::Advisor::ADVISE_WARN,
66 | 'text' => $self->_lh->maketext('Password strength requirements are low.'),
67 | 'suggestion' => $self->_lh->maketext(
68 | 'Configure a Default Password Strength of at least 50 in the “[output,url,_1,Password Strength Configuration,_2,_3]” area',
69 | $self->base_path('scripts/minpwstrength'),
70 | 'target',
71 | '_blank'
72 | ),
73 | }
74 | );
75 |
76 | }
77 | elsif ( $security_advisor_obj->{'cpconf'}->{'minpwstrength'} < 65 ) {
78 | $security_advisor_obj->add_advice(
79 | {
80 | 'key' => 'Passwords_strength_requirements_are_moderate',
81 | 'type' => $Cpanel::Security::Advisor::ADVISE_INFO,
82 | 'text' => $self->_lh->maketext('Password strength requirements are moderate.'),
83 | 'suggestion' => $self->_lh->maketext(
84 | 'Configure a Default Password Strength of at least 65 in the “[output,url,_1,Password Strength Configuration,_2,_3]” area',
85 | $self->base_path('scripts/minpwstrength'),
86 | 'target',
87 | '_blank'
88 | ),
89 | }
90 | );
91 |
92 | }
93 | else {
94 | $security_advisor_obj->add_advice(
95 | {
96 | 'key' => 'Passwords_strengths_requirements_are_strong',
97 | 'type' => $Cpanel::Security::Advisor::ADVISE_GOOD,
98 | 'text' => $self->_lh->maketext('Password strength requirements are strong.'),
99 | }
100 | );
101 | }
102 |
103 | return 1;
104 | }
105 |
106 | 1;
107 |
--------------------------------------------------------------------------------
/pkg/Cpanel/Security/Advisor/Assessors/_Self.pm:
--------------------------------------------------------------------------------
1 | package Cpanel::Security::Advisor::Assessors::_Self;
2 |
3 | # Copyright (c) 2021, cPanel, L.L.C.
4 | # All rights reserved.
5 | # http://cpanel.net
6 | #
7 | # Redistribution and use in source and binary forms, with or without
8 | # modification, are permitted provided that the following conditions are met:
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above copyright
12 | # notice, this list of conditions and the following disclaimer in the
13 | # documentation and/or other materials provided with the distribution.
14 | # * Neither the name of the owner nor the names of its contributors may
15 | # be used to endorse or promote products derived from this software
16 | # without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
22 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | use strict;
30 | use warnings;
31 | use base 'Cpanel::Security::Advisor::Assessors';
32 |
33 | use Cpanel::RPM::Versions::File ();
34 |
35 | # The purpose of this assessor module is to report conditions which may render
36 | # the provided advice untrustworthy or invalid. Currently, this is limited to
37 | # determining whether the RPM database is acting as expected, since several
38 | # other assessors rely on good RPM data.
39 |
40 | # Logic behind this number: A barebones CentOS 6 container has 129(?) RPM packages.
41 | # Round down to one significant figure.
42 | use constant OS_RPM_COUNT_WARN_THRESHOLD => 100;
43 |
44 | sub version { return '1.01'; }
45 |
46 | sub generate_advice {
47 | my ($self) = @_;
48 |
49 | $self->_check_rpm() if $self->_distro_uses_rpm();
50 |
51 | return 1;
52 | }
53 |
54 | sub _check_rpm {
55 | my ($self) = @_;
56 |
57 | # Both primes the cache and ensures that the test is run.
58 | my $installed_rpms = $self->get_installed_rpms();
59 |
60 | my $cache = $self->{'security_advisor_obj'}->{'_cache'};
61 | if ( exists $cache->{'timed_out'} && $cache->{'timed_out'} ) {
62 | $self->add_bad_advice(
63 | 'key' => 'RPM_timed_out',
64 | 'text' => $self->_lh->maketext('Security Advisor timed out while reading the RPM database of packages.'),
65 | 'suggestion' => $self->_lh->maketext( "Security Advisor may include inaccurate results until it can fully read the RPM database. To resolve this, reduce the load on your system and then rebuild the RPM database with the following interface: [output,url,_1,Rebuild RPM Database,_2,_3].", $self->base_path('scripts/dialog?dialog=rebuildrpmdb'), 'target', '_blank' ),
66 | 'block_notify' => 1,
67 | );
68 | }
69 | elsif ( exists $cache->{'died'} && $cache->{'died'} ) {
70 | $self->add_bad_advice(
71 | 'key' => 'RPM_broken',
72 | 'text' => $self->_lh->maketext('Security Advisor detected RPM database corruption.'),
73 | 'suggestion' => $self->_lh->maketext( "Security Advisor may include inaccurate results until it can cleanly read the RPM database. To resolve this, rebuild the RPM database with the following interface: [output,url,_1,Rebuild RPM Database,_2,_3].", $self->base_path('scripts/dialog?dialog=rebuildrpmdb'), 'target', '_blank' ),
74 | 'block_notify' => 1,
75 | );
76 | }
77 | elsif ( ref $installed_rpms eq 'HASH' && scalar keys %$installed_rpms <= scalar( keys %{ Cpanel::RPM::Versions::File->new()->list_rpms_in_state('installed') } ) + OS_RPM_COUNT_WARN_THRESHOLD ) {
78 | $self->add_warn_advice(
79 | 'key' => 'RPM_too_few',
80 | 'text' => $self->_lh->maketext('The RPM database is smaller than expected.'),
81 | 'suggestion' => $self->_lh->maketext("Security Advisor may include inaccurate results if the RPM database of packages is incomplete. To resolve this, check the cPanel update logs for RPM issues."),
82 | 'block_notify' => 1,
83 | );
84 | }
85 |
86 | return;
87 | }
88 |
89 | sub _distro_uses_rpm {
90 | my ($self) = @_;
91 |
92 | # Optimistically try to query Cpanel::OS:
93 | my $answer = eval {
94 | require Cpanel::OS;
95 | Cpanel::OS::is_rpm_based();
96 | };
97 | return $answer unless $@;
98 |
99 | # cPanel is too old for that to work. Since the rpm program can't be relied
100 | # upon, query for the existence of /etc/redhat-release:
101 | return -e '/etc/redhat-release';
102 | }
103 |
104 | 1;
105 |
--------------------------------------------------------------------------------
/pkg/cgi/addon_securityadvisor.cgi:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | eval 'if [ -x /usr/local/cpanel/3rdparty/bin/perl ]; then exec /usr/local/cpanel/3rdparty/bin/perl -x -- $0 ${1+"$@"}; else exec /usr/bin/perl -x $0 ${1+"$@"}; fi;' ## no critic qw(ProhibitStringyEval RequireUseStrict) -*-mode:perl-*-
3 | if 0;
4 |
5 | #!/usr/bin/perl
6 | #WHMADDON:addonupdates:Security Advisor Tool
7 | #ACLS:all
8 |
9 | # Copyright (c) 2013, cPanel, Inc.
10 | # All rights reserved.
11 | # http://cpanel.net
12 | #
13 | # Redistribution and use in source and binary forms, with or without
14 | # modification, are permitted provided that the following conditions are met:
15 | # * Redistributions of source code must retain the above copyright
16 | # notice, this list of conditions and the following disclaimer.
17 | # * Redistributions in binary form must reproduce the above copyright
18 | # notice, this list of conditions and the following disclaimer in the
19 | # documentation and/or other materials provided with the distribution.
20 | # * Neither the name of the owner nor the names of its contributors may
21 | # be used to endorse or promote products derived from this software
22 | # without specific prior written permission.
23 | #
24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 | # DISCLAIMED. IN NO EVENT SHALL cPanel, L.L.C. BE LIABLE FOR ANY
28 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 |
35 | package cgi::addon_securityadvisor;
36 |
37 | use strict;
38 |
39 | BEGIN {
40 | unshift @INC, '/var/cpanel/addons/securityadvisor/perl', '/usr/local/cpanel';
41 | }
42 |
43 | use Whostmgr::ACLS ();
44 | use Whostmgr::HTMLInterface ();
45 | use Cpanel::Form ();
46 | use Cpanel::Template ();
47 | use Cpanel::Comet ();
48 | use Cpanel::Rlimit ();
49 | use Cpanel::Encoder::URI ();
50 | use POSIX ();
51 |
52 | # from /var/cpanel/addons/securityadvisor/perl
53 | use Cpanel::Security::Advisor ();
54 |
55 | run(@ARGV) unless caller();
56 |
57 | sub run {
58 | _check_acls();
59 | my $form = Cpanel::Form::parseform();
60 | if ( $form->{'start_scan'} ) {
61 | _start_scan( $form->{'channel'} );
62 | exit;
63 | }
64 | else {
65 | _headers("text/html");
66 |
67 | my $template_file =
68 | -e '/var/cpanel/addons/securityadvisor/templates/main.tmpl'
69 | ? '/var/cpanel/addons/securityadvisor/templates/main.tmpl'
70 | : '/usr/local/cpanel/whostmgr/docroot/templates/securityadvisor/main.tmpl';
71 |
72 | Cpanel::Template::process_template(
73 | 'whostmgr',
74 | {
75 | 'template_file' => $template_file,
76 | 'security_advisor_version' => $Cpanel::Security::Advisor::VERSION,
77 | },
78 | );
79 | }
80 |
81 | return 1;
82 | }
83 |
84 | sub _check_acls {
85 | Whostmgr::ACLS::init_acls();
86 |
87 | if ( !Whostmgr::ACLS::hasroot() ) {
88 | _headers('text/html');
89 | Whostmgr::HTMLInterface::defheader('cPanel Security Advisor');
90 | print <<'EOM';
91 |
92 |
93 |