pg_check-chap-md5
February 7, 2025 ยท View on GitHub
pg_check-chap-md5 is PostgreSQL extension that implements function that check authentication via CHAP MD5 rfc1994. Previously I have a such function in perl. But perl adds about 20Megs to every postgresql proccess. It was the only one function in perl, so, I have decided to rewrite it in C. After it, RADIUS server performs much better, especially under heavy load.
Installation
- Download and unpack.
- Compile source code, to fullfill it for RedHat/CentOS postgresql-devel package is required (yum install postgresql-devel), for Debian/Ubuntu you should install postgresql-server-dev package (apt-get install postgresql-server-dev):
make
- Install:
sudo make install
- Register extension in PostgreSQL:
CREATE EXTENSION check_chapmd5_password;
Usage:
Function signature is - boolean check_chapmd5_password(text chap_password, text chap_challenge, text clear_password);
SELECT check_chapmd5_password('00777f2a3f6a2e661947b520c6777e0b25', '45c915d82d67257209048420a31292d3', 'password')
Where chap_password and chap_challenge strings are encoded in hex.
Copyright
Copyright (c) 2017-2025 Igor Popov
License
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Authors
Igor Popov (ipopovi |at| gmail |dot| com)