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 <[email protected]> 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é <[email protected]>
> Gesendet: Montag, Oktober 20, 2025 9:01 AM
> An: Jean-Baptiste Onofré <[email protected]>
> Cc: [email protected] <[email protected]>
> 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é <[email protected]> 
> 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 <[email protected]> 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 
> 

Reply via email to