Thanks Massimo, just in case anybody has the same problem, this is the full
syntax for connecting in ssl mode:
DAL('postgres://postgres:[email protected]/sshfw',
driver_args={"sslmode":"require", "sslrootcert":"root.crt", "sslcert":
"postgresql.crt", "sslkey":"postgresql.key"})
where sslrootcert, sslcert and sslkey must contain the full paths to the
files.
On Sunday, June 26, 2016 at 7:21:43 AM UTC+2, Massimo Di Pierro wrote:
>
> you use postgres you can do:
>
> db = DAL(....., driver_args=dict(sslmode="require"))
>
> should work fine. I do not know of other engines that support it but there
> is always a way to tell the driver.
>
> On Friday, 24 June 2016 05:53:37 UTC-5, Dragan Matic wrote:
>>
>> Has there been any progress in connecting through SSL with DAL? Searching
>> chapter 6 (DAL) of the web2py book for "ssl" or "secure" does not find
>> anything.
>>
>>
>> On Sunday, August 23, 2009 at 6:01:11 PM UTC+2, mdipierro wrote:
>>>
>>> We do not support that but now that I know it should be easy to add.
>>> We will add it in the next version.
>>>
>>> Please help us test it. Edit gluon.sql.py and change
>>>
>>> msg = \
>>> "dbname='%s' user='%s' host='%s' port=%s
>>> password='%s'"\
>>> % (db, user, host, port, passwd)
>>> self._pool_connection(lambda : psycopg2.connect(msg))
>>>
>>>
>>> with
>>>
>>> msg = \
>>> "dbname='%s' user='%s' host='%s' port=%s password='%s'
>>> sslmode='require'"\
>>> % (db, user, host, port, passwd)
>>> self._pool_connection(lambda : psycopg2.connect(msg))
>>>
>>> does it work?
>>>
>>> Massimo
>>>
>>> On Aug 23, 10:57 am, Don Lee <[email protected]> wrote:
>>> > Yes. PostgreSQL allows for an SSL connection between the client and
>>> the
>>> > server. This can be done with psycopg2, for example:
>>> >
>>> > import psycopg2 as database
>>> > db = database.connect (host="db.host.com",
>>> > sslmode="require",
>>> > database="dbname",
>>> > user="dbuser",
>>> > password="dbpass")
>>> >
>>> > On Sun, Aug 23, 2009 at 10:04 AM, mdipierro <[email protected]>
>>> wrote:
>>> >
>>> > > Then I do not understand what you mean by "secure connection". Is
>>> > > there a secure connection function provided by postgresql and
>>> psycopg2
>>> > > that web2py is not using and should be using?
>>> >
>>> > > Massimo
>>> >
>>> > > On Aug 23, 8:14 am, Don <[email protected]> wrote:
>>> > > > I do not have SSH access to the DB server. Can I use psycopg2
>>> > > > directly to create the connection?
>>> >
>>> > > > On Aug 23, 8:59 am, mdipierro <[email protected]> wrote:
>>> >
>>> > > > > Yes but not this way.
>>> > > > > You have to open an ssh tunner outside web2py and then instruct
>>> web2py
>>> > > > > to connect to the database using the port used by the tunnel.
>>> >
>>> > > > > Massimo
>>> >
>>> > > > > On Aug 23, 7:47 am, Don <[email protected]> wrote:
>>> >
>>> > > > > > Is it possible to define a secure database connection?
>>> >
>>> > > > > > Ex: db = DAL(‘postgres://user:password@hostname/db’, pools=10,
>>> > > > > > secure=True)
>>> >
>>> > > > > > My production DB and web servers are running on a different
>>> machines.
>>
>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.