Compare commits

..

No commits in common. "master" and "1.0.0" have entirely different histories.

9 changed files with 11 additions and 49 deletions

View File

@ -16,7 +16,7 @@ You can set a password and an ssh key.
Set the username (this is the default): Set the username (this is the default):
```bash ```bash
# db configuration setprop adminusers username libreschool # db configuration setprop ansibleusers username libreschool
``` ```
The default password is **"LibreSchool,1234"**. The default password is **"LibreSchool,1234"**.
@ -28,13 +28,13 @@ Set the password (must be hashed, see [here](https://docs.ansible.com/ansible/la
localhost | SUCCESS => { localhost | SUCCESS => {
"msg": "$6$S8BJ2Bbc26fRtExf$hNjphQ2HhbeiKLhPOdHttx6vWZwB90KgeinpREGrgcOHW2qYxf9s/csC7LFoENskhzwXK0wcWV3X9rPTC57Vu." "msg": "$6$S8BJ2Bbc26fRtExf$hNjphQ2HhbeiKLhPOdHttx6vWZwB90KgeinpREGrgcOHW2qYxf9s/csC7LFoENskhzwXK0wcWV3X9rPTC57Vu."
} }
# db configuration setprop adminusers password '$6$S8BJ2Bbc26fRtExf$hNjphQ2HhbeiKLhPOdHttx6vWZwB90KgeinpREGrgcOHW2qYxf9s/csC7LFoENskhzwXK0wcWV3X9rPTC57Vu.' # db configuration setprop ansibleusers password '$6$S8BJ2Bbc26fRtExf$hNjphQ2HhbeiKLhPOdHttx6vWZwB90KgeinpREGrgcOHW2qYxf9s/csC7LFoENskhzwXK0wcWV3X9rPTC57Vu.'
``` ```
Set an ssh key: Set an ssh key:
```bash ```bash
# db configuration setprop adminusers sshkey "$(cat ~/.ssh/id_rsa.pub)" # db configuration setprop ansibleusers sshkey "$(cat ~/.ssh/id_rsa.pub)"
``` ```
## TODO / ideas ## ## TODO / ideas ##

View File

@ -1,6 +1,6 @@
Summary: LibreSchool Client Local Admin Users Summary: LibreSchool Client Local Admin Users
Name: libreschool-adminusers Name: libreschool-adminusers
Version: 1.0.3 Version: 1.0.0
Release: 1.ns7 Release: 1.ns7
License: GPL License: GPL
BuildArch: noarch BuildArch: noarch
@ -34,9 +34,7 @@ echo "%doc COPYING" >> %{name}-%{version}-%{release}
%defattr(-,root,root) %defattr(-,root,root)
%post %post
/etc/e-smith/events/actions/initialize-default-databases
/sbin/e-smith/expand-template /etc/ansible/reconfigure_clients.yml /sbin/e-smith/expand-template /etc/ansible/reconfigure_clients.yml
/sbin/e-smith/expand-template /srv/ipxe/default_preseed.txt
%postun %postun
#if [ "$1" = 1 ]; then #if [ "$1" = 1 ]; then
@ -44,21 +42,9 @@ echo "%doc COPYING" >> %{name}-%{version}-%{release}
#fi #fi
if [ "$1" = 0 ]; then if [ "$1" = 0 ]; then
#uninstallation #uninstallation
/sbin/e-smith/db configuration delete adminusers
/sbin/e-smith/expand-template /etc/ansible/reconfigure_clients.yml /sbin/e-smith/expand-template /etc/ansible/reconfigure_clients.yml
/sbin/e-smith/expand-template /srv/ipxe/default_preseed.txt
fi fi
%changelog %changelog
* Mon Mar 30 2020 Paolo Asperti <paolo@asperti.com> - 1.0.3-1.ns7
- Fix password setting
* Mon Mar 30 2020 Paolo Asperti <paolo@asperti.com> - 1.0.2-1.ns7
- Added full name
- Support for libreschool-pxeserver
* Sun Mar 8 2020 Paolo Asperti <paolo@asperti.com> - 1.0.1-1.ns7
- First round of fixes
* Sun Mar 8 2020 Paolo Asperti <paolo@asperti.com> - 1.0.0-1.ns7 * Sun Mar 8 2020 Paolo Asperti <paolo@asperti.com> - 1.0.0-1.ns7
- First release - First release

View File

@ -2,21 +2,20 @@
- name: Create Admin user - name: Create Admin user
user: user:
name: "{{ esmith.adminusers.username }}" name: "{{ esmith.ansibleusers.username }}"
groups: adm,cdrom,sudo,dip,plugdev,lpadmin,sambashare groups: adm,cdrom,sudo,dip,plugdev,lpadmin,sambashare
comment: "{{ esmith.adminusers.fullname }}"
append: yes append: yes
state: present state: present
- name: Set Admin password - name: Set Admin password
user: user:
name: "{{ esmith.adminusers.username }}" name: "{{ esmith.ansibleusers.username }}"
password: "{{ esmith.adminusers.password }}" password: "{{ esmith.ansibleusers.password }}"
when: (esmith.adminusers.password is defined) and (esmith.adminusers.password|length > 0) when: esmith.ansibleusers.password != ""
- name: Set authorized_key - name: Set authorized_key
authorized_key: authorized_key:
user: "{{ esmith.adminusers.username }}" user: "{{ esmith.ansibleusers.username }}"
state: present state: present
key: "{{ esmith.adminusers.sshkey }}" key: "{{ esmith.ansibleusers.sshkey }}"
when: (esmith.adminusers.sshkey is defined) and (esmith.adminusers.sshkey|length > 0) when: esmith.ansibleusers.sshkey != ""

View File

@ -1 +0,0 @@
LibreSchool Administrator

View File

@ -1,22 +0,0 @@
#
# 20DefaultUserOverride
#
# This overrides the default admin user of a fresh installation
{
$userfullname = ${'adminusers'}{fullname} || 'LibreSchool Administrator';
$username = ${'adminusers'}{username} || 'libreschool';
$password = ${'adminusers'}{password} || '';
if ( $password ne '' ) {
$OUT .= <<EOF
d-i passwd/user-fullname string $userfullname
d-i passwd/username string $username
d-i passwd/user-password-crypted password $password
d-i user-setup/allow-password-weak boolean true
EOF
} else {
$OUT .= "";
}
}