EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #09608
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- To: David R Newman <drn@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- From: zen zenitram <quickfire28@gmail.com>
- Date: Thu, 15 Feb 2024 10:41:26 +0800
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
(2)No such file or directory: AH02291: Cannot access directory '/etc/apache2/logs/' for error log of vhost defined at /opt/eprints3/archives/aea/ssl/securevhost.conf:1
AH00014: Configuration check failed
Action 'configtest' failed.
The Apache error log may have more information.
apache2.conf conf-available conf-enabled envvars magic mods-available mods-enabled ports.conf sites-available sites-enabled
root@edocs-001:/etc/apache2# cd sites-enabled/
root@edocs-001:/etc/apache2/sites-enabled# ls
default-ssl.conf eprints.conf
root@edocs-001:/etc/apache2/sites-enabled#
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
# Server Certificate Chain:
# Point SSLCertificateChainFile at a file containing the
# concatenation of PEM encoded CA certificates which form the
# certificate chain for the server certificate. Alternatively
# the referenced file can be the same as SSLCertificateFile
# when the CA certificates are directly appended to the server
# certificate for convinience.
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
# Certificate Authority (CA):
# Set the CA certificate verification path where to find CA
# certificates for client authentication or alternatively one
# huge file containing all of them (file must be PEM encoded)
# Note: Inside SSLCACertificatePath you need hash symlinks
# to point to the certificate files. Use the provided
# Makefile to update the hash symlinks after changes.
#SSLCACertificatePath /etc/ssl/certs/
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
# Certificate Revocation Lists (CRL):
# Set the CA revocation path where to find CA CRLs for client
# authentication or alternatively one huge file containing all
# of them (file must be PEM encoded)
# Note: Inside SSLCARevocationPath you need hash symlinks
# to point to the certificate files. Use the provided
# Makefile to update the hash symlinks after changes.
#SSLCARevocationPath /etc/apache2/ssl.crl/
#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
# Client Authentication (Type):
# Client certificate verification type and depth. Types are
# none, optional, require and optional_no_ca. Depth is a
# number which specifies how deeply to verify the certificate
# issuer chain before deciding the certificate is not valid.
#SSLVerifyClient require
#SSLVerifyDepth 10
# SSL Engine Options:
# Set various options for the SSL engine.
# o FakeBasicAuth:
# Translate the client X.509 into a Basic Authorisation. This means that
# the standard Auth/DBMAuth methods can be used for access control. The
# user name is the `one line' version of the client's X.509 certificate.
# Note that no password is obtained from the user. Every entry in the user
# file needs this password: `xxj31ZMTZzkVA'.
# o ExportCertData:
# This exports two additional environment variables: SSL_CLIENT_CERT and
# SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
# server (always existing) and the client (only existing when client
# authentication is used). This can be used to import the certificates
# into CGI scripts.
# o StdEnvVars:
# This exports the standard SSL/TLS related `SSL_*' environment variables.
# Per default this exportation is switched off for performance reasons,
# because the extraction step is an expensive operation and is usually
# useless for serving static content. So one usually enables the
# exportation for CGI and SSI requests only.
# o OptRenegotiate:
# This enables optimized SSL connection renegotiation handling when SSL
# directives are used in per-directory context.
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
# SSL Protocol Adjustments:
# The safe and default but still SSL/TLS standard compliant shutdown
# approach is that mod_ssl sends the close notify alert but doesn't wait for
# the close notify alert from client. When you need a different shutdown
# approach you can use one of the following variables:
# o ssl-unclean-shutdown:
# This forces an unclean shutdown when the connection is closed, i.e. no
# SSL close notify alert is send or allowed to received. This violates
# the SSL/TLS standard but is needed for some brain-dead browsers. Use
# this when you receive I/O errors because of the standard approach where
# mod_ssl sends the close notify alert.
# o ssl-accurate-shutdown:
# This forces an accurate shutdown when the connection is closed, i.e. a
# SSL close notify alert is send and mod_ssl waits for the close notify
# alert of the client. This is 100% SSL/TLS standard compliant, but in
# practice often causes hanging connections with brain-dead browsers. Use
# this only for browsers where you know that their SSL implementation
# works correctly.
# Notice: Most problems of broken clients are also related to the HTTP
# keep-alive facility, so you usually additionally want to disable
# keep-alive for those clients, too. Use variable "nokeepalive" for this.
# Similarly, one has to force some clients to use HTTP/1.0 to workaround
# their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
# "force-response-1.0" for this.
# BrowserMatch "MSIE [2-6]" \
# nokeepalive ssl-unclean-shutdown \
# downgrade-1.0 force-response-1.0
</VirtualHost>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Hi Zen,
Sorry, that last line should have been:
openssl x509 -req -days 3650 -in EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.csr -signkey EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.key -out EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.crt
Also, you do not want to set challenge password when creating the key. As Apache will not be able to provide this password when it tries to load the key.
Regards
David Newman
On 14/02/2024 09:18, zen zenitram wrote:
CAUTION: This e-mail originated outside the University of Southampton.Hello Sir David
I tried your solution but i got stuck at creating self-signed certificate.
Here is the error
lease enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:****
An optional company name []:ers
root@edocs-001:~# openssl x509 -req -days 3650 -in cert.csr -signkey /opt/eprints3/archives/aea/ssl/thesis.dlsud.edu.ph.key -out /opt/eprints3/archives/aea/ssl/thesis.dlsud.edu.ph.crt
Can't open "cert.csr" for reading, No such file or directory
4017445ACF7F0000:error:80000002:system library:BIO_new_file:No such file or directory:../crypto/bio/bss_file.c:67:calling fopen(cert.csr, r)
4017445ACF7F0000:error:10000080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:75:
Unable to load certificate request input
root@edocs-001:~#
but when i look at ssl folderit has the .csr file and .key file
root@edocs-001:/opt/eprints3/archives/aea/ssl# ls
thesis.dlsud.edu.ph.csr thesis.dlsud.edu.ph.key
do i need to fix permission and ownership of the ssl directory?Thank you!
On Tue, Feb 13, 2024 at 5:36 PM David R Newman <drn@ecs.soton.ac.uk> wrote:
Hi Zen,
The Let's Encrypt page was just an example, as bar the certificate configuration it contains all the configuration you need to enable HTTPS. I will see if I can walk you through this:
1. Create a directory called ssl under your archive (substitute EPRINTS_PATH and ARCHIVE_ID as appropriate):
mkdir EPRINTS_PATH/archives/ARCHIVE_ID/ssl/
2. Create a self-signed certificate and key (substitute EPRINTS_PATH and ARCHIVE_ID as appropriate):
openssl genrsa -out EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.key 4096
openssl req -new -key EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.key -out EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.csr
openssl x509 -req -days 3650 -in cert.csr -signkey EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.key -out EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.crt
3. Add the following Apache configuration file under EPRINTS_PATH/archives/ARCHIVE_ID/ssl/securevhost.conf (substituting EPRINTS_PATH and ARCHIVE_ID as appropriate):
<VirtualHost *:443>
ServerName thesis.dlsud.edu.ph:443
# Enable HSTS
Header always set Strict-Transport-Security "max-age=63072000;"
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder on
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
SSLCertificateFile EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.crt
SSLCertificateKeyFile EPRINTS_PATH/archives/ARCHIVE_ID/ssl/thesis.dlsud.edu.ph.key
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
LogLevel warn
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
Include EPRINTS_PATH/cfg/apache_ssl/ARCHIVE_ID.conf
PerlTransHandler +EPrints::Apache::Rewrite
</VirtualHost>
3. Make sure this securehost.conf configuration file is included in the same Apache configuration (under /etc/httpd/ or /etc/apache2/) you edited to include EPRINTS_PATH/cfg/apache.conf. This will require the following configuration line (substituting EPRINTS_PATH and ARCHIVE_ID as appropriate):
Include EPRINTS_PATH/archives/ARCHIVE_ID/ssl/securevhost.conf
4. Edit EPRINTS_PATH/archives/ARCHIVE_ID/cfg/cfg.d/10_core.pl so it looks as follows (assuming you only have the hostname thesis.dlsud.edu.ph):
$c->{host} = undef;
$c->{port} = 80;
$c->{aliases} = [];
$c->{securehost} = 'thesis.dlsud.edu.ph';
$c->{secureport} = 443;
$c->{http_root} = undef;
5. Test you EPrints configuration and regenerate EPrints Apache configuration with the following two commands (substitute EPRINTS_PATH as appropriate):
EPRINTS_PATH/bin/epadmin test
EPRINTS_PATH/bin/generate_apacheconf --system --replace
6. Assuming neither of those commands generate errors, check you Apache configuration and restart Apache. (There may be an issue with there already be a generic HTTPS host under /etc/httpd/conf.d/ssl.conf. If so, then you need to remove the whole VirtualHost block (i.e. between <VirtualHost> and </VirtualHost> inclusive) in this file then try these two commands again).
apachectl configtest
apachectl restart
7. To make sure now HTTP URLs are still cache make sure all caches are cleared (substitute EPRINTS_PATH and ARCHIVE_ID as appropriate):
EPRINTS_PATH/bin/epadmin refresh_abstracts ARCHIVE_ID
EPRINTS_PATH/bin/epadmin refresh_views ARCHIVE_ID
EPRINTS_PATH/bin/generate_static ARCHIVE_ID
8. Once that is all done make sure your colleague responsible for the NGinX proxy is now pointing at your server on port 443 rather than 80 and expecting HTTPS rather than HTTP.
Regards
David Newman
On 13/02/2024 6:07 am, zen zenitram wrote:
CAUTION: This e-mail originated outside the University of Southampton.Good day!
Our network admin says that i should not use Let's Encrypt on my server because the load balancer has it already, He said that it will create conflict on the load balancer.
How can i create this virtualhost without SSLCertificateChainFile or let's encrypt?
Do i need to remove the 3 SSLCertificate (with Highlight)?
Thank you very much!
<VirtualHost *:443>
ServerName YOUR-REPOSITORY-DOMAIN:443
# Enable HSTS
Header always set Strict-Transport-Security "max-age=63072000;"
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder on
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
SSLCertificateFile /etc/letsencrypt/live/YOUR-REPOSITORY-DOMAIN/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/YOUR-REPOSITORY-DOMAIN/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/YOUR-REPOSITORY-DOMAIN/chain.pem
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
LogLevel warn
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
Include EPRINTS_PATH/cfg/apache_ssl/REPOID.conf
PerlTransHandler +EPrints::Apache::Rewrite
</VirtualHost>
On Mon, Feb 12, 2024 at 10:39 PM David R Newman <drn@ecs.soton.ac.uk> wrote:
Hi Zen,
This looks to be a mixed content issue. EPrints has evolved over time from a time before HTTPS was widely available, through a time where HTTPS was needed but only for administration pages, to a time where HTTPS is almost exclusively used with HTTP requests upgraded either by the browser or by HTTP to HTTPS redirects.
I think you issue is that you have EPrints running with an HTTP-only configuration but your NGinX proxy is HTTPS. Sometimes EPrints uses full URLs, which include a protocol (i.e. HTTP or HTTPS) and this is where you mixed content warnings are arising. In an ideal world EPrints would only use relative URLs but as content is often embedded in third-party application there is still a requirement for full URLs in certain places. (We have experimented with protocol independent URLs, e.g. //eprints.example.org/cgi/users/login. However, if anything this added to the complexity of different types of URL being generated, so was decided against).
Anyway, to solve your problem you want to run you EPrints repository on your server in HTTPS-only rather than HTTP-only mode by reconfiguring your archive's cfg/cfg.d/10_core.pl (see [1]). You should only require a self-signed HTTPS certificate [2] as your NGinX proxy should be configurable to just care what the port number and protocol (i.e. HTTPS or HTTP) are. You will also need to add an HTTPS virtualhost. There is a good example on [3] but you will need to update the SSLCertificate... lines to point at you self-signed certificate and key (you should not need a SSLCertificateChainFile for a self-signed certificate).
Once you have redone all this configuration and tested it. Make sure you regenerate your Apache configuration and restart Apache and also clear any caches that may still be using HTTP URLs:
EPRINTS_PATH/bin/epadmin test
EPRINTS_PATH/bin/generate_apacheconf --system --replace
apachectl restart
EPRINTS_PATH/bin/epadmin refresh_views ARCHIVE_ID
EPRINTS_PATH/bin/epadmin refresh_abstracts ARCHIVE_ID
EPRINTS_PATH/bin/generate_static ARCHIVE_IDRegards
David Newman
[1] https://wiki.eprints.org/w/Simplified_HTTPS_Configuration
[2] https://gist.github.com/taoyuan/39d9bc24bafc8cc45663683eae36eb1a
[3] https://wiki.eprints.org/w/Setting_up_HTTPS_using_Let%27s_Encrypt
On 12/02/2024 07:03, zen zenitram wrote:
CAUTION: This e-mail originated outside the University of Southampton.Good day!
still can't upload and delete files. Here is error when i tried to upload.
On Wed, Jan 31, 2024 at 9:52 PM David R Newman <drn@ecs.soton.ac.uk> wrote:
Hi Zen,
It is difficult to debug an issue when you have a proxy sitting in front of your EPrints repository with no information about how that proxy has been configured. However, I have taken a look at the Upload stage on my EPrints test repository running the latest version of EPrints and I can see a request that is locally blocked that relates to the iframe generated by _javascript_ to provide the upload progress*. To avoid getting this blocked request (which may be causing your error message and upload issues) I would recommend commenting out the following line from EPRINTS_PATH/lib/static/_javascript_/auto/88_uploadmethod_file.js:
hidden_iframe.setAttribute( 'src', '#' );
So that it becomes:
// hidden_iframe.setAttribute( 'src', '#' );
This is on around line 314 for 88_uploadmethod_file.js. Once you have done this you will need to hard reload (e.g. Ctrl+Shift+R) the Upload stage of the workflow in your web browser and this should update your main _javascript_ file. Then try uploading a file again. If this does not work do you get the same error message. If you get the same error message, it is worth taking a look at https://thesis.dlsud.edu.ph/_javascript_/auto-VERSION.js (substituting VERSION for you version, e.g. 3.4.5) to make sure this line above is now commented out there. If it is not commented out, try using a private/incognito browser window to test this to try to avoid any caching of the old _javascript_.
Regards
David Newman
*This is a very ugly way of managing upload but was needed when the uploader was first written. We plan to completely overhaul how the uploader works for the next major version of EPrints.
On 31/01/2024 02:17, zen zenitram wrote:
CAUTION: This e-mail originated outside the University of Southampton.CAUTION: This e-mail originated outside the University of Southampton.Good day!
Our eprints repository works fine with it, you can log in and search and open attached documents. The Problem occurs when we try to add new title to repository and upload pdf files. attached are the errors shows when we upload documents.
and also when we try to delete the attached pdf file it only gives black page instead of the delete option.
Thank you!
*** Options: https://wiki.eprints.org/w/Eprints-tech_Mailing_List *** Archive: https://www.eprints.org/tech.php/ *** EPrints community wiki: https://wiki.eprints.org/
- References:
- [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- From: zen zenitram <quickfire28@gmail.com>
- Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- From: David R Newman <drn@ecs.soton.ac.uk>
- Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- From: zen zenitram <quickfire28@gmail.com>
- Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- From: David R Newman <drn@ecs.soton.ac.uk>
- Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- From: zen zenitram <quickfire28@gmail.com>
- Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- From: David R Newman <drn@ecs.soton.ac.uk>
- Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- From: zen zenitram <quickfire28@gmail.com>
- Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- From: David R Newman <drn@ecs.soton.ac.uk>
- [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- Prev by Date: Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- Next by Date: Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- Previous by thread: Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- Next by thread: Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer
- Index(es):