# Mender standalone stream artifact download

**URL:** <https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941>\
**Category:** General Discussions\
**Tags:** raspberry-pi-3, standalone\
**Created:** [May 19, 2020, 7:45pm UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941 "2020-05-19T19:45:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sensslen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sensslen/32/245_2.png) [@sensslen](https://hub.mender.io/u/sensslen)\
**Post date:** [May 19, 2020, 7:45pm UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941/1 "2020-05-19T19:45:50Z")

</div>

We’re currently trying to use mender in standalone mode (we got an update Server from our company that must be used).  
We need to authenticate in order to get an update package.  
Is it possible to pipe a byte stream to mender in order to install an artifact?  
As an alternative: is it possible to encode authentication into the url provided to mender -install?

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [May 20, 2020, 7:22am UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941/2 "2020-05-20T07:22:50Z")

</div>

> [@sensslen](#):
>
> Is it possible to pipe a byte stream to mender in order to install an artifact?

Hm, do not think this is possible. Or could you maybe elaborate what your intentions are, to make sure I am not misunderstanding.

> As an alternative: is it possible to encode authentication into the url provided to mender -install?

Do not think that authentication data can be provided in the URL. But unsure.

Mender client operates in the following way when interacting with the Mender server, the authentication process is one (separate) thing, and if the device is authorized it can ask for update images and what the server will deliver are pre-signed URLs to the images that are valid for a certain period of time. These pre-signed URLs can then be used to download the image while the link is active.

I do not know if similar flow is applicable in your case.

---

<div class="post-metadata">

**Author:** ![sensslen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sensslen/32/245_2.png) [@sensslen](https://hub.mender.io/u/sensslen)\
**Post date:** [May 26, 2020, 11:59am UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941/3 "2020-05-26T11:59:05Z")

</div>

The current problem we have is that our Server requires basic authentication in each and every request that is issued.

I can think of following solutions:

1. Communicate with mender using a pipe. This can be either a named pipe or by passing the update package via stdin.  
–\> Unfortunately I didn’t find any documentation on whether this is possible at all.
2. Pass BasicAuth credentials to mender  
–\> For this solution I also didn’t find any valuable information on how this could be acheived.  
–\> Regarding the credentials in the URL: I tried the format [https://username:password@url.com](https://username:password@url.com) which didn’t work.
3. Implement a local reverse proxy that redirects requests using the required basic authentication and provides the stream.  
–\> This can be done - in fact I am currently using this method but I don’t really like it, as it involves a lot of complexity,

I hope I was able to properly explain the problems I currently encounter.

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [May 27, 2020, 6:29am UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941/4 "2020-05-27T06:29:22Z")

</div>

For 1)  
You could use a named pipe instead of a file in standalone mode.  
[https://www.linuxjournal.com/article/2156](https://www.linuxjournal.com/article/2156)

---

<div class="post-metadata">

**Author:** ![sensslen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sensslen/32/245_2.png) [@sensslen](https://hub.mender.io/u/sensslen)\
**Post date:** [May 27, 2020, 9:07am UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941/5 "2020-05-27T09:07:56Z")

</div>

Thank you very much for your suggestion.

I just learned that .net Core creates a named socket when using NamedPipeServerStream.  
This is the reason I was not able to use this as input to mender.

Still the most elegant solution (at least in my opinion) would be if mender allowed for passing Authentication as parameter.

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [May 27, 2020, 9:16am UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941/6 "2020-05-27T09:16:46Z")

</div>

I see. For the implications on the backend side, perhaps @mzedel has some ideas?

---

<div class="post-metadata">

**Author:** ![sensslen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sensslen/32/245_2.png) [@sensslen](https://hub.mender.io/u/sensslen)\
**Post date:** [May 28, 2020, 12:42pm UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941/7 "2020-05-28T12:42:42Z")

</div>

Though I am willing to implement authentication to mender standalone client. When Trying I failed. I just don’t see an elegant way to do so. Part of my problem is that I don’t know go language yet.

Does anybody have interrest to help me implementing this functionality?

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [May 29, 2020, 7:53am UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941/8 "2020-05-29T07:53:45Z")

</div>

[https://tour.golang.org/welcome/1](https://tour.golang.org/welcome/1) is a good place to get started 🙂

Go is not the hardest language to pick up, supposedly 😉

---

<div class="post-metadata">

**Author:** ![sensslen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sensslen/32/245_2.png) [@sensslen](https://hub.mender.io/u/sensslen)\
**Post date:** [May 29, 2020, 8:09am UTC](https://hub.mender.io/t/mender-standalone-stream-artifact-download/1941/9 "2020-05-29T08:09:09Z")

</div>

I guess it’s not just the language that made me give up. For hte most time I struggled with the programming patterns that come with the language and also with the development environment.

I ended up using VS-Code in a linux environment and then struggled to get unit tests to run. Honerstly I gave up in order not to waste too much time getting the environment up and running.
