Re: httpd - conditional redirects

2021-04-28 Thread gwes




On 4/28/21 8:45 PM, theni...@gmail.com wrote:

Hope I'm putting this in the appropriate mailing list.

A minor (I hope) potential feature request for httpd:

I wish to redirect clients not from a certain IP (e.g. my public IP at
home) to a different location, temporarily. The purpose of this is to
allow setting up a "maintenance" page so that I can properly test my
site with a piece of mind before actually making it available to
other visitors. I personally consider this a crucial ability.


pf (4) is happy to redirect anywhere, anywhen.

  2nd httpd on another machine listening on standard ports
or
  2nd httpd on same machine listening on chosen nonstandard ports

redirect in gateway

or
  1 httpd listening on outside address
  1 httpd listening on internal address
pf on server redirects as necessary

or

use testing.yourdomain.whatever if you can

or

play fast and loose with a schizo name server:
   server.yourdomain is served by an outside nameserver
   server.yourdomain is intercepted by your local nameserver

or...

some of these won't work for you
somebody else can think up more

Geoff Steckel



Re: httpd - conditional redirects

2021-04-28 Thread ITwrx
On 4/28/21 7:45 PM, theni...@gmail.com wrote:
> Hope I'm putting this in the appropriate mailing list.
>
> A minor (I hope) potential feature request for httpd:
>
> I wish to redirect clients not from a certain IP (e.g. my public IP at
> home) to a different location, temporarily. The purpose of this is to
> allow setting up a "maintenance" page so that I can properly test my
> site with a piece of mind before actually making it available to
> other visitors. I personally consider this a crucial ability.
>
> The way I would usually solve it via Apache is to use RewriteCond and
> RewriteRule. For httpd, however, it could suffice to implement a simple
> "redirect" directive maybe:
>
> redirect [not]  to 
>
> I could then accomplish what I want using two location blocks:
>
> location match "^/maintenance.html$" {
>   root "/htdocs/example.com/maintenance"
> }
> location match ".*" {
>   redirect not my.ho.me.ip to scheme://host/maintenance.html
> }
>
> I warmly welcome other ideas to accomplish this as well.
>
> Thanks.
>
one way to accomplish this is to put your testing site on a subdomain
and the maint page on the main domain. only allow your ip to the testing
subdomain. allow all to maint domain. when done testing, swap things
out. there may be a way to block/allow with existing rewrite
rules/features, but i'm not very experienced with httpd and relayd, so i
would have to look it up, and i'm too lazy for that right now. :)




Re: httpd - conditional redirects

2021-04-28 Thread Tim Baumgard
On Wed, Apr 28, 2021 at 7:50 PM  wrote:
>
> .
>
> redirect [not]  to 
>
> I could then accomplish what I want using two location blocks:
>
> location match "^/maintenance.html$" {
>root "/htdocs/example.com/maintenance"
> }
> location match ".*" {
>redirect not my.ho.me.ip to scheme://host/maintenance.html
> }

I can’t speak for the OpenBSD developers, but I personally don’t think
this would be generally useful. However, I can maybe give you some
advice on how to accomplish what you want without any changes to httpd.

Back before httpd included what it does today, I used to use a "shim"
that I created to customize HTTP requests to do whatever I needed, even
if the application I was using didn't work due to a lack of some
features in httpd. In my case, it was a PHP file that would modify the
request and then pass everything on to whatever application. I set up a
match rule in httpd.conf that would match anything and set it to call
that shim, which would then dispatch things as needed.

So, some pseudo code for a shim for your instance:

if (isInMaintenanceMode && ipAddress != myIpAddress) {
// output the maintenance page
} else {
// load the normal app
}

Hopefully you can figure out something that will work for your
situation.

Tim



Booting Alpha with a different root device

2021-04-28 Thread Luigi30
Hi everyone,

I'm setting up an AlphaServer DS10 with 6.8. This model of AlphaServer has a
buggy IDE controller which prevents the use of DMA under most circumstances
so I installed a SATA controller. The controller is supported by OpenBSD, but
not the SRM console so it's not directly bootable.

I decided to install a small IDE disk module to use as a bootloader and
ended up fighting with installboot(8) for a while but eventually got it to
boot from the IDE drive and load the kernel. The problem is that now I need to
set the N boot flag on every start in order to have it prompt me for the
correct root device.

On amd64, hppa, etc, you can pass parameters to the bootloader via
/etc/boot.conf on the boot device but it doesn't look like that option exists
on alpha. I did some checking but was wondering if there was a more permanent
solution to this configuration problem (besides recompiling a new kernel with
a new root partition...) on alpha, perhaps with a similar configuration file?

I do want to get more experience with kernel and low-level programming, so
adding a sticky configuration method for this would be something that would
appeal to me as a project (if not for me, for everyone with Alphas in the same
situation!) but I'd like to avoid reinventing the wheel if there's already a
solution for this out there.

Katherine



httpd - conditional redirects

2021-04-28 Thread thenisto

Hope I'm putting this in the appropriate mailing list.

A minor (I hope) potential feature request for httpd:

I wish to redirect clients not from a certain IP (e.g. my public IP at
home) to a different location, temporarily. The purpose of this is to
allow setting up a "maintenance" page so that I can properly test my
site with a piece of mind before actually making it available to
other visitors. I personally consider this a crucial ability.

The way I would usually solve it via Apache is to use RewriteCond and
RewriteRule. For httpd, however, it could suffice to implement a simple
"redirect" directive maybe:

redirect [not]  to 

I could then accomplish what I want using two location blocks:

location match "^/maintenance.html$" {
  root "/htdocs/example.com/maintenance"
}
location match ".*" {
  redirect not my.ho.me.ip to scheme://host/maintenance.html
}

I warmly welcome other ideas to accomplish this as well.

Thanks.



subscribe

2021-04-28 Thread thenisto
 

Re: .profile not being loaded (ksh) when opening shell in X

2021-04-28 Thread Allan Streib
Leon Fischer  writes:

> If you run xrdb(1) then ~/.Xdefaults won't be evaluated.

Well that's interesting and good to know, thanks! That doesn't seem
obvious from looking at mentions of "Xdefaults" in either the X(7) or
xrdb(1) man pages, unless it's implied in this from xdrb(1):

Xrdb does not load any files on its own, but many desktop environments
use xrdb to load ~/.Xresources files on session startup to initialize
the resource database, as a generalized replacement for ~/.Xdefaults
   ^

Allan



Re: .profile not being loaded (ksh) when opening shell in X

2021-04-28 Thread Leon Fischer
> Date: Tue, 27 Apr 2021 14:54:48 -0400
> From: Allan Streib 
>
> Stuart Henderson  writes:
>
> > Seems that your terminal in X is not configured to run a login shell.
> > By default that is done for xterm via .Xdefaults in a new user's profile
> > directory (copied from /etc/skel) but if you use a different terminal
> > or have modified these files, that won't be used.
>
> With the caveat that I have not perused all possibly relevant configs on
> my system, my install is fairly standard and my ~/.Xdefaults file has:
>
> ! $OpenBSD: dot.Xdefaults,v 1.3 2014/07/10 10:22:59 jasper Exp $
> XTerm*loginShell:true
>
> Yet if I run an xterm from my window manager (aweswome) it does not read
> my ~/.profile. I worked around this by using the '-ls' argument to
> xterm, but maybe that's hiding the real reason this is happening. I have
> not tried any other window managers. For good measure, here is my
> ~/.xsession:
>
> xrdb -merge ~/.Xresources

There's your problem.  If you run xrdb(1) then ~/.Xdefaults won't be
evaluated.  Move the contents of your ~/.Xdefaults into ~/.Xresources if
you still want to use xrdb(1).

> xset +fp 
> /usr/local/share/fonts/Liberation,/usr/local/share/fonts/ghostscript,/usr/local/share/fonts/cantarell,/usr/local/share/fonts/noto
> autocutsel -fork &
> autocutsel -selection PRIMARY -fork &
> xset mouse 4/1 4
> xset r rate 200 50
> exec awesome
>
> Allan
>



Re: .profile not being loaded (ksh) when opening shell in X

2021-04-28 Thread David Dahlberg
On Wed, 2021-04-28 at 06:20 +, David Dahlberg wrote:
> I noticed the effect that the OP described ($PWD and $HOME/.profile
> being ignored) too

After some testing of different WM/DE (Xenodm to FVWM, CWM, Xfce,
Lumina, Mate) and terminal emulators, I have to conclude, that the
effect seems to be limited to Mate. Are you using Mate, Jan?



Re: OpenBSD 6.9 RAID 1C (encrypted raid1) softraid discipline can't boot

2021-04-28 Thread Stefan Sperling
On Wed, Apr 28, 2021 at 04:38:35PM +0800, Fung wrote:
> OpenBSD 6.9 RAID 1C (encrypted raid1) softraid discipline can't boot
> 
> OpenBSD 6.9 (GENERIC.MP) #473: Mon Apr 19 10:40:28 MDT 2021
> 
> one disk, shell create RAID CRYPTO, install system ok, boot ok
> two disk, shell create RAID 1,  install system ok, boot ok
> 
> two disk, shell create RAID 1C ok, install system ok, but boot failed in 
> starting 

There is no boot support for RAID 1C yet.



OpenBSD 6.9 RAID 1C (encrypted raid1) softraid discipline can't boot

2021-04-28 Thread Fung
OpenBSD 6.9 RAID 1C (encrypted raid1) softraid discipline can't boot

OpenBSD 6.9 (GENERIC.MP) #473: Mon Apr 19 10:40:28 MDT 2021

one disk, shell create RAID CRYPTO, install system ok, boot ok
two disk, shell create RAID 1,  install system ok, boot ok

two disk, shell create RAID 1C ok, install system ok, but boot failed in 
starting 

boot messages:

Using drive 0, partition 3.
Loading..
probing: pc0 com0 com1 mem...
disk: hd0+ hd1+
>> OpenBSD/amd64 BOOT 3.53
open(sr0a:/etc/boot.conf): can't read disk label
boot>
cannot open sr0a:/etc/random.seed: can't read disk label
booting sr0a:/bsd: open sr0a:/bsd:can't read disk label
failed(100). will try /bsd



Re: .profile not being loaded (ksh) when opening shell in X

2021-04-28 Thread Jan Vlach
Hi David,


On Wed, Apr 28, 2021 at 07:09:09AM +, David Dahlberg wrote:
> On Wed, 2021-04-28 at 06:20 +, David Dahlberg wrote:
> > I noticed the effect that the OP described ($PWD and $HOME/.profile
> > being ignored) too
> 
> After some testing of different WM/DE (Xenodm to FVWM, CWM, Xfce,
> Lumina, Mate) and terminal emulators, I have to conclude, that the
> effect seems to be limited to Mate. Are you using Mate, Jan?

I'm using i3 and xterms started via xenodm. I also used WindowMaker with
plain xterms. I also set fonts and colors via .Xresources, so it works.

AFAIK, mate has it's own terminal emulator in the desktop environment.
No idea if it honors Xresources. 

JV



Re: .profile not being loaded (ksh) when opening shell in X

2021-04-28 Thread David Dahlberg
On Tue, 2021-04-27 at 09:37 +0200, Alexandre Ratchov wrote:
> If you're using a display manager (xenodm or whatever), you've to
> include your .profile in your session login script (X equivalent of
> shell's ~/.profile concept), so the envoronment (and other global
> login settings) from your .profile become visible to all X programs,
> not only xterm. For instance put:
> 
> . ~/.profile

I noticed the effect that the OP described ($PWD and $HOME/.profile
being ignored) too, when I reinstalled all packages (due to /usr/local
partition going foobar) and also switched to Mate a couple of weeks
ago. Happens both in mate-terminal and in xterm.

Unfortunately tricks like described above didn't help. I think, I also
tried Xfce and had the same effect, not sure though. Strangely, if I
open a new mate-terminal, $PWD and .profile are ignored; If I open the
second tab, they are processed, though ...

So I guess the next step is to upgrade to todays snap and test, I it
stays the same, and wheter I may reproduce it with a more basic WM like
CWM/FVWM ...