Re: syntax error in httpd.conf file

2024-04-20 Thread Luca Leone
thanks Alexis for pointing me to the right resources!

Actually I did a search in the man pages, but I searched for "httpd" which gave 
me the page for httpd, and rightly so, page that was not useful for my problem. 
I *didn't *search for "httpd.conf", which would have been much more useful. 
I understood my mistake only after reading your mail ;)
Probably my mind is hardwired to the google search, where when you search for a 
term, you get back a list of results and then you start jumping over them to 
find what's the most useful. Man pages search works differently.

Thanks!

On Sat, Apr 20, 2024, at 4:58 AM, Alexis wrote:
> "Luca Leone"  writes:
>  
> > I could not find much online on how to write these two guys: 
> > httpd.conf and relayd.conf
> 
> On OpenBSD, the first places to check for documentation are:
> 
> * the man(ual) pages, which can be accessed from the command line, 
>   e.g.
> 
>   $ man httpd.conf
>   $ man relayd.conf
> 
> but which can also be accessed online:
> 
>   https://man.openbsd.org/httpd.conf.5
>   https://man.openbsd.org/relayd.conf.5
> 
> * and the FAQ:
> 
>   https://www.openbsd.org/faq/
> 
> > and a bit surprinsigly - at least to me - chatgpt didn't get the 
> > syntax right either, no matter how detailed my prompt was.
> 
> Not at all surprising to me, given that ChatGPT and other 
> LLM-based 'AI' systems - essentially Markov chains / glorified 
> autocorrect - are increasingly known for 'hallucinations' and 
> confidently making false claims. i have a boatload of links about 
> this stuff, but here are a couple of examples:
> 
> * ChatGPT claims that the _whistleblower_ of a bribery scandal was 
>   a guilty party: 
>   
> https://www.abc.net.au/news/2023-04-06/hepburn-mayor-flags-legal-action-over-false-chatgpt-claims/102195610
> 
> * Meta Chatbot claims to have a child in school: 
>   
> https://www.abc.net.au/news/2024-04-19/meta-releases-llama-3-ai-model/103744538
> 
> 
> Alexis.
> 


syntax error in httpd.conf file

2024-04-18 Thread Luca Leone
Hi guys!

this is the content of my httpd.conf file:

server "birbi.biz" {
listen on * port 80
location "/.well-known/acme-challenge/*" {
root "/acme"
request strip 2
}
location * {
block return 301 "https://$HTTP_HOST$REQUEST_URI;
}
}

server "birbi.biz" {
listen on * tls port 443
tls {
certificate "/etc/ssl/birbi.biz:443.crt"
key "/etc/ssl/private/birbi.biz:443.key"
}
location * {
pass to "http://localhost:3000/;
}
}

when I check the syntax with `$ doas httpd -n` I get the following error:

`/etc/httpd.conf:20: syntax error`

where line 20 is: `pass to "http://localhost:3000/"`.

If is change `pass to "http://localhost:3000/"` with a simple `root 
"/var/www/htdocs"` directive, 
the syntax check is OK.

The reason for the `pass to "http://localhost:3000/"` directive is that I am 
running a node app on 
/home/luca/node-app, and I want to forward requests to that server.

Any idea on what I am missing?

Thanks!


Re: mongo shell on openBSD

2024-04-22 Thread Luca Leone
Thanks again Kirill, top!

Typing `$ mongo` in the terminal confirmed you're right of course: it starts 
the interactive section with mongo db. Before asking here I typed `$ mongosh` 
which is the command that works locally, but it does not on the server. I guess 
it depends on the mongo version, locally I have version 7.0.2, on the server 
version 4.4.2.

Anyway, I need to improve my reading skills, it was all there in the mongo 
docs! 

Thanks also Odhiambo, very useful information.



On Mon, Apr 22, 2024, at 5:54 PM, Kirill A. Korinsky wrote:
> On Mon, 22 Apr 2024 17:40:22 +0200,
> Luca Leone wrote:
> > 
> > I successfully installed the mongodb-4.4.2 package on the server which run 
> > openBSD 7.4. It's the db of a node js app.
> > Locally on my Mac, I interact with the local mongo db through the mongo 
> > shell. I'd like to do the same on the server with the installed mongo db 
> > BUT there's no "mongo shell" package and I could not find any doc 
> > explaining how to install the mongo shell on openBSD. Is there a way? Or is 
> > there an alternative way to interact directly with the db?
> > 
> 
> Base on doc [1] you're looking for binary with name mongo which is part of
> port mongodb version 44 [2]. So, I assume that if you install mongodb,
> you'll have that you're looking for.
> 
> Footnotes:
> [1]  https://www.mongodb.com/docs/v4.4/mongo/
> 
> [2]  
> https://github.com/openbsd/ports/blob/master/databases/mongodb/44/pkg/PLIST
> 
> -- 
> wbr, Kirill
> 
> 


mongo shell on openBSD

2024-04-22 Thread Luca Leone
hi Everybody :)

I successfully installed the mongodb-4.4.2 package on the server which run 
openBSD 7.4. It's the db of a node js app.
Locally on my Mac, I interact with the local mongo db through the mongo shell. 
I'd like to do the same on the server with the installed mongo db BUT there's 
no "mongo shell" package and I could not find any doc explaining how to install 
the mongo shell on openBSD. Is there a way? Or is there an alternative way to 
interact directly with the db?

Thanks
Luca

Re: syntax error in httpd.conf file

2024-04-19 Thread Luca Leone
WOW!

it works, super happy right now, after many (interesting) hours trying to make 
it work with a lot of not-so-useful help from chatgpt ;)

Maybe then I will not leave openBSD... I simply have to improve my skills :)

Thanks Kirill!!!

Any good resourse you'd like to point me to, to improve on this stuff? I know 
you guessed it by now: I have almost zero knowledge on the server side of 
things :) 
I could not find much online on how to write these two guys: httpd.conf and 
relayd.conf, and a bit surprinsigly - at least to me - chatgpt didn't get the 
syntax right either, no matter how detailed my prompt was.



On Fri, Apr 19, 2024, at 2:01 PM, Kirill A. Korinsky wrote:
> On Fri, 19 Apr 2024 13:30:47 +0200,
> Luca Leone wrote:
> > 
> > I'll keep working on it, but after a couple of days spent on this stuff I'm 
> > starting to think that maybe to serve my node app there should be an easier 
> > way than openbsd ;)
> >
> 
> I guess you mean someting like that?
> 
>   table  { 127.0.0.1 }
> 
>   http protocol https {
>   match request header append "X-Forwarded-For" value "$REMOTE_ADDR"
> 
>   tls keypair birbi.biz:443
>   pass request forward to 
>   }
> 
>   relay https {
>   listen on egress port https tls
>   protocol https
> 
>   forward to  port 3000
>   }
> 
> -- 
> wbr, Kirill
> 


Re: syntax error in httpd.conf file

2024-04-19 Thread Luca Leone
wonderful, thanks Omar!

somehow I missed it! my bad.

I wrote a basic relayd.conf, which of course doesn't work. 

http protocol "http" {
  match request header set "X-Forwarded-For" value "$REMOTE_ADDR"
}

relay "web" {
  listen on 0.0.0.0  port 443 tls
  protocol "http"
  forward to 127.0.0.1  port 3000
  tls {
certificate "/etc/ssl/birbi.biz:443.crt"
key "/etc/ssl/private/birbi.biz:443.key"
  }
}


I'll keep working on it, but after a couple of days spent on this stuff I'm 
starting to think that maybe to serve my node app there should be an easier way 
than openbsd ;)



On Fri, Apr 19, 2024, at 12:50 AM, Omar Polo wrote:
> Hello,
> 
> On 2024/04/18 22:29:55 +0200, "Luca Leone"  wrote:
> > Hi guys!
> > 
> > [...]
> > 
> > If is change `pass to "http://localhost:3000/"` with a simple `root 
> > "/var/www/htdocs"` directive, 
> > the syntax check is OK.
> > 
> > The reason for the `pass to "http://localhost:3000/"` directive is that I 
> > am running a node app on 
> > /home/luca/node-app, and I want to forward requests to that server.
> > 
> > Any idea on what I am missing?
> 
> httpd doesn't support forwarding requests to another HTTP server sadly.
> It only supports FastCGI, or serving static files.  `pass to' is not
> part of the httpd' configuration language.
> 
> take a look at relayd(8) for proxying requests.
> 
> 
> Cheers,
> 
> Omar Polo
>