篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Seguridad en postgress相关的知识,希望对你有一定的参考价值。
En postgres debes de instalar - por base de datos y como superuser- las extensiones de seguridad, para poder usar todas las funciones seguridad
para eso, :
' CREATE EXTENSION pgcrypto;'
otro modo es:
' psql -d <database> -f /usr/share/postgresql/<version>/contrib/pgcrypto.sql'
It's been a while since I asked this question, and I'm much more familiar with the cryptographic theory now, so here is the more modern approach:
* Don't use md5. Don't use a single cycle of sha-family quick hashes. Quick hashes help attackers, so you don't want that.
* Use a resource-intensive hash, like bcrypt, instead. Bcrypt is time tested and scales up to be future-proof-able.
* Don't bother rolling your own salt, you might screw up your own security or portability, rely on gen_salt() to generate it's awesome unique-to-each-use salts on it's own.
## Use crypt() and gen_salt() in queries
Compare :pass to existing hash with:
```
select * from accounts where password_hash = crypt(:pass, password_hash);
//(note how the existing hash is used as its own individualized salt)
```
Create a hash of :password with a great random salt:
```
insert into accounts (password) values crypt(:password, gen_salt('bf', 8));
//(the 8 is the work factor)
```
o bien,
```
select crypt('password', gen_salt('bf'))
```
## Be careful of logging
Note that with pg_crypto, the passwords are in plaintext all during the transmission from the browser, to php, to the database. This means they can be logged in plaintext from queries if you're not careful with your database logs. e.g. having a postgresql slow query log could catch and log the password from a login query in progress.
https://www.postgresql.org/docs/8.3/static/pgcrypto.html
以上是关于markdown Seguridad en postgress的主要内容,如果未能解决你的问题,请参考以下文章