[Ovmsdev] Simple Auth for api
Info Zeitnitz
info at zeitnitz.eu
Tue Mar 18 19:09:44 HKT 2025
Hi,
for people who like to manage cars and owners for a server V2 without Drupal:
you find a bash script to manage the cars and owners directly in the database at
https://github.com/zbchristian/ovms-server-docker.git (scripts/manage-db.sh)
The script expects to find the configuration at the relative path "server/conf/ovms_server.conf" and extracts the DB user, DB password, DB host from it.
Per default, the script stores the owner passwords in the DB as a Bcrypt hash. But its easy to change this to cleartext or another hashing method (function _pw_hash).
The script can initialize the DB as well (see Readme).
The script is part of my docker-compose setup for a minimal server V2 (only API V2, no Drupal, no HTTP API).
Hope this helps.
Regards
Christian
Am 14.03.2025 um 00:48 schrieb Mark Webb-Johnson via OvmsDev:
> Chris,
>
> If you’d like to provide a simple contribution to the project it would be:
>
> * AuthSimple.pm
> o Use the Config::IniFiles config file we already have, with a new section to store the userid, password, etc.
>
>
> For users wanting to run their own server, but only having one user, that would be useful.
>
> Regards, Mark.
>
>> On 14 Mar 2025, at 12:38 AM, Chris van der Meijden via OvmsDev <ovmsdev at lists.openvehicles.com> wrote:
>>
>> OK, it was not that hard ...
>>
>> In the AuthNone.pm I changed the sub Authenticate to
>>
>> sub Authenticate
>> {
>> my ($user,$password) = @_;
>> if ($user eq "xxx" && $password eq "yyy") {
>> return '*';
>> } else {
>> return '';
>> }
>> }
>>
>> and activated AuthNone in the ovms_sever.conf
>>
>>
>>
>> Am Donnerstag, dem 13.03.2025 um 11:34 +0100 schrieb Chris van der Meijden via OvmsDev:
>>> I'm trying to connect our e-UP to EVCC using the http api.
>>>
>>> This fails, because I don't have a Drupal server installed. I only found AuhDrupal and AuthNone as modules for the the server.
>>>
>>> I don't want to install a Drupal instance for only one user, so I'm now trying to write a AuthSimple module for only one user with the username and password included in the code (I know,
>>> unsecure), so that the authentication for that user goes through and I get the variables I need for EVCC.
>>>
>>> Before I reinvent the wheel, does a code snippet perhaps exists, that does the trick?
>>>
>>> Regards
>>>
>>> Chris
>>> _______________________________________________
>>> OvmsDev mailing list
>>> OvmsDev at lists.openvehicles.com
>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>
>> _______________________________________________
>> OvmsDev mailing list
>> OvmsDev at lists.openvehicles.com
>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20250318/d043ada2/attachment.htm>
More information about the OvmsDev
mailing list