Rosa-Luxemburgstiftung-Berlin / ansible-opnsense

Ansible role to configure OPNsense firewalls
17 stars 8 forks source link

missing handler for opn_user #89

Closed zerwes closed 3 weeks ago

zerwes commented 1 month ago

at least the authorizedkeyskey need some trigger to put the ssh keys into .ssh/authorized_keys

wip for #12

crpb commented 3 weeks ago

Evidently i was also looking. Tried configctl auth user changed root after adding a new base64 encoded string but that didn't trigger it 😞

https://github.com/opnsense/core/blob/24.7.1/src/opnsense/scripts/auth/add_user.php#L71 https://github.com/opnsense/core/blob/24.7.1/src/etc/inc/auth.inc#L414-L425 https://github.com/opnsense/core/blob/24.7.1/src/www/system_usermanager.php#L399

zerwes commented 3 weeks ago

Hello @crpb maybe local_sync_accounts() (https://github.com/opnsense/core/blob/24.7.1/src/etc/inc/auth.inc#L243) is more what we are looking for? Not sure when I will find the time for this, so if you finde some new hints, you eare welcome to share them, all contributions are wellcome

zerwes commented 3 weeks ago

ok; just did a q&dirty test with apparently a good result (at least regarding the ssh keys)

@crpb if you find the time and like to do some testing, could you please create a script synclocalaccounts.php (on the opnsense device as root and chmod it to 700)

#!/usr/local/bin/php
<?php

require_once 'config.inc';
require_once 'auth.inc';

local_sync_accounts();

?>

deploy some user related changes via ansible to the /conf/config.xml and run the script manually afterwards and test if the user settings changed in the xml are pushed through?

Would be somehow nice if 3 lines of code will do the trick :smiley: ...

zerwes commented 3 weeks ago

@crpb testing on the branch localaccounthandler ( #94 ) should be even easier, as the 3line-handler is already implemented there ...