diff --git a/.drone.yml b/.drone.yml index 92b6067..3dd2cbf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,23 +1,21 @@ -# this is needed by the RPM build plugin -workspace: - base: /build - path: / +kind: pipeline +name: default -pipeline: - - create_targz: - image: libreschool-automation/rpm-pack:latest - dest: $$NAME-$$VERSION.tar.gz - dir: $$NAME-$$VERSION - files: - - root - - README.md - - COPYING +steps: + - name: create_targz + image: registry.libreschool.org/libreschool-automation/rpm-pack:latest + pull: always + settings: + files: + - root + - README.md + - COPYING when: event: [ push, tag ] - - build: - image: libreschool-automation/rpm-build:latest + + - name: build + image: registry.libreschool.org/libreschool-automation/rpm-build:7 + pull: always commands: - yum-builddep -y libreschool-nfs.spec - rpmbuild -ba libreschool-nfs.spec @@ -25,23 +23,60 @@ pipeline: when: event: [ push, tag ] - pkg_sign: - image: libreschool-automation/rpm-sign - files: out/*.rpm - secrets: [ gpg_key, passphrase ] - when: - event: [ tag, deployment ] - - gitea_release: - group: deploy - image: plugins/gitea-release - files: out/*.rpm - checksum: - - md5 - - sha1 - - sha256 - - sha512 - secrets: [ gitea_token ] - base_url: https://git.libreschool.org + - name: sign + image: registry.libreschool.org/libreschool-automation/rpm-sign:latest + pull: always + settings: + files: out/*.rpm + gpg_key: + from_secret: gpg_key + passphrase: + from_secret: passphrase when: event: tag + + - name: gitea_release + image: plugins/gitea-release + settings: + files: out/*.rpm + checksum: + - md5 + - sha1 + - sha256 + - sha512 + api_key: + from_secret: gitea_token + base_url: https://git.libreschool.org + file_exists: skip + when: + event: tag + + - name: repo_upload + image: appleboy/drone-scp + settings: + source: out/*.noarch.rpm + target: /vhosts/repo.libreschool.org/https/nethserver/7/devel/x86_64/Packages/ + host: repo.libreschool.org + strip_components: 1 + username: + from_secret: ssh_username + key: + from_secret: ssh_key + when: + event: tag + repo: LibreSchool/libreschool-nfs + + - name: repo_upload_srpms + image: appleboy/drone-scp + settings: + source: out/*.src.rpm + target: /vhosts/repo.libreschool.org/https/nethserver/7/devel/Source/SPackages/ + host: repo.libreschool.org + strip_components: 1 + username: + from_secret: ssh_username + key: + from_secret: ssh_key + when: + event: tag + repo: LibreSchool/libreschool-nfs diff --git a/README.md b/README.md index 7df9ab2..4c641b4 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ A working [LibreSchool][] installation is required. At the moment, if you run ```showmount -e [server ip] ``` on the client, you end up with an error. That's because we're ditching NFSv2 and NFSv3 in favour of NFSv4 (this will give us Kerberos integration in future) and all unneeded ports are closed. ## TODO / ideas ## -- add libreschool-ansible|doraemon dependancy when ready - verify on a brand new install if after installation a new 'chkconfig {nfs,rpcbind} on' is needed - force Domain Controller mode (db configuration getprop smb ServerRole == PDC) - export shared folder also @@ -23,6 +22,17 @@ At the moment, if you run ```showmount -e [server ip] ``` on the client, you end - ACL on home directories - multiple nfs-server support + + +## tested distos +- edubuntu 14.04: OK +- ubuntu 14:04: OK +- ubuntu 16:04: OK +- ubuntu 18:04: ldap can't connect... (remember to force python install on adoption) +- zorin 12: OK +- linuxmint: ldap can't connect... + + ## License ## As the rest of the LibreSchool project, libreschool-nfs is licensed under [GPLv3][] license. diff --git a/libreschool-nfs.spec b/libreschool-nfs.spec index ea31e00..7a80eb1 100644 --- a/libreschool-nfs.spec +++ b/libreschool-nfs.spec @@ -1,7 +1,7 @@ Summary: LibreSchool NFS home profiles configuration Name: libreschool-nfs -Version: 6.9 -Release: 1 +Version: 1.0 +Release: 1.ns7 License: GPL BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-root @@ -9,9 +9,14 @@ Source0: %{name}-%{version}.tar.gz Source1: COPYING URL: %{url_prefix}/%{name} Requires: libreschool-release +Requires: libreschool-client-manager Requires: nethserver-directory Requires: nfs-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd BuildRequires: nethserver-devtools +BuildRequires: systemd %description LibreSchool NFS home profiles configuration @@ -43,8 +48,9 @@ chkconfig rpcbind on UDPPort 111 \ access private /sbin/e-smith/expand-template /etc/exports -/sbin/service nfs start >/dev/null 2>&1 || : -/sbin/service rpcbind start >/dev/null 2>&1 || : +/sbin/e-smith/expand-template /etc/ansible/reconfigure_clients.yml +/usr/bin/systemctl --no-block start nfs >/dev/null 2>&1 || : +/usr/bin/systemctl --no-block start rpmbind >/dev/null 2>&1 || : /usr/sbin/exportfs -r /sbin/e-smith/signal-event firewall-adjust /usr/bin/ldapmodify -Y EXTERNAL -f /usr/share/libreschool-nfs/patch.ldif >/dev/null 2>&1 || : @@ -55,10 +61,11 @@ chkconfig rpcbind on #fi if [ "$1" = 0 ]; then #uninstallation - /sbin/e-smith/expand-template /etc/exports + echo > /etc/exports + /sbin/e-smith/expand-template /etc/ansible/reconfigure_clients.yml /usr/sbin/exportfs -r fi %changelog -* Sat Nov 4 2017 Paolo Asperti - 6.9-1 -- First release +* Sun Apr 28 2019 Paolo Asperti - 1.0-1.ns7 +- First release for NethServer 7 diff --git a/root/etc/ansible/roles/nfs-client/tasks/main.yml b/root/etc/ansible/roles/nfs-client/tasks/main.yml index 0326734..54b9702 100644 --- a/root/etc/ansible/roles/nfs-client/tasks/main.yml +++ b/root/etc/ansible/roles/nfs-client/tasks/main.yml @@ -2,11 +2,8 @@ - name: Installing client packages apt: - name: '{{ item }}' + name: [ 'nfs-common', 'libnss-ldap' ] state: latest - with_items: - - nfs-common - - libnss-ldap - name: Create directory for user homes file: path=/var/lib/nethserver/home state=directory owner=root group=root mode=0755 @@ -59,3 +56,33 @@ owner: 'root' group: 'root' mode: 0644 + +- name: Check if lightdm is installed + shell: dpkg-query -W -f='${Status}' lightdm | grep 'install ok installed' + register: lightdm_installed + failed_when: no + changed_when: no + +- name: Check if gdm3 is installed + shell: dpkg-query -W -f='${Status}' gdm3 | grep 'install ok installed' + register: gdm3_installed + failed_when: no + changed_when: no + +- name: Adjusting lightdm settings + template: + src: 'lightdm.conf' + dest: '/usr/share/lightdm/lightdm.conf.d/50-libreschool.conf' + owner: 'root' + group: 'root' + mode: 0644 + when: lightdm_installed.rc == 0 + +- name: Adjust gdm3 settings + ini_file: + path: /etc/gdm3/greeter.dconf-defaults + section: org/gnome/login-screen + option: disable-user-list + value: "true" + no_extra_spaces: yes + when: gdm3_installed.rc == 0 diff --git a/root/etc/ansible/roles/nfs-client/templates/lightdm.conf b/root/etc/ansible/roles/nfs-client/templates/lightdm.conf new file mode 100644 index 0000000..2132505 --- /dev/null +++ b/root/etc/ansible/roles/nfs-client/templates/lightdm.conf @@ -0,0 +1,4 @@ +[Seat:*] +allow-guest=false +greeter-hide-users=true +greeter-show-manual-login=true diff --git a/root/etc/e-smith/templates/etc/ansible/reconfigure_clients.yml/50_nfs-client b/root/etc/e-smith/templates/etc/ansible/reconfigure_clients.yml/50_nfs-client new file mode 100644 index 0000000..6736073 --- /dev/null +++ b/root/etc/e-smith/templates/etc/ansible/reconfigure_clients.yml/50_nfs-client @@ -0,0 +1 @@ + - nfs-client diff --git a/root/etc/e-smith/templates/etc/exports/50libreschool-nfs b/root/etc/e-smith/templates/etc/exports/50libreschool-nfs index bc5662a..0e2b296 100644 --- a/root/etc/e-smith/templates/etc/exports/50libreschool-nfs +++ b/root/etc/e-smith/templates/etc/exports/50libreschool-nfs @@ -1,12 +1,10 @@ # # 50libreschool-nfs # -{ - use esmith::InterfacesDB; - my $ndb = esmith::InterfacesDB->open_ro() || return; +{ + use esmith::NetworksDB; + my $ndb = esmith::NetworksDB->open_ro() || return; my $LocalIP = $ndb->green()->prop('ipaddr') || return; my $LocalNM = $ndb->green()->prop('netmask') || return; - sprintf "/var/lib/nethserver/home\t%s/%s(rw,no_root_squash,sync,no_subtree_check)\n", $LocalIP, $LocalNM; + sprintf "/var/lib/nethserver/home\t%s/%s(rw,no_root_squash,sync,no_subtree_check)\n", $LocalIP, $LocalNM; } - - diff --git a/root/usr/share/libreschool-nfs/patch.ldif b/root/usr/share/libreschool-nfs/patch.ldif index fe6a174..a0938dc 100644 --- a/root/usr/share/libreschool-nfs/patch.ldif +++ b/root/usr/share/libreschool-nfs/patch.ldif @@ -1,7 +1,7 @@ -dn: olcDatabase={2}bdb,cn=config +dn: olcDatabase={2}hdb,cn=config changetype: modify replace: olcAccess -olcAccess: {0}to attrs=sambaNTPassword by dn.exact="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" manage by dn.exact="cn=samba,dc=directory,dc=nh" peername.ip="127.0.0.1" write by self write by * none -olcAccess:: ezF9dG8gYXR0cnM9dXNlclBhc3N3b3JkIA0KIGJ5IGRuLmV4YWN0PSJnaWROdW1iZXI9MCt1aWROdW1iZXI9MCxjbj1wZWVyY3JlZCxjbj1leHRlcm5hbCxjbj1hdXRoIiBtYW5hZ2UNCiBieSBkbi5leGFjdD0iY249cGFtLGRjPWRpcmVjdG9yeSxkYz1uaCIgcGVlcm5hbWUucGF0aD0iL3Zhci9ydW4vbGRhcGkiIHdyaXRlIA0KIGJ5IGRuLmV4YWN0PSJjbj1saWJ1c2VyLGRjPWRpcmVjdG9yeSxkYz1uaCIgcGVlcm5hbWUuaXA9IjEyNy4wLjAuMSIgd3JpdGUNCiBieSBhbm9ueW1vdXMgYXV0aCANCiBieSBzZWxmIHdyaXRlIA0KIGJ5ICogbm9uZQ== -olcAccess:: ezJ9dG8gZG4uYmFzZT0iIg0KIGJ5ICogcmVhZA== -olcAccess:: ezN9dG8gKg0KIGJ5IHNlbGYgd3JpdGUNCiBieSBkbi5leGFjdD0iZ2lkTnVtYmVyPTArdWlkTnVtYmVyPTAsY249cGVlcmNyZWQsY249ZXh0ZXJuYWwsY249YXV0aCIgbWFuYWdlDQogYnkgZG4uZXhhY3Q9ImNuPXNhbWJhLGRjPWRpcmVjdG9yeSxkYz1uaCIgcGVlcm5hbWUuaXA9IjEyNy4wLjAuMSIgd3JpdGUgDQogYnkgZG4uZXhhY3Q9ImNuPXBhbSxkYz1kaXJlY3RvcnksZGM9bmgiIHBlZXJuYW1lLnBhdGg9Ii92YXIvcnVuL2xkYXBpIiB3cml0ZSANCiBieSBkbi5leGFjdD0iY249bGlidXNlcixkYz1kaXJlY3RvcnksZGM9bmgiIHBlZXJuYW1lLmlwPSIxMjcuMC4wLjEiIHdyaXRlIA0KIGJ5IHVzZXJzIHNzZj03MSByZWFkIA0KIGJ5ICogcmVhZA== +olcAccess: {0}to attrs=userPassword,shadowLastChange by self write by anonymous auth by * none +- +add: olcAccess +olcAccess: {1}to dn.subtree="ou=People,dc=directory,dc=nh" attrs=userPassword,shadowLastChange by self write by anonymous auth by * none