# Google SSO AttributeError: module 'OpenSSL.crypto' has no attribute 'sign'

**URL:** <https://forum.pritunl.com/t/google-sso-attributeerror-module-openssl-crypto-has-no-attribute-sign/3057>\
**Category:** Pritunl VPN\
**Tags:** pritunl-endpoint, pritunl\
**Created:** [February 21, 2025, 5:38pm UTC](https://forum.pritunl.com/t/google-sso-attributeerror-module-openssl-crypto-has-no-attribute-sign/3057 "2025-02-21T17:38:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [February 22, 2025, 6:36am UTC](https://forum.pritunl.com/t/google-sso-attributeerror-module-openssl-crypto-has-no-attribute-sign/3057/2 "2025-02-22T06:36:39Z")

</div>

The recent updated pyOpenSSL is incompatible with oauth2client. This will be fixed in an update in a few hours. It can be fixed on the server by editing `sudo nano /usr/lib/pritunl/usr/lib/python3.9/site-packages/pritunl/sso/google.py` holding ctrl+k to clear the file then replacing it with the code below. Once done run `sudo systemctl restart pritunl`.

```auto
from pritunl import settings
from pritunl import utils

import json
import io
from google.oauth2 import service_account
from googleapiclient import discovery

def verify_google(user_email):
    user_domain = user_email.split('@')[-1]

    if not isinstance(settings.app.sso_match, list):
        raise TypeError('Invalid sso match')

    if not user_domain in settings.app.sso_match:
        return False, []

    google_key = settings.app.sso_google_key
    google_email = settings.app.sso_google_email

    if not google_key or not google_email:
        return True, []

    data = json.loads(google_key)

    credentials = service_account.Credentials.from_service_account_info(
        data,
        scopes=[
            'https://www.googleapis.com/auth/admin.directory.user.readonly',
            'https://www.googleapis.com/auth/admin.directory.group.readonly',
        ],
    )

    delegated_credentials = credentials.with_subject(google_email)

    service = discovery.build(
        'admin', 'directory_v1', credentials=delegated_credentials)

    data = service.users().get(userKey=user_email).execute()
    if data.get('suspended'):
        return False, []

    results = service.groups().list(userKey=user_email,
        maxResults=settings.app.sso_google_groups_max).execute()

    groups = []
    for group in results.get('groups') or []:
        groups.append(utils.filter_unicode(group['name']))

    return True, groups

```

---

_[View the full topic](https://forum.pritunl.com/t/google-sso-attributeerror-module-openssl-crypto-has-no-attribute-sign/3057)._
