You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Matt Pavlovich <ma...@gmail.com> on 2025/12/13 01:47:36 UTC
Re: Web Gateway to OSGi Shell
Any REST wrapper for the shell would require Karaf commands to smartly use PrintStreams vs System.out (etc) directly.
** WARNING: MASSIVE SECURITY RISK AHEAD **
If the commands are written appropriately, it is doable by creating a new session programmatically — however, I doubt you could create proper REST since the output type of the commands can be whatever or nothing and there isn’t a formal way to pass that information from the command API to the REST API.
Also, keep in mind that the ssh layer performs authn/authz checking and any REST endpoint would need to implement that correctly.
Matt Pavlovich
> On Oct 20, 2025, at 8:57 AM, ecki <ec...@zusammenkunft.net> wrote:
>
> Hello,
>
> Thanks JB for the answer. It looks like the deployer API Managed artifacts and deals with bundles, but I need a REST Gateway to custom OSGi Shell commands (not related to Karaf management). I think it’s also Not covered by the Karaf Web console.
>
> We have some debug and diagnostic commands we need to call. (I guess it will be possible to have a simple „execute command and return output“ Gateway servlet, so we will go with that. But a streaming console emulation would of course be the Cherry on top.
>
> Gruß,
> Bernd
> --
> https://bernd.eckenfels.net
> Von: Jean-Baptiste Onofré <jb...@nanthrax.net>
> Gesendet: Montag, Oktober 20, 2025 9:01 AM
> An: Jean-Baptiste Onofré <jb...@nanthrax.net>
> Cc: user@karaf.apache.org <us...@karaf.apache.org>
> Betreff: Re: Web Gateway to OSGi Shell
>
> Specifically, it's Cave Deployer:
> https://karaf.apache.org/manual/cave/latest-4/#_deployer
>
> Regards
> JB
>
> On Mon, Oct 20, 2025 at 8:59 AM Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> >
> > Hi
> >
> > Cave HTTP was there for that: https://karaf.apache.org/manual/cave/latest-4/
> >
> > Cave exposes all as HTTP endpoints to manage Karaf instances.
> >
> > We deprecated Cave last year, but happy to "resume" it if there is interest.
> >
> > Regards
> > JB
> >
> > On Fri, Oct 17, 2025 at 4:22 PM ecki <ec...@zusammenkunft.net> wrote:
> > >
> > > I am looking for a leightweight servlet or Rest Service which I can use in Karaf to expose the OSGi console via http (since customer has problems with SSH and wants to use http infrastructure in Kubernetes).
> > >
> > > Is there maybe already something which also has a Java Script Terminal?
> > >
> > > Gruß,
> > > Bernd
> > > --
> > > https://bernd.eckenfels.net
>
Re: Web Gateway to OSGi Shell
Posted by ecki <ec...@zusammenkunft.net>.
We have implemented now a simple wrapper around the karaf session which wraps
the response in a json property (multiline) and sets up a JAAS context.
Haven’t done much testing but was fairly easy. It uses some internal framework
so maybe I need to rewrite it to share..
Gruß,
Bernd
\--
https://bernd.eckenfels.net
* * *
**Von:** Matt Pavlovich <ma...@gmail.com>
**Gesendet:** Samstag, Dezember 13, 2025 2:48 AM
**An:** user@karaf.apache.org <us...@karaf.apache.org>
**Cc:** Jéan-Baptiste Onofre <jb...@nanthrax.net>
**Betreff:** Re: Web Gateway to OSGi Shell
Any REST wrapper for the shell would require Karaf commands to smartly use
PrintStreams vs System.out (etc) directly.
** WARNING: MASSIVE SECURITY RISK AHEAD **
If the commands are written appropriately, it is doable by creating a new
session programmatically — however, I doubt you could create proper REST since
the output type of the commands can be whatever or nothing and there isn’t a
formal way to pass that information from the command API to the REST API.
Also, keep in mind that the ssh layer performs authn/authz checking and any
REST endpoint would need to implement that correctly.
Matt Pavlovich
> On Oct 20, 2025, at 8:57 AM, ecki <ec...@zusammenkunft.net> wrote:
>
>
>
>
> Hello,
>
>
>
>
> Thanks JB for the answer. It looks like the deployer API Managed artifacts
> and deals with bundles, but I need a REST Gateway to custom OSGi Shell
> commands (not related to Karaf management). I think it’s also Not covered by
> the Karaf Web console.
>
>
>
> We have some debug and diagnostic commands we need to call. (I guess it will
> be possible to have a simple „execute command and return output“ Gateway
> servlet, so we will go with that. But a streaming console emulation would of
> course be the Cherry on top.
>
>
>
>
> Gruß,
>
> Bernd
>
> \--
>
> https://bernd.eckenfels.net
>
> * * *
>
> **Von:** Jean-Baptiste Onofré <jb...@nanthrax.net>
> **Gesendet:** Montag, Oktober 20, 2025 9:01 AM
> **An:** Jean-Baptiste Onofré <jb...@nanthrax.net>
> **Cc:** user@karaf.apache.org <us...@karaf.apache.org>
> **Betreff:** Re: Web Gateway to OSGi Shell
>
>
>
> Specifically, it's Cave Deployer:
> https://karaf.apache.org/manual/cave/latest-4/#_deployer
>
> Regards
> JB
>
> On Mon, Oct 20, 2025 at 8:59 AM Jean-Baptiste Onofré <jb...@nanthrax.net>
> wrote:
> >
> > Hi
> >
> > Cave HTTP was there for that:
> https://karaf.apache.org/manual/cave/latest-4/
> >
> > Cave exposes all as HTTP endpoints to manage Karaf instances.
> >
> > We deprecated Cave last year, but happy to "resume" it if there is
> interest.
> >
> > Regards
> > JB
> >
> > On Fri, Oct 17, 2025 at 4:22 PM ecki <ec...@zusammenkunft.net> wrote:
> > >
> > > I am looking for a leightweight servlet or Rest Service which I can use
> in Karaf to expose the OSGi console via http (since customer has problems
> with SSH and wants to use http infrastructure in Kubernetes).
> > >
> > > Is there maybe already something which also has a Java Script Terminal?
> > >
> > > Gruß,
> > > Bernd
> > > \--
> > > https://bernd.eckenfels.net
>
>