EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #09606
< 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: Wed, 14 Feb 2024 17:18:04 +0800
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 folder
root@edocs-001:/opt/eprints3/archives/aea/ssl# ls
thesis.dlsud.edu.ph.csr thesis.dlsud.edu.ph.key
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/
- Follow-Ups:
- 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
- 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>
- [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):