Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 01-19-2017, 09:46 AM   #1411
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
Quote:
Originally Posted by jillmess View Post


Am following this 'pagekite' stuff with interest though. Never heard of it before.
Neither had I, but it's an interesting concept.

I see a few use-cases for PageKite (and a few other companies that provide a similar service):
A - if your WAN-ip address at home is very "dynamic" (or has changed without you realising and you want to remotely connect to data on your home server).
B - if your internet service provider does not like you to run your own server on port 80 (or closes all other ports below 1024).
C - if you, from a security perspective, do not want to open ports in your router and forward them to your PC('s)/NAS or find this to complex.
D - if you want to connect to a portable device (laptop) when it's outside of our own LAN. (A read something about a guy using Starbucks/McDonalds wifi and giving a client access to (a preview) of some work done for them.

If I can make MontyJ's COPS working I might try PageKite or a similar service to make A and/or D working for myself.

$ 3/month is not a lot of money, but just a little bit to much for casual use a few times a year.
mariosipad is offline   Reply With Quote
Old 01-19-2017, 10:16 AM   #1412
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
@MontyJ

Quote:
Originally Posted by MontyJ View Post
@mariosipad,
..........

So I am a little unclear of your intentions on that. I will, for now, proceed with your instructions exactly and remove both lines and put them in a new file.

...........
We seem to have a slight miscommunication here.

I meant that you should remove only the second line from .htaccess in ./web/cops/ not the line that was there already as well. Can you please put this first line (RewriteEngine On) back in this file in the same place where it was.
The second .htaccess file should now be in ./web.

You should be aware of the fact that I am using as little as possible of the capabilities of PageKite and try to guide (or "push) you in the direction of a setup (not unlike my own) that I know works. QNAP and Synology sometimes make a otherwise rather straightforward solution in "regular" Linux (Debian/Ubuntu) sometimes a bit "complicated", mainly due to a different directory structure and different file names (where you least expect it).


Now on to setting up username/password for your users (with apache).

Please follow these steps:
1 - edit ./web/cops/.htaccess
Remove from the bottom few lines the # so that this part of the file now looks like
Code:
# Uncomment if you wish to protect access with a password
###########################################
# If your covers and books are not available as soon as you protect it
# You can try replacing the FilesMatch directive by this one
# <FilesMatch "(index|feed)\.php">
# If helps for Sony PRS-TX and Aldiko, beware fetch.php can be accessed
# with authentication (see $config ['cops_fetch_protect'] for a workaround).
###########################################
<FilesMatch "\.php$">
AuthUserFile "./.htpasswd"
AuthGroupFile /dev/null
AuthName "Secure access"
AuthType Basic
Require valid-user
</FilesMatch>
2 - make .htpasswd file
- from ./web/cops type at the prompt:
Code:
htpasswd -c .htpasswd monty
then answer the questions with a (very)secret password (2x).
- then to add a second user: from ./web/cops type at the prompt:
Code:
htpasswd .htpasswd user1
then answer the questions with a different (very)secret password (2x)
- for additional users repeat the previous step but maybe test first with just 2 or 3 users.

Again fingers crossed.
mariosipad is offline   Reply With Quote
Advert
Old 01-19-2017, 12:48 PM   #1413
MontyJ
Addict
MontyJ began at the beginning.
 
Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
@mariosipad,

Ok, here is where I am at now...

First, just an FYI for QNAP users. The htpasswd program is not in the run path on QNAP for some reason. I had to point to it as in:
Code:
/mnt/ext/opt/apache/bin/htpasswd
Then I was able to enter my login info and one other into a new .htpasswd file here:
Code:
[/share/Web/cops] # ls -la 
drwxrwxrwx    8 admin    administ      4096 Jan 19 09:06 ./
drwxrwxrwx    6 admin    administ      4096 Jan 19 09:37 ../
-rw-r--r--    1 admin    administ      2606 Jan 19 08:30 .htaccess
-rw-r--r--    1 admin    administ        91 Jan 19 09:09 .htpasswd
Note: The original .htaccess, with the first line back in it, is still in the /share/Web/cops folder.

I then uncommented the lines per your last post.

Then created a new .htaccess file in the /share/Web folder here:
Code:
[/share/Web] # ls -la
drwxrwxrwx    6 admin    administ      4096 Jan 19 10:04 ./
drwxrwxrwx   30 admin    administ      4096 Jan 15 03:00 ../
drwxrwxrwx    2 admin    administ      4096 Jan 16 14:09 .@upload_cache/
-rw-r--r--    1 admin    administ        42 Jan 19 09:37 .htaccess
drwxrwxrwx    2 admin    administ      4096 Jan 18 10:20 @Recycle/
lrwxrwxrwx    1 admin    administ        37 Jan 15 09:26 COPS -> /share/CACHEDEV1_DATA/.qpkg/COPS/COPS/
drwxrwxrwx    8 admin    administ      4096 Jan 19 09:06 cops/
[/share/Web] #
The contents of .htaccess in the /share/Web folder are:
Code:
RewriteEngine On
RewriteRule ^$ /cops [l]
That should be all the mods completed.

Next, I run "http://mydomain.pagekite.me". The url address line in the browser changed to "http://mydomain.pagekite.me/cops/" and gave me this error:

Code:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@NAS and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache Server at mydomain.pagekite.me Port 80
I looked for apache logs, but found nothing with today's time stamp. I also looked for any *.log files with 'server' and/or 'error" in the file name but found nothing.

I suspect there is a log of some kind, but I don't know where to find it...

Is the error because I didn't get one of the above files in the right location...?

Last edited by MontyJ; 01-19-2017 at 12:50 PM. Reason: add comment
MontyJ is offline   Reply With Quote
Old 01-19-2017, 01:03 PM   #1414
MontyJ
Addict
MontyJ began at the beginning.
 
Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
@mariosipad,

I just looked at the details of those lines at the end of /share/Web/cops/.htaccess that I uncommented:
Code:
<FilesMatch "\.php$">
AuthUserFile /share/MD0_DATA/.qpkg/COPS/accesCops.htpasswd
AuthGroupFile /dev/null
AuthName "Acces securise"
AuthType Basic
Require valid-user
</FilesMatch>
Could line 2 be a problem as to where it is looking for .htpasswd?
MontyJ is offline   Reply With Quote
Old 01-19-2017, 01:10 PM   #1415
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
....... It is the same error I got yesterday evening and tried to solve. No idea how, but after some fiddling the "problem" seemed to have solved itself.

What did I fiddle?
- restarted webserver (maybe restart QNAP)
- cleared firefox caches
- tried another browser (Chrome) -> worked
- in firefox I tried http://192.168.xxx.xxx/cops/login.html

And in the end it worked.

Maybe you should try?
mariosipad is offline   Reply With Quote
Advert
Old 01-19-2017, 01:17 PM   #1416
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
Quote:
Originally Posted by MontyJ View Post
@mariosipad,

I just looked at the details of those lines at the end of /share/Web/cops/.htaccess that I uncommented:
Code:
<FilesMatch "\.php$">
AuthUserFile /share/MD0_DATA/.qpkg/COPS/accesCops.htpasswd
AuthGroupFile /dev/null
AuthName "Acces securise"
AuthType Basic
Require valid-user
</FilesMatch>
Could line 2 be a problem as to where it is looking for .htpasswd?
Poshsible: the line should end with /.htpasswd
mariosipad is offline   Reply With Quote
Old 01-19-2017, 02:38 PM   #1417
MontyJ
Addict
MontyJ began at the beginning.
 
Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
Quote:
Originally Posted by mariosipad View Post
....... It is the same error I got yesterday evening and tried to solve. No idea how, but after some fiddling the "problem" seemed to have solved itself.

What did I fiddle?
- restarted webserver (maybe restart QNAP)
- cleared firefox caches
- tried another browser (Chrome) -> worked
- in firefox I tried http://192.168.xxx.xxx/cops/login.html

And in the end it worked.

Maybe you should try?
Well, things are getting weird...

I did a 'restart' of qnap. I didn't disconnect my ssh sessions, but of course it terminated those.

After it came up, I made sure I could login to the qnap desktop. Keep in mind the original COPS icon is still there, and just to check I selected it and the original COPS install still works normally; it came up an a new tab in Firefox. I then closed that session.

Next I reconnected with a SSH session as 'admin', as normal. At the "/" folder I typed in pagekite.py to start it up again. Nothing. File not found.

I then checked for the pagekite config and log files in the / folder, but they were not there. I did a 'find' for ANY pagekite files, but nada!

I had read that the antivirus or malware removal could be a problem with some programs, but when I checked the Antivirus program on the desktop, it was not enabled and there were no scan jobs listed either.

Not sure what this is all about, but I now have to recreate my pagekite config file as I did not do any backups during this testing Then reinstall pagekite.py...somewhere.

The Linux script Pagekite provides puts it in /usr/local/bin/pagekite.py, but something does not seem to think it belongs there...

I should note that the default Pagekite script for Linux install does not work "as is" in Qnap:

Code:
curl -s https://pagekite.net/pk/ |sudo bash
Qnap has no initial curl and no sudo. I had Entware-ng installed, so installed curl and sudo. Still problems as I received pagekite messages about policy and https and sudo 'root' handling. But they do provide tips at each failure that finally installs pagekite.py. And then it runs.

I have to try another Qnap restart to see if pagekite.py sticks around before I go any further. So will be back in a while.

[edit] sure enough, it wiped my pagekite install again... Any ideas? If not, I will check with Pagekite, but those folks in Iceland seem to be out in the thermal baths and the heat is affecting their response time, LoL.

Last edited by MontyJ; 01-19-2017 at 02:58 PM. Reason: Follow up
MontyJ is offline   Reply With Quote
Old 01-19-2017, 03:26 PM   #1418
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
My idea's:
1 - see if you still have python in the QNAP OS
2 - copy pagekite.py to the home directory of admin (on a NAS admin is something like root or even copy it in a /root directory) and then start PageKite from there.
Don't bother with curl and or sudo, if you want to be root just ssh into your QNAP as root.


Tomorrow I have planned a PageKite install on one of my old PC's running Debian Jessie Linux. Maybe then I will understand something more about PageKite.

Remember it is winter in the northern hemisphere and Iceland is way north near the polar circle. If they are not cooking themselves in lava they are probably hibernating.
mariosipad is offline   Reply With Quote
Old 01-19-2017, 08:19 PM   #1419
jillmess
Enthusiast
jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.
 
jillmess's Avatar
 
Posts: 46
Karma: 500000
Join Date: Dec 2011
Device: Kobo Libra 2
If you want something to survive a reboot on the QNAP it pretty much needs to be within a share - not in ./root. I have most system 'stuff' within the .qpkg folder. You will also need to read about how to use 'autorun' to run things at startup assuming you want pagekite.py to start automatically once you get this all sorted.
jillmess is offline   Reply With Quote
Old 01-19-2017, 08:27 PM   #1420
MontyJ
Addict
MontyJ began at the beginning.
 
Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
Quote:
Originally Posted by jillmess View Post
If you want something to survive a reboot on the QNAP it pretty much needs to be within a share - not in ./root. I have most system 'stuff' within the .qpkg folder. You will also need to read about how to use 'autorun' to run things at startup assuming you want pagekite.py to start automatically once you get this all sorted.
Well, I would say that is something critical to know...and I didn't know it.

Tho in the end, it may not mean a lot to pagekite if their script is used. I will look for someplace on a share to put it that is in the run path. I know /share/Web is not.
MontyJ is offline   Reply With Quote
Old 01-19-2017, 09:04 PM   #1421
MontyJ
Addict
MontyJ began at the beginning.
 
Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
Quote:
Originally Posted by jillmess View Post
If you want something to survive a reboot on the QNAP it pretty much needs to be within a share - not in ./root. I have most system 'stuff' within the .qpkg folder. You will also need to read about how to use 'autorun' to run things at startup assuming you want pagekite.py to start automatically once you get this all sorted.
Do you know what the deal with a 'root' login is? I am wondering if I install pagekite as 'root', and not 'admin', that it may do a clean install. Just a wild thought.

However, I it asks for a password when connecting via ssh as user 'root' and I haven't a clue. There is no user root, so I am not sure if making one and assigning him to the administrators group would really work. The usual 'admin' or 'root' passwords don't work of course.

Thanks!
MontyJ is offline   Reply With Quote
Old 01-19-2017, 11:08 PM   #1422
jillmess
Enthusiast
jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.jillmess ought to be getting tired of karma fortunes by now.
 
jillmess's Avatar
 
Posts: 46
Karma: 500000
Join Date: Dec 2011
Device: Kobo Libra 2
Quote:
Originally Posted by MontyJ View Post
Do you know what the deal with a 'root' login is? I am wondering if I install pagekite as 'root', and not 'admin', that it may do a clean install. Just a wild thought.

However, I it asks for a password when connecting via ssh as user 'root' and I haven't a clue. There is no user root, so I am not sure if making one and assigning him to the administrators group would really work. The usual 'admin' or 'root' passwords don't work of course.

Thanks!
admin is root on QNAP. If pagekite does not give you an option to select where to save the setup files you may have to save them to a share and then use a script which runs at startup (using 'autorun') to copy them back to wherever pagekite needs them to be.

Sorry I can't be much help but I have only had my QNAP a few months and am still getting my head around how it does things. Very different to my old readynas.
jillmess is offline   Reply With Quote
Old 01-19-2017, 11:44 PM   #1423
MontyJ
Addict
MontyJ began at the beginning.
 
Posts: 224
Karma: 10
Join Date: Jul 2012
Device: Kindle
Quote:
Originally Posted by jillmess View Post
admin is root on QNAP. If pagekite does not give you an option to select where to save the setup files you may have to save them to a share and then use a script which runs at startup (using 'autorun') to copy them back to wherever pagekite needs them to be.

Sorry I can't be much help but I have only had my QNAP a few months and am still getting my head around how it does things. Very different to my old readynas.
Well, if admin is root it would seem the admin password should work for root...but it doesn't. Sigh.

What I have done after a little experimenting is put pagekite.py into the
Code:
/share/Web
folder.

Since qnap blows away all the stuff in / and /root, and python has no set search path to the Web folder, I modify the pagekite.py startup by:
Code:
python pagekite.py --optfile=/share/Web/pagekite.rc mydomain.pagekite.me
Then pagekite starts up and appears to be happy until I do the pagekite login. Then I get the Internal Error again.

It may be because python need a new path added to the /share/Web folder, but I really don't know. I looked at the instructions to modify qnap python's SET PATH but it is over my head.

Coincidence! I had a ReadyNAS Duo V2 but it didn't have the chops to run COPS or Pagekite from what I read, so bought this TS-251 as a platform really to do just that, along with backup of course. Sold my ReadyNAS.

So yea, the learning curve continues.

Well time to call it quits here.
MontyJ is offline   Reply With Quote
Old 01-20-2017, 09:53 AM   #1424
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
@MontyJ

If you get a "familiar" error, then PageKite is working (again)

Does the error looks something like this?
Code:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
The error is caused by a wrong path in AuthUserFile /path/to/.htpasswd in ./web/cops/.htaccess.

The path needs to be an absolute path from the QNAB / to the .htpasswd file.

The line
Code:
AuthUserFile /share/MD0_DATA/.qpkg/COPS/accesCops.htpasswd
must be wrong. (At the very least I am missing a / in front of .htpasswd )

If we want (for the time being) to put .htpasswd in ./web/cops we need to find the absolute path to this location. If you know what it is then disregard the next lines.

To find out the absolute location of the web root (from there is it ./cops/.htpasswd) please make a file named myroot.php in ./web with this content:
Code:
<html>
<head>
<title>Getting your AuthUserFile root location</title>
</head>
<?php
echo "<h1>Your website root location is -->  ";
echo $_SERVER['DOCUMENT_ROOT'];
echo "  <--<h1/>";?>
<body>
</body></html>
then in a browser http://192.168.xxx.xxx/myroot.php.
Note the web root between -> /Y/Y/Y <-.

Now go to ./web/cops and edit .htaccess. The last few lines must now look like (where you fill in /Y/Y/Y (starting with the /)
Code:
###########################################
# Uncomment if you wish to protect access with a password
###########################################
# If your covers and books are not available as soon as you protect it
# You can try replacing the FilesMatch directive by this one
# <FilesMatch "(index|feed)\.php">
# If helps for Sony PRS-TX and Aldiko, beware fetch.php can be accessed
# with authentication (see $config ['cops_fetch_protect'] for a workaround).
###########################################
<FilesMatch "\.php$">
AuthUserFile "/Y/Y/Y/cops/.htpasswd"
AuthGroupFile /dev/null
AuthName "Secure access"
AuthType Basic
Require valid-user
</FilesMatch>
Did this help?

The unexpected error kept me baffled for a while as well.
mariosipad is offline   Reply With Quote
Old 01-20-2017, 10:00 AM   #1425
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 719
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
Quote:
Originally Posted by jillmess View Post
Sorry I can't be much help but I have only had my QNAP a few months and am still getting my head around how it does things. Very different to my old readynas.
And I do not even have a QNAP.

I know a little about linux (Debian) and a little about a Synology NAS but QNAP seems to do a lot of thing is a slightly different way from all the others.

That's interesting, but sometimes also frustrating. I can give an advise that sounds good to me (linux) but can have very adverse effects for MontyJ's QNAP.

I just hope that in the end we will get there.
mariosipad is offline   Reply With Quote
Reply

Tags
calibre opds, dns, kobo aura, synology


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 11:39 AM.


MobileRead.com is a privately owned, operated and funded community.