Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-31-2016, 04:36 AM   #1
dummkauf
Junior Member
dummkauf began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2016
Device: nook
Binding calibre-server to 127.0.0.1

When running a headless server with calibre-server, how does one specify that the server only run on 127.0.0.1:8080?

I want to secure the server using basic http authentication with SSL and an apache reverse proxy. I have all this setup, however if you browse to myserverip.com:8080, Calibre loads just fine without going through the apache directory I setup on my server(the apache directory also loads and I want that to be the only way to access the library). I need to bind the calibre server to localhose only so that the only way to access it is through the apache reverse proxy.

I've seen numerous posts about preferences --> tweaks and setting server_listen_on, however that's only through the gui. How do I do this when running a headless server?
dummkauf is offline   Reply With Quote
Old 01-31-2016, 05:20 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,353
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The tweaks are set in a simple file in the calibre config directory called tweaks.py

Copy it over from a machine where you run the GUI

Use the environment variable CALIBRE_CONFIG_DIRECTORY to control where it is read from.
kovidgoyal is offline   Reply With Quote
Advert
Old 01-31-2016, 05:42 AM   #3
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I solve this by:
  • My firewall blocks all incoming connections to ports that are not explicitly opened.
  • Calibre listens on a port that is not explicitly opened in the firewall, say 9199, using a command line argument.
  • Apache rewrite rules handle connections to https://my_machine/library. I use the "/library" because SSL requires port 443, preventing use of port-based virtual hosts. I can't use name-based virtual hosts because I didn't buy a multi-host cert.
  • The reverse proxy rewrite rules connect to calibre on 127.0.0.1:9199
Doing it this way I don't care what calibre listens on or that it uses mDNS (bonjour).

Here are the relevant apache rules, which are probably very similar to what you already have.
Code:
<VirtualHost 69.164.218.38:443>
        # Stuff to set up SSL etc elided

        # Calibre library
        <Location "/library">
                AuthType Digest
                AuthName "************"
                AuthDigestDomain /

                AuthDigestProvider file
                AuthUserFile **************
                Require valid-user
        </Location>
        RewriteEngine on
        RewriteRule ^/library/(.*) http://127.0.0.1:9199/library/$1 [proxy]
        RewriteRule ^/library http://127.0.0.1:9199 [proxy]

        SetEnv force-proxy-request-1.0 1
        SetEnv proxy-nokeepalive 1
</VirtualHost>
chaley is offline   Reply With Quote
Old 02-01-2016, 04:23 PM   #4
dummkauf
Junior Member
dummkauf began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2016
Device: nook
Quote:
Originally Posted by kovidgoyal View Post
The tweaks are set in a simple file in the calibre config directory called tweaks.py

Copy it over from a machine where you run the GUI

Use the environment variable CALIBRE_CONFIG_DIRECTORY to control where it is read from.
Sounds like an excellent plan. Where is tweaks.py?

I've been looking and can't seem to find it. Server's on Debian and my laptop is running Ubuntu so I'm assuming the location would be the same on both.
dummkauf is offline   Reply With Quote
Old 02-01-2016, 04:28 PM   #5
dummkauf
Junior Member
dummkauf began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2016
Device: nook
Quote:
Originally Posted by dummkauf View Post
Sounds like an excellent plan. Where is tweaks.py?

I've been looking and can't seem to find it. Server's on Debian and my laptop is running Ubuntu so I'm assuming the location would be the same on both.
nevermind. Instealled under /root/.config/calibre/

Need to run my search as root
dummkauf is offline   Reply With Quote
Advert
Old 02-01-2016, 04:34 PM   #6
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
It is, naturally, in "$XDG_CONFIG_HOME/calibre".

EDIT:
Might I ask WHY you are running calibre as root?

Generally speaking, you should run as few things as possible using the root account -- just to be on the safe side.
eschwartz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre Binding to a Specific NIC fiacca Calibre 7 02-18-2015 11:43 AM
Calibre Content Server and Windows Home Server 2011 HughMcC Calibre 8 10-01-2014 07:26 AM
Content Server - binding to wrong networkadapter sr71 Library Management 1 02-28-2013 03:33 AM
calibre-server OPDS catalog - manual move to web server HaakonME Related Tools 5 09-21-2012 03:11 AM
500 Internal Server Error accessing content server Calibre 0.8.8 DaddyO57 Calibre 1 07-20-2012 06:08 PM


All times are GMT -4. The time now is 06:42 AM.


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