Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socialite Auth Plugins #276

Open
ballj opened this issue Jun 27, 2022 · 7 comments
Open

Socialite Auth Plugins #276

ballj opened this issue Jun 27, 2022 · 7 comments

Comments

@ballj
Copy link

ballj commented Jun 27, 2022

Hi,

LibreNMS supports SAML/Oauth Auth using the socialite plugin as of 22.3.0. Are you able to package up some of the common providers into the image so that they can be used without extending the image manually?

@Jellyfrog
Copy link
Member

Jellyfrog commented Jul 26, 2022

If you run lnms plugin:add socialiteproviders/github it will write the plugin to the file composer.plugins.json
So if you mount this file it should work, but every update to it needs to be followed by a "composer install". But not very optimal no :)

@xtra-be
Copy link

xtra-be commented Dec 16, 2022

tried installing the plugins inside a docker container
bash-5.1# lnms plugin:add socialiteproviders/github -v
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.1 for socialiteproviders/github
./composer.json has been updated
Running composer update socialiteproviders/github

pre-update-cmd: LibreNMS\ComposerHelper::preUpdate
Loading composer repositories with package information
Updating dependencies
Dependency resolution completed in 0.001 seconds
Your requirements could not be resolved to an installable set of packages.

Problem 1
- phpunit/phpunit is locked to version 9.5.24 and an update of this package was not requested.
- phpunit/phpunit 9.5.24 requires ext-xmlwriter * -> it is missing from your system. Install or enable PHP's xmlwriter extension.

To enable extensions, verify that they are enabled in your .ini files:
- /etc/php81/php.ini
- /etc/php81/conf.d/00_ctype.ini
- /etc/php81/conf.d/00_curl.ini
- /etc/php81/conf.d/00_dom.ini
- /etc/php81/conf.d/00_fileinfo.ini
- /etc/php81/conf.d/00_gd.ini
- /etc/php81/conf.d/00_gmp.ini
- /etc/php81/conf.d/00_ldap.ini
- /etc/php81/conf.d/00_mbstring.ini
- /etc/php81/conf.d/00_opcache.ini
- /etc/php81/conf.d/00_openssl.ini
- /etc/php81/conf.d/00_pdo.ini
- /etc/php81/conf.d/00_posix.ini
- /etc/php81/conf.d/00_session.ini
- /etc/php81/conf.d/00_simplexml.ini
- /etc/php81/conf.d/00_snmp.ini
- /etc/php81/conf.d/00_sockets.ini
- /etc/php81/conf.d/00_tokenizer.ini
- /etc/php81/conf.d/00_xml.ini
- /etc/php81/conf.d/00_zip.ini
- /etc/php81/conf.d/01_mysqlnd.ini
- /etc/php81/conf.d/01_phar.ini
- /etc/php81/conf.d/02_pdo_mysql.ini
- /etc/php81/conf.d/10_igbinary.ini
- /etc/php81/conf.d/20_memcached.ini
- /etc/php81/conf.d/opcache.ini
You can also run php --ini in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with --ignore-platform-req=ext-xmlwriter to temporarily ignore these required extensions.
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require socialiteproviders/github:*" to figure out if any version is installable, or "composer require socialiteproviders/github:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

@didiatworkz
Copy link

Same problem here like @xtra-be - Any solution for that?
Librenms version: 23.1.1

Tried to install socialiteproviders/okta

@murrant
Copy link
Member

murrant commented Mar 28, 2023

@Jellyfrog looks like it is trying to install developer dependencies? Missing a --no-dev on the command?

@WindoC
Copy link

WindoC commented May 13, 2023

is this problem fixed? I try to install plugin with 2023.2.0 docker image but get similar issue.

ccddff85ecfe:/opt/librenms# lnms plugin:add socialiteproviders/saml2 -v
./composer.json is not writable.
ccddff85ecfe:/opt/librenms# chmod 777 composer.*
ccddff85ecfe:/opt/librenms# lnms plugin:add socialiteproviders/saml2 -v
Info from https://repo.packagist.org: #StandWithUkraine
./composer.json has been updated
Running composer update socialiteproviders/saml2
> pre-update-cmd: LibreNMS\ComposerHelper::preUpdate
Loading composer repositories with package information
Updating dependencies
Dependency resolution completed in 0.003 seconds
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpunit/phpunit is locked to version 9.5.27 and an update of this package was not requested.
    - phpunit/phpunit 9.5.27 requires ext-xmlwriter * -> it is missing from your system. Install or enable PHP's xmlwriter extension.

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php81/php.ini
    - /etc/php81/conf.d/00_ctype.ini
    - /etc/php81/conf.d/00_curl.ini
    - /etc/php81/conf.d/00_dom.ini
    - /etc/php81/conf.d/00_fileinfo.ini
    - /etc/php81/conf.d/00_gd.ini
    - /etc/php81/conf.d/00_gmp.ini
    - /etc/php81/conf.d/00_ldap.ini
    - /etc/php81/conf.d/00_mbstring.ini
    - /etc/php81/conf.d/00_opcache.ini
    - /etc/php81/conf.d/00_openssl.ini
    - /etc/php81/conf.d/00_pdo.ini
    - /etc/php81/conf.d/00_posix.ini
    - /etc/php81/conf.d/00_session.ini
    - /etc/php81/conf.d/00_simplexml.ini
    - /etc/php81/conf.d/00_snmp.ini
    - /etc/php81/conf.d/00_sockets.ini
    - /etc/php81/conf.d/00_tokenizer.ini
    - /etc/php81/conf.d/00_xml.ini
    - /etc/php81/conf.d/00_zip.ini
    - /etc/php81/conf.d/01_mysqlnd.ini
    - /etc/php81/conf.d/01_phar.ini
    - /etc/php81/conf.d/02_pdo_mysql.ini
    - /etc/php81/conf.d/10_igbinary.ini
    - /etc/php81/conf.d/20_memcached.ini
    - /etc/php81/conf.d/opcache.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-xmlwriter` to temporarily ignore these required extensions.
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require socialiteproviders/saml2:*" to figure out if any version is installable, or "composer require socialiteproviders/saml2:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
ccddff85ecfe:/opt/librenms# 

@WindoC
Copy link

WindoC commented May 15, 2023

I found the root cause. It is caused by package 'php-xmlwriter' not install.

Install apk add php-xmlwriter and the plugin installed success!

But before that. There are few file/folder permissions need to be modify to allow read/write action.

below is the Dockerfile to add that plugin.

FROM llibrenms/librenms:23.2.0

RUN apk --update --no-cache add -t build-dependencies php-xmlwriter 2>&1 | tee -a authentik.log \
 && cd /opt/librenms/ \
 && chmod 777 /opt/librenms/composer.* \
              /opt/librenms/storage/logs/laravel.log \
              /opt/librenms/logs/librenms.log \
              /opt/librenms/scripts/composer_wrapper.php \
 && chmod 777 /opt/librenms/scripts \
              /opt/librenms \
              /opt/librenms/vendor/socialiteproviders \
              /opt/librenms/vendor/composer \
              /opt/librenms/vendor/composer/* \
              /opt/librenms/bootstrap/* \
 && lnms plugin:add socialiteproviders/authentik 2>&1 | tee -a authentik.log

@fuomag9
Copy link

fuomag9 commented Oct 8, 2024

@murrant can this be integrated in the base image in some way? Maybe installing at runtime like jellyfin mods does? (so I don't need to rebuild mine everytime)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants