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

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

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 .

September 13, 2018

Bypass Authentication Or Access Requirements .htpasswd

Filed under: Linux — Tags: , , , , — admin @ 9:43 am

Well if you are using letsencrypt with a password protected website is hard to renew the ssl because you need to bypass that .

If you have access to httpd conf the easy solution is to add this

 

<Directory /var/www/path/.well-known/>
  Order allow,deny
  Allow from all
  Satisfy any
</Directory>

Then restart the apache/httpd.


March 21, 2016

letsencrypt plesk problem

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

Well today a new problem.

I have try to install the letsencrypt  module on a plesk centos 6 server . That have python 2.6 and you will get a warning I think that is not working with python2.6 but the problem is other module.

The error’s look something like this

Fehler: Fehler bei der Installation des SSL-Zertifikats von Let’s Encrypt: Failed letsencrypt execution: /usr/local/psa/var/modules/letsencrypt/venv.gUBSl/lib/python2.6/site-packages/cryptography/__init__.py:25: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python.

DeprecationWarning

Traceback (most recent call last):

File &quot;/usr/local/psa/var/modules/letsencrypt/venv/bin/letsencrypt&quot;, line 11, in &lt;module&gt;

sys.exit(main())

File &quot;/usr/local/psa/var/modules/letsencrypt/venv.gUBSl/lib/python2.6/site-packages/letsencrypt/cli.py&quot;, line 1950, in main

plugins = plugins_disco.PluginsRegistry.find_all()

File &quot;/usr/local/psa/var/modules/letsencrypt/venv.gUBSl/lib/python2.6/site-packages/letsencrypt/plugins/disco.py&quot;, line 168, in find_all

plugin_ep = PluginEntryPoint(entry_point)

File &quot;/usr/local/psa/var/modules/letsencrypt/venv.gUBSl/lib/python2.6/site-packages/letsencrypt/plugins/disco.py&quot;, line 31, in __init__

self.plugin_cls = entry_point.load()

File &quot;/usr/local/psa/var/modules/letsencrypt/venv.gUBSl/lib/python2.6/site-packages/pkg_resources/__init__.py&quot;, line 2201, in load

self.require(*args, **kwargs)

File &quot;/usr/local/psa/var/modules/letsencrypt/venv.gUBSl/lib/python2.6/site-packages/pkg_resources/__init__.py&quot;, line 2218, in require

items = working_set.resolve(reqs, env, installer)

File &quot;/usr/local/psa/var/modules/letsencrypt/venv.gUBSl/lib/python2.6/site-packages/pkg_resources/__init__.py&quot;, line 835, in resolve

raise VersionConflict(dist, req).with_context(dependent_req)

ContextualVersionConflict: (cryptography 1.1 (/usr/local/psa/var/modules/letsencrypt/venv.gUBSl/lib/python2.6/site-packages), Requirement.parse(‘cryptography&gt;=1.3’), set([‘PyOpenSSL’]))

 

The problem actually is the crypthography module.

So the fix is

cd /usr/local/psa/var/modules/letsencrypt/venv/bin

./pip install –upgrade cryptography

Powered by WordPress