How to Secure Apache with Let's Encrypt on CentOS 9? - apache

I am failing to find a way to configure an SSL certificate for my droplet running on Centos 9 and an Apache server (version: 2.4.51).
I tried to follow this tutorial but all the package managers I have searched (yum, snap & dnf) do not have the required python3-certbot-apache package nor any python*-certbot-apache package (Ofcourse, the turorial was meant for Centos 8 but I can’t find any reference to securing centos 9). Only snap has the certbot package but that’s not enough to help me at least just obtain an SSL certificate.
Any form of help will be greatly appreciated.
Oooh, just incase this might have valueable information for the bright minds, here are the error logs I get if I try to run, for example, sudo certbot --apache:
2022-04-01 15:54:42,360:DEBUG:urllib3.connectionpool:http://localhost:None "GET /v2/connections?snap=certbot&interface=content HTTP/1.1" 200 97
2022-04-01 15:54:42,830:DEBUG:certbot._internal.main:certbot version: 1.25.0
2022-04-01 15:54:42,831:DEBUG:certbot._internal.main:Location of certbot entry point: /snap/certbot/1888/bin/certbot
2022-04-01 15:54:42,831:DEBUG:certbot._internal.main:Arguments: ['--apache', '--preconfigured-renewal']
2022-04-01 15:54:42,831:DEBUG:certbot._internal.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#apache,PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2022-04-01 15:54:42,846:DEBUG:certbot._internal.log:Root logging level set at 30
2022-04-01 15:54:42,847:DEBUG:certbot._internal.plugins.selection:Requested authenticator apache and installer apache
2022-04-01 15:54:42,943:DEBUG:certbot_apache._internal.configurator:Apache version is 2.4.51
2022-04-01 15:54:42,986:WARNING:certbot_apache._internal.apache_util:Error in checking parameter list:
2022-04-01 15:54:42,986:DEBUG:certbot._internal.plugins.disco:Misconfigured PluginEntryPoint#apache: Apache is unable to check whether or not the module is loaded because Apache is misconfigured. Traceback (most recent call last):
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot/_internal/plugins/disco.py", line 160, in prepare self._initialized.prepare()
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/configurator.py", line 368, in prepare self.parser = self.get_parser()
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/override_centos.py", line 79, in get_parser return CentOSParser(
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/override_centos.py", line 164, in __init__ super().__init__(*args, **kwargs)
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/parser.py", line 79, in __init__ self.update_runtime_variables()
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/override_centos.py", line 169, in update_runtime_variables super().update_runtime_variables()
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/parser.py", line 299, in update_runtime_variables self.update_defines()
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/parser.py", line 305, in update_defines self.variables = apache_util.parse_defines(self.configurator.options.ctl) File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/apache_util.py", line 153, in parse_defines matches = parse_from_subprocess(define_cmd, r"Define: ([^ \n]*)")
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/apache_util.py", line 208, in parse_from_subprocess stdout = _get_runtime_cfg(command)
File "/var/lib/snapd/snap/certbot/1888/lib/python3.8/site-packages/certbot_apache/_internal/apache_util.py", line 241, in _get_runtime_cfg raise errors.MisconfigurationError( certbot.errors.MisconfigurationError: Apache is unable to check whether or not the module is loaded because Apache is misconfigured.
2022-04-01 15:54:42,988:DEBUG:certbot._internal.plugins.selection:Single candidate plugin: * apache Description: Apache Web Server plugin Interfaces: Installer, Authenticator, Plugin Entry point: apache = certbot_apache._internal.entrypoint:ENTRYPOINT Initialized: Prep: Apache is unable to check whether or not the module is loaded because Apache is misconfigured.
2022-04-01 15:54:42,989:DEBUG:certbot._internal.plugins.selection:Selected authenticator None and installer None

Just incase someone faces the same issue, at the time I posted there was no support for certbot on Centos 9 hence there was no solution to the problem I was facing. In my case I had the luxury of using a different centos version and so that's what I did.

You can yse Certbot from EPEL repository, but apachectl from Apache on CentOS9 doesn't to, what Certbot is expecting. You have to comment out one exception, as described in
https://github.com/certbot/certbot/issues/8945#issuecomment-1185054399
Unfortunately, Certbot on EPEL is not patched for that and You'll have to do it after every Certbot upgrade. It works fine on several of mine CentOS 9 hosts.

Related

Cuckoo sandbox, api error after installation

I'm investigating the possibility of using cuckoo sandbox as a malware detonator in series with Cortex.
I've (seemingly) installed all of the dependencies, enabled reporting, and elasticsearch in the config files, and started the webserver using the below command without issues.
sudo cuckoo web runserver [ip redacted]:[port]
I am able to connect to my web instance without errors on the browser side. But, in the stdout, I get the following:
2018-07-06 05:32:19,152 [django.request] ERROR: Internal Server Error: /cuckoo/api/status
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/cuckoo/web/utils.py", line 55, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/http.py", line 45, in inner
return func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/cuckoo/web/controllers/cuckoo/api.py", line 45, in status
temp_file = Files.temp_put("")
File "/usr/local/lib/python2.7/dist-packages/cuckoo/common/files.py", line 97, in temp_put
prefix="upload_", dir=path or temppath()
File "/usr/lib/python2.7/tempfile.py", line 314, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/lib/python2.7/tempfile.py", line 244, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 2] No such file or directory: '/tmp/cuckoo-tmp-root/upload_IUQt4r'
[06/Jul/2018 05:32:19] "POST /analysis/api/tasks/recent/ HTTP/1.1" 200 13
[06/Jul/2018 05:32:19] "GET /cuckoo/api/status HTTP/1.1" 500 12976
In addition to this error, I both cannot upload a file, or submit a URL, both resulting in exactly the same error.
Does anyone here have experience setting up Cuckoo that can give me a hint? Not sure if this is a dependency issue, or a configuration issue after installation?
Thanks in advance!
Had the same problem. Mine was due to the fact that my virtual environment's root did not include the default folder "/tmp/" that cuckoo tries to establish as a default temp file path in its "files.py". Yours could be related to the directory structure changing in "~" when sudo'ing to run the server.
Either way, the fix was to update "cuckoo.conf"'s "tmppath" setting from blank to an explicit directory with no permissions issues (i.e. "/tmp/").
Once I updated this, the error stopped and my cuckoo api was able to run properly.

Upgrade failed from Plone 4.3.8 to 5.0.2 in Debian 8

I had a plone instance (4.3.6) with site "keti" and upgraded (copy Data.fs and blobtorage to the new instance) it successfully to 4.3.8.
Ps. There are many contents in Chinese in the site "keti".
But failed to upgrade it to 5.0.2. This is the message in event.log: http://pastie.org/10773173.
(With activated add-ons: Diazo theme support and Static resource storage, I tried successfully for a empty site migration from 4.3.8 to 5.0.2)
Any suggestion?
Best regards.
Hugo
Have you installed plone.app.intid in your addons? When not, do this. Clear your Catalog and Rebuild. I think the problem is in
register_all_content_for_intids
obj = brain.getObject()
File "/**/Products.ZCatalog-3.0.2-py2.7.egg/Products/ZCatalog/CatalogBrains.py", line 108, in getObject
return parent.restrictedTraverse(path[-1])
File "/**/Zope2-2.13.23-py2.7.egg/OFS/Traversable.py", line 317, in restrictedTraverse
return self.unrestrictedTraverse(path, default, restricted=True)
File "/**/Zope2-2.13.23-py2.7.egg/OFS/Traversable.py", line 300, in unrestrictedTraverse
raise e
NotFound: 1306115487
It's only an Idea, not a solution.

Plone 5.0 and Carousel 2.2.1

This question regards Plone 5.0 and add-on Carousel 2.2.1. The version of Carousel, taken from /usr/local/Plone/buildout-cache/eggs/Products.Carousel-2.2.1-py2.7.egg/EGG-INFO, is:
Metadata-Version: 1.1
Name: Products.Carousel
Version: 2.2.1
Summary: Carousel allows you to add user-configurable rotating banners to any section of a Plone site.
Home-page: <https://github.com/collective/Products.Carousel>
Author: Groundwire
The following shows the results of attempting to start Plone in the foreground. Plone started to a degree then crashed due to a problem with Carousel. The beginning and end of the output are shown; lots of diagnostics in the middle of the output were elided.
root#wandboard # /bin/pwd; /bin/date; /usr/bin/sudo -u plone_daemon /usr/local/Plone/zinstance/bin/instance fg
/usr/local/Plone-5.0/zinstance/var
Sun Jan 10 18:35:19 EST 2016
2016-01-10 18:35:28 INFO ZServer HTTP server started at Sun Jan 10 18:35:28 2016
Hostname: 0.0.0.0
Port: 8080
2016-01-10 18:35:38 WARNING ZODB.blob (13658) Blob dir /usr/local/Plone-5.0/zinstance/var/blobstorage/ has insecure mode setting
2016-01-10 18:35:57 INFO Plone OpenID system packages not installed, OpenID support not available
Traceback (most recent call last):
File "/usr/local/Plone-5.0/zinstance/parts/instance/bin/interpreter", line 288, in <module>
exec(compile(`__file__f.read(), __file__, "exec")`)
File "/usr/local/Plone-5.0/buildout-cache/eggs/Zope2-2.13.23-py2.7.egg/Zope2/Startup/run.py", line 76, in <module>
run()
File "/usr/local/Plone-5.0/buildout-cache/eggs/Zope2-2.13.23-py2.7.egg/Zope2/Startup/run.py", line 22, in run
starter.prepare()
.
.
.
many more diagnostics elided
.
.
.
File "/usr/local/Plone-5.0/buildout-cache/eggs/zope.configuration-3.7.4-py2.7.egg/zope/configuration/fields.py", line 139, in fromUnicode
raise schema.ValidationError(v)
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/usr/local/Plone-5.0/zinstance/parts/instance/etc/site.zcml", line 16.2-16.23
ZopeXMLConfigurationError: File "/usr/local/Plone-5.0/buildout-cache/eggs/Products.Carousel-2.2.1-py2.7.egg/Products/Carousel/configure.zcml", line 23.2-23.32
ZopeXMLConfigurationError: File "/usr/local/Plone-5.0/buildout-cache/eggs/Products.Carousel-2.2.1-py2.7.egg/Products/Carousel/browser/configure.zcml", line 24.2-31.6
ConfigurationError: ('Invalid value for', 'class', 'ImportError: Module plone.app.layout.viewlets.common has no global ContentActionsViewlet')
In /usr/local/Plone-5.0/buildout-cache/eggs/Products.Carousel-2.2.1-py2.7.egg/Products/Carousel/browser/configure.zcml lines 24 to 31 are:
<browser:viewlet
name="plone.contentactions"
for="Products.Carousel.interfaces.ICarouselFolder"
view="..interfaces.ICarouselSettingsView"
manager="plone.app.layout.viewlets.interfaces.IContentViews"
class="plone.app.layout.viewlets.common.ContentActionsViewlet"
permission="zope2.View"
/>
What is a ContentActionsViewlet? Can I fix this by somehow installing a global ContentActionsViewlet or is this something the Carousel add-on authors would best be able to fix? This same Carousel add-on works fine with Plone 4.3.2. Thanks.
The addon is simply not Plone 5 compatible.
The ContentActionsViewlet was merged into the ContentViewsViewlet See plone.app.layout 2.5.8
Unfortunately this will not be the only issue.
You need to contact the maintainer, probably they are willing to upgrade the package, or you may try it by yourself:
Plone 5 Uprade guide: http://docs.plone.org/develop/addons/upgrade_to_50.html
Good example for package, which supports Plone 4.3.x and Plone 5 --> https://github.com/plone/plone.app.mosaic

OpenERP 6.1 No handler found

I have been running OpenERP 6.1 on Ubuntu server 12.04 LTS for the last 3 or 4 months. During that time I restarted (rebooted) Ubuntu several times. I installed OpenERP from a downloaded package from their web site. I manually added the pychart.py module as it wouldn't start openerp-server without it. Everything was running smoothly until now.
Today I replaced the procurement.pyc file with a modified recompiled version and backed up the original version under a different name.
I then restarted openerp-server (sudo service openerp restart).
I connected to openerp from my Firefox windows client, and got a "No handler found" white screen.
Before all that manipulation it was working fine. So I thought I'd stuffed it up with my change and decided to revert back the original procurement.pyc file.
Restarted openerp-server following the same procedure as above but still got the "No handler found" white screen.
Rebooted Ubuntu, restarted openerp-server from the services and manually numerous times, refreshed the firefox connection, added the port 8069/tcp OUT to UFW as it was only IN. Nothing helped, I still get the "No handler found" white screen.
How is that possible???
I read other identical issues on the net from other people, but every time they seem to have found their own resolution.
The only thing I rely on is the log file:
2013-01-07 14:10:03,958 1381 INFO ? openerp: OpenERP version 6.1-20121008-233119
2013-01-07 14:10:03,958 1381 INFO ? openerp: addons paths: /home/download/openerp- 6.1-20121008-233119/openerp/addons
2013-01-07 14:10:03,958 1381 INFO ? openerp: database hostname: localhost
2013-01-07 14:10:03,958 1381 INFO ? openerp: database port: 5432
2013-01-07 14:10:03,959 1381 INFO ? openerp: database user: openerp
2013-01-07 14:10:03,959 1381 INFO ? openerp.service.netrpc_server: starting NET-RPC service on 0.0.0.0:8070
2013-01-07 14:10:03,960 1381 INFO ? openerp.netsvc: Starting 1 services
2013-01-07 14:10:03,986 1381 INFO ? openerp.wsgi.core: HTTP service (werkzeug) running on 0.0.0.0:8069
2013-01-07 14:10:04,062 1381 INFO ? openerp.addons.web: embedded mode
2013-01-07 14:10:04,226 1381 CRITICAL ? openerp.modules.module: Couldn't load module web
2013-01-07 14:10:04,227 1381 CRITICAL ? openerp.modules.module: No module named sale_order
2013-01-07 14:10:04,227 1381 ERROR ? openerp: Failed to load server-wide module `web`.
The `web` module is provided by the addons found in the `openerp-web` project.
Maybe you forgot to add those addons in your addons_path configuration.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20121008_233119-py2.7.egg/EGG-INFO/scripts/openerp-server", line 252, in <module>
openerp.modules.module.load_openerp_module(m)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20121008_233119-py2.7.egg/openerp/modules/module.py", line 419, in load_openerp_module
getattr(sys.modules['openerp.addons.' + module_name], info['post_load'])()
File "/home/download/openerp-6.1-20121008-233119/openerp/addons/web/__init__.py", line 29, in wsgi_postload
app = common.http.Root(o)
File "/home/download/openerp-6.1-20121008-233119/openerp/addons/web/common/http.py", line 453, in __init__
static_dirs = self._load_addons(openerp_addons_namespace)
File "/home/download/openerp-6.1-20121008-233119/openerp/addons/web/common/http.py", line 523, in _load_addons
m = __import__('openerp.addons.' + module)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20121008_233119-py2.7.egg/openerp/modules/module.py", line 139, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/home/download/openerp-6.1-20121008-233119/openerp/addons/sale/__init__.py", line 29, in <module>
import report
File "/home/download/openerp-6.1-20121008-233119/openerp/addons/sale/report/__init__.py", line 22, in <module>
import sale_order
ImportError: No module named sale_order
2013-01-07 14:10:04,228 1381 INFO ? openerp: OpenERP server is running, waiting for connections...
2013-01-07 14:10:28,283 1381 INFO ? werkzeug: 192.xxx.xx.xx - - [07/Jan/2013 14:10:28] "GET /web/webclient/home HTTP/1.1" 404 -
2013-01-07 14:10:37,390 1381 INFO ? openerp.netsvc: Stopping 1 services
For clarification purpose, the IP address 192.xxx.xx.xx corresponds to the client trying to access openerp over the network and receiving the "No handler found" message. A try on another client has had the same result.
Why the two CRITICAL lines? And why couldn't it load module Web when it wasn't a problem an hour before? It tells me the sale_order module doesn't exists but it does.
Some resolution says to add the path to the addons folder into the openerp-server.init file. But why would I do this when it didn't ask for it an hour before? Also it is mentioning an openerp-web project, which apparently turns into an openerp-web folder under addons once installed, and should be specified into the addons path. I currently do not have this folder and never needed it before, so I don't believe I am on the right path to solve my problem here.
Has anyone got any idea? This makes absolutely no sense to me.
Thanks for the help.
Please check in the sale module,in the report folder is there a file named sale_order.py?
If not please download the sale module and replace with your sale module. sale_order.py have parser for sale order report. If you dont want the report please comment the line import sale_order from the init.py file in the report folder of sale module.
Nowhere in standard modules, there is no module named sale_order. Perhaps sale module. Check dependencies in your customized module.
It looks like there's something other than the Debian package installed, and the two are interacting in Bad Ways. Look at the paths in the traceback:
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20121008_233119-py2.7.egg/EGG-INFO/scripts/openerp-server", line 252, in <module>
compared to this one:
File "/home/download/openerp-6.1-20121008-233119/openerp/addons/sale/__init__.py", line 29, in <module>
This is most definately not from an installed Debian package, and in any case it's weird that you have bits of OpenERP in such different places. Is this expected in your environment? If not, I bet this is the problem.

Upgrade from trac 0.10.3 to 0.12 mod_python database error

I´m trying to upgrade trac! from 0.10.3 to 0.12. Need help, i basiclally did steps shown here
http://trac.edgewall.org/wiki/TracUpgrade
So i went through this commands without errors:
todasana:~# easy_install —upgrade Trac0.12 Searching for Trac0.12
todasana:~# trac-admin /usr/local/apache2/htdocs/trac_catw3 upgrade
todasana:~# trac-admin /usr/local/apache2/htdocs/trac_catw3 wiki upgrade
todasana:~# trac-admin /usr/local/apache2/htdocs/trac_catw3 repository resync ‘*’
Didn´t do Step 5 Refresh static resources, because i did not understand it, and i think it does not apply to me: trac-admin /path/to/env deploy /deploy/path
then i
restarted apache:
/etc/init.d/apache2 restart
got this error in the browser now:
Mod_python error: "PythonHandler trac.web.modpython_frontend"
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
result = object(req)
File "/var/lib/python-support/python2.4/trac/web/modpython_frontend.py", line 87, in handler
gateway.run(dispatch_request)
File "/var/lib/python-support/python2.4/trac/web/wsgi.py", line 87, in run
response = application(self.environ, self._start_response)
File "/var/lib/python-support/python2.4/trac/web/main.py", line 377, in dispatch_request
env = _open_environment(env_path, run_once=run_once)
File "/var/lib/python-support/python2.4/trac/web/main.py", line 58, in _open_environment
env_cache[env_path] = open_environment(env_path)
File "/var/lib/python-support/python2.4/trac/env.py", line 435, in open_environment
if env.needs_upgrade():
File "/var/lib/python-support/python2.4/trac/env.py", line 315, in needs_upgrade
if participant.environment_needs_upgrade(db):
File "/var/lib/python-support/python2.4/trac/env.py", line 373, in environment_needs_upgrade
raise TracError, 'Database newer than Trac version'
TracError: Database newer than Trac version
got Python 2.4.4 (#2, Jan 24 2010, 11:19:18)
mysql: Server version: 5.0.32-Debian_7etch11-log Debian etch distribution
IT OCCOURS TO ME THAT SOMETHING SHOULD BE DONE WITH THE DATABASE OR CONFIG FILES, BUT NOT SURE WHAT BECAUSE THERE IS NOTHING IN THE DOCS ABOUT IT!
Guys have a great day!!
It sounds like the version of Trac being run by Apache is the older version and not the version you just installed. Verify that the version of Trac you are running is the version you think you are running.