Skip to content

Commit

Permalink
We can use unix tools for password management
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Dahan committed Sep 29, 2024
1 parent ce6becb commit 1248128
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 50 deletions.
23 changes: 5 additions & 18 deletions utilities/build/stage-solar/00-install-solar-protocol/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ echo "::warning file=utilities/setAllPermissions.sh,title=skipping permissions f
endinfo

info "setting up apache web server"
on_chroot <<EOF
on_chroot << EOF
a2enmod headers
a2enmod rewrite
a2enmod userdir
Expand All @@ -43,7 +43,7 @@ sed -i \

echo 'Listen 8080' >> ${ROOTFS_DIR}/etc/apache2/ports.conf

cat >> ${ROOTFS_DIR}/etc/apache2/apache2.conf <<EOF
cat >> ${ROOTFS_DIR}/etc/apache2/apache2.conf << EOF
<Directory /home/pi/solar-protocol/frontend/>
Options Indexes FollowSymLinks
Expand All @@ -55,15 +55,7 @@ EOF
endinfo

info "setting up fail2ban to protect against bots"
cat > ${ROOTFS_DIR}/etc/fail2ban/jail.local <<EOF
[sshd]
enabled = true
filter = sshd
backend = systemd
logpath = /var/log/auth.log
maxretry = 5
bantime = 3600
EOF
cp files/etc/fail2ban/jail.local ${ROOTFS_DIR}/etc/fail2ban/jail.local
endinfo

info "fixing php timezone"
Expand All @@ -87,14 +79,9 @@ rm ${ROOTFS_DIR}/etc/issue
envsubst < files/etc/issue.template > ${ROOTFS_DIR}/etc/issue
endinfo

info "add post-install password change tool"
install -d "${ROOTFS_DIR}/etc/systemd/system"
install -m 644 files/etc/systemd/system/userpass.service "${ROOTFS_DIR}/etc/systemd/system/userpass.service"
install -d "${ROOTFS_DIR}/usr/lib/userpass-pi"
install -m 755 files/usr/lib/userpass-pi/userpass-service "${ROOTFS_DIR}/usr/lib/userpass-pi/userpass-service"

info "expire default password to force change on first login"
on_chroot << EOF
systemctl enable userpass.service
chage --lastday 0 pi
EOF

install files/home/pi/disable-ssh-password-auth "${ROOTFS_DIR}/home/pi/"
Expand Down

This file was deleted.

0 comments on commit 1248128

Please sign in to comment.