Top Banner
Authentication security - the quick and easy way! Magnus Hagander @magnushagander
13

Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database

Mar 05, 2018

Download

Documents

HoàngMinh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database

Authentication security- the quick and easy way!

Magnus Hagander@magnushagander

Page 2: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database
Page 3: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database
Page 4: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database
Page 5: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database

#

Page 6: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database

postgres=# CREATE EXTENSION pgcrypto;CREATE EXTENSION

Page 7: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database

postgres=# CREATE EXTENSION pgcrypto;CREATE EXTENSION

postgres=# SELECT crypt('topsecret', gen_salt('bf')); crypt -------------------------------------------------------------- $2a$06$gtwIVMvGNoClLvD4vqVwAus4OF47mLv0J6XyYylzpAKaf.dJm9qFC(1 row)

Page 8: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database
Page 9: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database
Page 10: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database

CREATE OR REPLACE FUNCTION login(_userid text, _pwd text, OUT _email text) RETURNS text LANGUAGE plpgsql SECURITY DEFINERAS $$BEGIN SELECT email INTO _email FROM users WHERE users.userid=lower(_userid) AND pwdhash = crypt(_pwd, users.pwdhash);END;$$

REVOKE ALL ON users FROM public;

Page 11: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database

postgres=# select login('foo', 'bar'); login ------- (1 row)

postgres=# select login('foo', 'topsecret'); login ------------- [email protected](1 row)

postgres=> select * from users;ERROR: permission denied for relation users

Page 12: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database
Page 13: Authentication security - the quick and easy way! authentication.pdf · Authentication security - the quick and easy way! ... Did the latest Sony hack leak my info? ... Gawkers Database

DONE!

http://www.flickr.com/photos/osi/122937793/http://www.flickr.com/photos/litlnemo/5304381201/in/photostream/

http://www.flickr.com/photos/86608983@N00/375048613/in/photostream/