Giter VIP home page Giter VIP logo

oauth-proxy's Introduction

Oauth proxy

This server will handle 3bot connect authentication and verification, eliminating the need to handle it in other services that are using 3bot connect.

Running the server

Install the requirements:

pip3 install -r requirements.txt

Make sure to have the secret in /opt/key.priv encoded usnig a Base64 encoding, an example using pyNaCl:

k = nacl.signing.SigningKey.generate()  # Ususally the key is generated using a seed
k.encode(encoder=nacl.encoding.Base64Encoder).decode()  # What should be in the file

The application is a simple bottle server, and it can be run using uwsgias follows:

uwsgi --http :{port number} -w server

Using the oauth server in your application

In order to use this server the application server must have follwing two endpoints:

  • An endpoint that gets the public key from the Oauth server and redirects the user to 3bot connect correct url
  • A callback endpoint that receives the data from 3bot connect and sends it to Oauth server to verify

You can find a crystal lang and python example here.

oauth-proxy's People

Contributors

ranatrk avatar xmonader avatar abom avatar ahmedsa-mir avatar peternashaat avatar

Watchers

Abdelrahman Hussein avatar  avatar James Cloos avatar Ashraf Fouda avatar Abdulrahman Hamdy avatar Reem Khamis avatar Bola E.Nasr avatar Samar Adel avatar  avatar  avatar  avatar Atef Nazmy avatar Alaa228 avatar Adnan Fatayerji avatar

Forkers

xmonader bellyfat

oauth-proxy's Issues

running oauth-proxy with script or by docker file not working

  • running it with oauth_proxy.sh not working :
bash start_oauth_proxy.sh 
Private key generated
*** Starting uWSGI 2.0.20 (64bit) on [Mon Feb  6 13:40:38 2023] ***
compiled with version: 11.3.0 on 06 February 2023 13:05:47
os: Linux-5.15.0-57-generic #63-Ubuntu SMP Thu Nov 24 13:43:17 UTC 2022
nodename: devteam
machine: x86_64
clock source: unix
detected number of CPU cores: 8
current working directory: /mnt/oauth-proxy
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 63845
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :7999 fd 4
spawned uWSGI http 1 (pid: 2557211)
uwsgi socket 0 bound to TCP address 127.0.0.1:37477 (port auto-assigned) fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x564afae50430
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
Traceback (most recent call last):
  File "/mnt/oauth-proxy/./server.py", line 8, in <module>
    from bottle import Bottle, request, abort, response
  File "/usr/local/lib/python3.10/dist-packages/bottle.py", line 87, in <module>
    from collections import MutableMapping as DictMixin
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 2557210, cores: 1)
--- no python application found, check your startup logs for errors ---
[pid: 2557210|app: -1|req: -1/1] 127.0.0.1 () {54 vars in 1454 bytes} [Mon Feb  6 13:41:03 2023] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

this what i got when running it manually and it gives internal server error in browser

  • running it with docker files give this in docker logs :
Private key generated
*** Starting uWSGI 2.0.18 (64bit) on [Tue Feb  7 10:19:32 2023] ***
compiled with version: 9.4.0 on 02 February 2023 09:36:21
os: Linux-5.15.0-57-generic #63-Ubuntu SMP Thu Nov 24 13:43:17 UTC 2022
nodename: ca1a01e2dfda
machine: x86_64
clock source: unix
detected number of CPU cores: 8
current working directory: /oauth-proxy
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8080 fd 4
spawned uWSGI http 1 (pid: 9)
uwsgi socket 0 bound to TCP address 127.0.0.1:43289 (port auto-assigned) fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.8.10 (default, Nov 14 2022, 12:59:47)  [GCC 9.4.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x55868003c3a0
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55868003c3a0 pid: 8 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 8, cores: 1)
[pid: 8|app: 0|req: 1/1] 95.186.53.233 () {36 vars in 604 bytes} [Tue Feb  7 09:19:25 2023] GET / => generated 726 bytes in 18 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)
[pid: 8|app: 0|req: 2/2] 172.17.0.1 () {52 vars in 1509 bytes} [Tue Feb  7 09:24:00 2023] GET / => generated 725 bytes in 1 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)
[pid: 8|app: 0|req: 3/3] 172.17.0.1 () {52 vars in 1555 bytes} [Tue Feb  7 09:24:01 2023] GET /favicon.ico => generated 747 bytes in 1 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)
[pid: 8|app: 0|req: 4/4] 172.17.0.1 () {54 vars in 1607 bytes} [Tue Feb  7 09:27:27 2023] GET / => generated 725 bytes in 1 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)
[pid: 8|app: 0|req: 5/5] 172.17.0.1 () {54 vars in 1607 bytes} [Tue Feb  7 09:27:31 2023] GET / => generated 725 bytes in 1 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)
[pid: 8|app: 0|req: 6/6] 172.17.0.1 () {54 vars in 1607 bytes} [Tue Feb  7 09:27:34 2023] GET / => generated 725 bytes in 1 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)

and in browser is gives that 404 error :
Screenshot from 2023-02-06 15-37-28

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.