![]() |
#1786 |
Member
![]() ![]() Posts: 12
Karma: 108
Join Date: Dec 2020
Device: kobo
|
Some questions
I'm running a Truenas Core 12 server with the current release. I've been testing using COPS on it to handle my ebook collection and for the most part it seems to do what I want.
I have 2 questions (at least, only two at the moment ![]() First, I installed COPS using the directions here. I ran the command "git clone https://github.com/seblucas/cops.git" which installed what I assume is the latest version. My question is that when I look at the "about" screen, it shows version 1.2.0, but that github page says the most recent release is 1.1.3. Is the version I installed a beta test version, or an official release but the page wasn't updated? The second question regards authenticated logins. I've seen multiple posts here and other sites suggesting the use of the .htaccess and .htpasswd files. I've tried that, but no matter what I try I always login straight into the application. The file is in directory /iocage/jails/cops/root/usr/local/www/cops and the relevent section is: <FilesMatch "\.php$"> AuthUserFile /usr/local/www/cops/.htpasswd # AuthGroupFile /dev/null AuthName "Secure Access" AuthType Basic Require valid-user </FilesMatch> The .htpasswd has 2 users in it with the password hashed, so it looks correct. It's in the same directory, but I've tried it in different directories (and updated the path in htaccess each time) with the same results. When I try using the "$config['cops_basic_authentication'] = array('username' => 'user', 'password' => 'mypwd');" setting in the config file, I'm prompted for the user and password correctly. But I can't get the htaccess approach to work. I'm obviously doing something wrong, but right now I don't see it. I'm hoping another set of eyes and stronger mind can point me to where I'm screwing up. I should add that I'm using apache24. Thanks |
![]() |
![]() |
![]() |
#1787 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 725
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
|
@Minstrelcda
I have (hopefully) 2 answers: 1 - Cops version You use the latest github-version of COPS. The only difference between the latest "release" version in a zip and this version are some (3) minor corrections and additions. So go with the latest version. NB: You were lucky you used the instructions (best I've seen) for installing COPS that you did, otherwise you would have run into some errors. 2 - Authentication To use basic authentication in apache with .htaccess you need to change a setting in the apache2.conf (or httpd.conf) file (not COPS). Search for: Code:
<Directory /var/www/http> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> You can, for testing purposes only (!!!), put your .htpasswd file in the COPS directory and reference it with ./.htpasswd in .htaccess. |
![]() |
![]() |
Advert | |
|
![]() |
#1788 | |
Member
![]() ![]() Posts: 12
Karma: 108
Join Date: Dec 2020
Device: kobo
|
Quote:
Thanks for your reply. I made the change above in my httpd.conf file and restarted the service, but I can still log in directly without the prompt. If I change the path in .htaccess to ./.htpasswd, when I log in I get a 500 Internal Server error. Changing the path to anything else where the .htpasswd file is located doesn't present the error, but also doesn't prompt me for the login. |
|
![]() |
![]() |
![]() |
#1789 |
Member
![]() ![]() Posts: 12
Karma: 108
Join Date: Dec 2020
Device: kobo
|
further update..
I tried editing my original post but took too long and wasn't allowed to update it any longer. ----------------------------------------------------------------------- I deleted the .htpasswd file and rebuilt it in case it had been corrupted, but the same results. I checked to see if I had other .htaccess files which might be overriding this one. A locate gives me this: root@cops:/ # locate .htaccess /root/.composer/.htaccess /root/.composer/cache/.htaccess /usr/local/www/cops/.htaccess root@cops:/ # And running a locate on .htpasswd returns nothing. root@cops:/ # locate .htpasswd It's as if the file doesn't exist. I know it's a hidden file, but so is .htaccess and that was found. In any case, I have copies of the .htpasswd file in multiple directories and can see them when I run ls -l -a on those directories. When I figure out what the problem is, I'll delete all the files not used. |
![]() |
![]() |
![]() |
#1790 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 725
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
|
And if you change
<Directory /var/www/http> to <Directory /usr/local/www> ? The path to .htpasswd should be an absolute path, my mistake. Your path is ok. |
![]() |
![]() |
Advert | |
|
![]() |
#1791 | |
Member
![]() ![]() Posts: 12
Karma: 108
Join Date: Dec 2020
Device: kobo
|
Quote:
I also tried deleting the cache and history files to see if there was something cached that was overriding with the same results. As a different test, I changed the path to .htpasswd in the .htaccess file to point to directory where that file is not present. When I access the site, I get an internal system error. That tells me that the file is being seen by apache correctly, though it doesn't tell me what the problem is. I may try deleting the jail completely and start over. I may have changed something without noticing which is causing this. |
|
![]() |
![]() |
![]() |
#1792 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 725
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
|
Only thing I can think of is: "have you enabled mod_auth_basic in apache?"
It should be enabled by default. a2enmod auth_basic I have: root@vmBuster:/etc/apache2/mods-enabled# ls -l auth* lrwxrwxrwx 1 root root 33 Dec 11 13:36 auth_basic.load -> ../mods-available/auth_basic.load lrwxrwxrwx 1 root root 33 Dec 11 13:36 authn_core.load -> ../mods-available/authn_core.load lrwxrwxrwx 1 root root 33 Dec 11 13:36 authn_file.load -> ../mods-available/authn_file.load lrwxrwxrwx 1 root root 33 Dec 11 13:36 authz_core.load -> ../mods-available/authz_core.load lrwxrwxrwx 1 root root 33 Dec 11 13:36 authz_host.load -> ../mods-available/authz_host.load lrwxrwxrwx 1 root root 33 Dec 11 13:36 authz_user.load -> ../mods-available/authz_user.load |
![]() |
![]() |
![]() |
#1793 |
Member
![]() ![]() Posts: 12
Karma: 108
Join Date: Dec 2020
Device: kobo
|
Interesting... I'm now being prompted for a login / password. I made no new changes to this install, but did install the 12.0-U1 upgrade which forced me to reboot the server. The next time I logged in I was asked for the login / password.
However, when I close the page, open a new tab and login again I'm not asked for a login the second or subsequent times. Which I guess is ok... not the most secure but I can live with it since the user was initially authenticated. So possibly re-booting was required. I restarted the apache service multiple times during my tests but it seems that wasn't enough. Something to keep in mind for the future. |
![]() |
![]() |
![]() |
#1794 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 725
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
|
If you clean your browsers cache you’ll be asked again for user
![]() |
![]() |
![]() |
![]() |
#1795 |
Member
![]() Posts: 12
Karma: 10
Join Date: Dec 2020
Device: none
|
SYNOLOGY from package to 1.1.3
I have had cops running from the package for the past year and a half but had troubles with the ebook reader with large chapter so I upgraded to 1.1.3 using the instructions at https://github.com/seblucas/cops/wiki/Howto---Synology I also upgraded to php 7.4. The old package was removed. Unfortunately, something broke in the upgrade and I'm not sure where. (When I try to downgrade I get the same errors) I am running calibre 5.8.1 to create the databases and epub files. Symptoms of the break: I don't see thumbnail previews of any of the books (I can however, see the text data on the books and I can download the epub files) The epub web reader throws the following error This page contains the following errors: error on line 3 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error. It does this for all books that I try to view. checkconfig.php comes back ok for all libraries The only errors I get in the webserver logs are the following (when fetching a book list) 2020/12/27 21:54:24 [error] 24368#24368: *8884 upstream prematurely closed connection while reading upstream, client: 192.168.11.80, server: _, request: "GET /cops/fetch.php?id=6139&db=0 HTTP/1.1", upstream: "http://unix:/run/webstation_default.sock:/cops/fetch.php?id=6139&db=0", host: "192.168.11.7", referrer: "http://192.168.11.7/cops/index.php?page=7&id=472&db=0" 2020/12/27 21:54:25 [error] 24369#24369: *8904 upstream prematurely closed connection while reading upstream, client: 192.168.11.80, server: _, request: "GET /cops/fetch.php?id=6221&db=0 HTTP/1.1", upstream: "http://unix:/run/webstation_default.sock:/cops/fetch.php?id=6221&db=0", host: "192.168.11.7", referrer: "http://192.168.11.7/cops/index.php?page=7&id=472&db=0" Any suggestions on how to dig into this would be appreciated. Thank |
![]() |
![]() |
![]() |
#1796 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 725
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
|
I do not know what causes your error, but I think it's not:
- calibre (seems to work for me) - cops - php7.4 (tested and worked, php 8 gives an error) Did you install/enable all of the needed PHP mods? php7.4 php7.4-xml php7.4-mbstring php7.4-zip php7.4-gd php7.4-sqlite3 php7.4-json php7.4-intl Did you restart the Synology (when nothing helps, restart)? |
![]() |
![]() |
![]() |
#1797 |
Member
![]() Posts: 12
Karma: 10
Join Date: Dec 2020
Device: none
|
I thought I did
and I did restart the Synology (it was very strange as previously the packaged version was working and now even when I revert back the packaged version does not work. I'm tempted to try to load the backup and see where it gets but I'm hoping it is just a minor configuration tweak that I missed.) This is what the check currently gives Check if PHP version is correct OK (7.4.9) Check if GD is properly installed and loaded OK Check if Sqlite is properly installed and loaded OK Check if libxml is properly installed and loaded OK Check if Json is properly installed and loaded OK Check if mbstring is properly installed and loaded OK Check if intl is properly installed and loaded OK Check if Normalizer class is properly installed and loaded OK Check if the rendering will be done on client side or server side Client side rendering After that it gets into the libraries and those are all ok too. It is reading the libraries as I can search and download the epub it is just the online reader doesn't work and the images won't load (but gd is installed and working) Is there something that the checkconfig doesn't look for that I should look at? I appreciate the help. |
![]() |
![]() |
![]() |
#1798 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 725
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
|
Some, probably not so helpful thoughts:
1 - I've read somewhere that cops does not properly check for xml, so check if php7.4-xml is enabled. 2 - if you cache the thumbnails with cops wiht setting: $config['cops_thumbnail_cache_directory'] = ""; check that cops has writing rights (777 to test) on that directory. My cops on Debian buster uses $config['cops_thumbnail_cache_directory'] = "/var/www/html/cops/cache/"; 3 - what browser do you use to view cops and do you use the classic or bootstrap theme? And clean your browser cache before use. 4 - have you set password protection in .htaccess, disable to test. Hope the helps some. |
![]() |
![]() |
![]() |
#1799 |
Member
![]() Posts: 12
Karma: 10
Join Date: Dec 2020
Device: none
|
Thank you for your suggestions
I've actually restored the backup from earlier this month and the previous web configuration and cops install is back to working. I will dig in and see if I can figure out what the difference is between the old configuration and the new configuration and maybe what I screwed up when I tried to revert. |
![]() |
![]() |
![]() |
#1800 |
Member
![]() Posts: 12
Karma: 10
Join Date: Dec 2020
Device: none
|
For future troubleshooting I have found the issue.
When I installed the new version of cops I also tweaked the config_local.php file As part of the tweaking I inadvertently put a blank line after the closing ?> That was enough to screw it up. I now have both versions working with php 5.6.40 Thank you very much for your help. I had no idea a blank line there would do something like that. |
![]() |
![]() |
![]() |
Tags |
calibre opds, dns, kobo aura, synology |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre OPDS server with windows apps? | nickdma | Related Tools | 10 | 03-03-2024 02:53 PM |
[Old Thread] Android FBreader and Calibre OPDS server question | kalex | Calibre | 5 | 12-24-2015 10:16 PM |
PHP+Apache web server for calibre ... | chaley | Related Tools | 254 | 04-28-2014 08:18 PM |
External OPDS catalogue in Calibre | bolton | Calibre | 1 | 09-05-2012 06:14 AM |
Calibre Command Line usage with PHP | artoros | Related Tools | 13 | 07-01-2010 09:57 AM |