yoesoff

Generate the Public dan Private Keys

Aug 27th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.06 KB | None | 0 0
  1. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:51:37]
  2. > $                                                                                                                                                          [±master ✓]
  3. > $ pwd                                                                                                                                                      [±master ✓]
  4. /home/yusuf/Documents/Oproject/oapi
  5.                                                                                                                                                                          
  6. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:53:01]
  7. > $ mkdir -p config/jwt                                                                                                                                      [±master ✓]
  8.                                                                                                                                                                          
  9. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:53:08]
  10. > $ jwt_passhrase=$(grep ''^JWT_PASSPHRASE='' .env | cut -f 2 -d ''='')                                                                                      [±master ✓]
  11.                                                                                                                                                                          
  12. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:53:49]
  13. > $ jwt_passhrase=$(grep ''^JWT_PASSPHRASE='' .env | cut -f 2 -d ''='')                                                                                      [±master ✓]
  14.                                                                                                                                                                          
  15. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:54:01]
  16. > $ echo "$jwt_passhrase" | openssl genpkey -out config/jwt/private.pem -pass stdin -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096                     [±master ✓]
  17. ....................................................................................................................................++++
  18. ......................................++++
  19.                                                                                                                                                                          
  20. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:54:57]
  21. > $ echo "$jwt_passhrase" | openssl pkey -in config/jwt/private.pem -passin stdin -out config/jwt/public.pem -pubout                                         [±master ✓]
  22.                                                                                                                                                                          
  23. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:55:14]
  24. > $ setfacl -R -m u:www-data:rX -m u:"$(whoami)":rwX config/jwt                                                                                              [±master ✓]
  25.                                                                                                                                                                          
  26. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:55:24]
  27. > $ setfacl -dR -m u:www-data:rX -m u:"$(whoami)":rwX config/jwt                                                                                             [±master ✓]
  28.                                                                                                                                                                          
  29. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:55:31]
  30. > $ curl -X POST -H "Content-Type: application/json" http://oapi.local:55/api/login_check -d '{"username":"joni","password":"passwordsijoni"}'               [±master ✓]
  31. {"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE1NjY5MDY5MzcsImV4cCI6MTU2NjkxMDUzNywicm9sZXMiOlsiUk9MRV9VU0VSIl0sInVzZXJuYW1lIjoiam9uaSJ9.vRhiSK45xtdvNQxZRUNgr4kramSz58Wgij-YhjBcoNtl796AFRh1yEHWcrMEMm5MjY0WfRKUqIgWyA2WTZeoRKJ1C7wSvBjje83XANejW_9InOCzsbgTcAjHwAcSEdHJ0kpOj0XP7uyCxJFIQ_x49zpqzyXyMmtjtaAq4En0HZfFNdDJntb8Nz9Pp_F2ZeoYygAX2izArAxLFRLzjyXScvbdiFNfKqnUCMT8GVsktbijYNTio3jVxTAkX7Drscsm8SZ9G-GSVqQS3yitk06IfWyKMsv8iJuwtxXOynmKey1eNcPTyPP9TtcI-arUxz83VoSD13S95CjrQTAu7MmI_ucmO036pFfc28BXa9wOowYkGyteYMPJ_bMiblJMHDyVqq3g0xpjNFtZr1kCMdA4rwJHllyxTYCczkTK87NrlGKb-yOxvki6hXfnghT1fUyWfGZsUfEYZ55q5lLv913DZZnz1x8ncx1gGRVGMCrGX4ky_rZKznk-bDcEYhPz46WCPyDekddCjLk3JmWV4-GOJvfYTgiVq1lH4vhj6HZ3qYCa2OizOuthcwN9vnZWSdxlVZhknh5pZ7Go-EeFteAedcu-7a7OJOAxFjOcl2yXwcZTQ7qPS8HU6GOTBtcRLa3Rh3xmIc8buCH95QB7ZQv6E2wkkQG8hyusIqDqBwLOTWA"}%                                                                                                                                                                        
  32. yusuf@yusuft40-T420 ~/Documents/Oproject/oapi                                                                                                                 [18:55:37]
  33. > $                                                                                                                                                          [±master ✓]
Advertisement
Add Comment
Please, Sign In to add comment