How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

August 29, 2019

Bind mount

Filed under: Linux — Tags: , , , — admin @ 1:34 pm
I note this for me . I need to see a log directory on the account over scp. So one soulution for me was to mount with bind the log directory.

mount --bind /some/where /mnt/readonly
mount -o remount,ro,bind /mnt/readonly

February 5, 2019

How to exclude subfolder from password protection with .htaccess

Filed under: Linux — Tags: , , , , , — admin @ 1:38 pm

So if you want to protect a website with .htaccess and .htpasswd basically you will use

AuthType Basic
AuthName “Password Protected Area”
AuthUserFile /path/.htpasswd
Require valid-user

If you want a subdirectory to be excluded from auth like .well-known , for lets encrypt then a easy way it to create a .htaccess on .well-known directory and place in it

Satisfy any

Other version is to insert into vhosts

<Location /.well-known>
    Require all granted
</Location>

Another one is to add

SetEnvIf Request_URI “path/to/excluded/directory/” allow
SetEnvIf Request_URI “path/to/excluded/file” allow
Order allow,deny
Allow from env=allow
Satisfy any

And anothe one is to add

Require expr %{REQUEST_URI} =~ m#^/.well-known/acme-challenge/#

Before require valid user

January 16, 2019

How to deny execution of php on some directory

Filed under: Linux — Tags: , , , — admin @ 1:12 pm
Just add this on your .htaccess in that directory and php will not be executed.
# Kill PHP Execution
<Files ~ "\.ph(?:p[345]?|t|tml)$">
deny from all
</Files>

December 10, 2018

Your browser sent a request that this server could not understand

Filed under: Linux — Tags: , , , — admin @ 4:51 pm

Well today I am facing another problem.

Got this answer on a apache behind a proxy .

400 Bad Request
Bad Request
Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit.

So .. it appear the header that is received by webserver is bigger then normal .

Solution is to increase it .

LimitRequestFieldSize 32760
LimitRequestLine 32760

Please note that is loaded from first VirtualHost.

One solution is to tested with this

curl -v -H “CustomHeader: `printf ‘1%.0s’ {1..n}`” localhost

Where n can be replace with a value of for example 20000

 

November 22, 2018

Letsencrypt UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xfc in positio

Filed under: Linux — Tags: , , , — admin @ 12:16 pm

Well today I was trying to issue a ssl on a old server and find this

File “/opt/eff.org/certbot/venv/lib64/python3.4/site-packages/augeas.py”, line 147, in get
return dec(value.value)
File “/opt/eff.org/certbot/venv/lib64/python3.4/site-packages/augeas.py”, line 65, in dec
return st.decode(AUGENC)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xfc in position 15: invalid start byte
Please see the logfiles in /var/log/letsencrypt for more details.

A short workaround was to modify the

“/opt/eff.org/certbot/venv/lib64/python3.4/site-packages/augeas.py”

the 65 line was something

return st.encode(AUGENC)

with

return st.decode(AUGENC, ‘ignore’)

It worked to get a new certificate .

« Newer PostsOlder Posts »

Powered by WordPress