Skip to content

Instantly share code, notes, and snippets.

@alex-eri
Last active February 5, 2021 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-eri/0312eeb5fcbc74484db03bcb3d09cf70 to your computer and use it in GitHub Desktop.
Save alex-eri/0312eeb5fcbc74484db03bcb3d09cf70 to your computer and use it in GitHub Desktop.

/opt/kiosk/bin/kiosk.sh

#!/bin/bash
. /etc/profile
export LANG=ru_RU.UTF-8
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
systemctl --user import-environment DISPLAY XAUTHORITY
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
    dbus-update-activation-environment DISPLAY XAUTHORITY
fi
grep nokiosk=1 /proc/cmdline && exit 1
xinit /opt/kiosk/bin/rdp.sh -- :1 -nolisten tcp -noreset -verbose 2 "vt1"

rdesktop найтли сейчас хорош. /opt/kiosk/bin/rdp.sh

#!/bin/bash
rdesktop rdp.host.org -f
# или xfreerdp /v:rdp.host.org /f

/etc/X11/xorg.conf.d/10-monitor.conf

Section "ServerFlags"
    Option "StandbyTime" "0"
    Option "SuspendTime" "0"
    Option "OffTime" "0"
    Option "BlankTime" "0"
EndSection

/etc/rsyslog.conf

module(load="imuxsock") # provides support for local system logging
module(load="imklog")   # provides kernel logging support
\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
\$FileOwner root
\$FileGroup adm
\$FileCreateMode 0640
\$DirCreateMode 0755
\$Umask 0022
\$WorkDirectory /var/spool/rsyslog
\$IncludeConfig /etc/rsyslog.d/*.conf
*.*     /dev/tty4

/etc/systemd/user/kiosk.service

[Unit]
Description=Kiosk
#Requires=ts_uinput.service
BindsTo=dev-input-ts_uinput.device
#After=ts_uinput.service
RequiresMountsFor=/etc/pointercal

[Service]
Type=simple
Environment=DISPLAY=:1
ExecStart=/opt/kiosk/bin/kiosk.sh
WorkingDirectory=/opt/kiosk/
Restart=always
RestartSec=1


[Install]
WantedBy=default.target

/etc/systemd/user/x11vnc.service

[Unit]
Description=vnc
BindsTo=kiosk.service


[Service]
Type=simple
Environment=DISPLAY=:1
ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/x11vnc -display WAIT:1 -forever
Restart=always
RestartSec=1
SuccessExitStatus=0 1 2

[Install]
WantedBy=default.target

в чруте образа выполнить

useradd --shell /bin/bash --create-home --user-group --groups video,audio,uucp,dialout,lp,netdev,tty,input,systemd-journal,adm,users,tty --uid 1001 kiosk

apt install rdesktop
# apt install freerdp-x11

touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
systemctl disable autovt@.service
systemctl mask  autovt@.service 
systemctl disable getty@.service
systemctl disable getty-static@.service
systemctl mask getty-static@.service
systemctl enable getty@tty3.service
systemctl disable getty@tty1.service
systemctl mask getty@tty1.service
systemctl mask gdm3.service
systemctl disable getty@tty2.service
systemctl disable getty@tty4.service
systemctl unmask logrotate.timer apt-daily-upgrade.timer apt-daily.timer e2scrub_all.timer e2scrub_reap.service
systemctl disable logrotate.timer apt-daily-upgrade.timer apt-daily.timer e2scrub_all.timer e2scrub_reap.service
systemctl mask logrotate.timer apt-daily-upgrade.timer apt-daily.timer e2scrub_all.timer e2scrub_reap.service
systemctl set-default graphical.target
loginctl enable-linger kiosk
ln -sf /etc/machine-id /var/lib/dbus/

echo "allowed_users=anybody" > /etc/X11/Xwrapper.config
echo "needs_root_rights=yes" >> /etc/X11/Xwrapper.config


mkdir -p /home/kiosk/.vnc/
x11vnc -storepasswd supersecretpassword /home/kiosk/.vnc/passwd
chown kiosk:kiosk -R /home/kiosk/.vnc/
chmod 700 /home/kiosk/.vnc/passwd


mkdir -p /home/kiosk/.config/systemd/user/default.target.wants/

ln -fs /etc/systemd/user/kiosk.service /home/kiosk/.config/systemd/user/default.target.wants/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment