Skip to content

Instantly share code, notes, and snippets.

View schlomo's full-sized avatar

Schlomo Schapiro schlomo

View GitHub Profile
@schlomo
schlomo / prefs.sh
Created February 7, 2015 19:12
Ubuntu guest session customization. Install as /etc/guest-session/prefs.sh
touch "$HOME"/.skip-guest-warning-dialog
if [[ -r /usr/share/applications/google-chrome.desktop ]] ; then
mkdir -p "$HOME"/.local/share/applications
sed -e '/Exec/s/google[a-z-]\+/& --password-store=basic/' -e '/^Name=/s/=/&Guest /' \
< /usr/share/applications/google-chrome.desktop > "$HOME"/.local/share/applications/google-chrome.desktop
fi
mkdir -p "$HOME"/.config/autostart
for service in blueman.desktop deja-dup-monitor.desktop indicator-bluetooth.desktop indicator-power.desktop light-locker.desktop vino-server.desktop nm-applet.desktop ; do
if [[ -e /etc/xdg/autostart/$service ]] ; then
@schlomo
schlomo / disable-suspend-and-hibernate.pkla
Created February 7, 2015 19:09
PolicyKit Local Authority policy to disable suspend and hibernate for all users. Should be installed into /var/lib/polkit-1/localauthority/90-mandatory.d or /etc/polkit-1/localauthority/90-mandatory.d
[Completely disable suspend and hibernate]
Identity=unix-user:*
Action=org.freedesktop.upower.suspend;org.freedesktop.upower.hibernate;org.freedesktop.login1.suspend*;org.freedesktop.login1.hibernate*
ResultAny=no
ResultInactive=no
ResultActive=no
@schlomo
schlomo / guest-lockdown.pkla
Created February 7, 2015 19:04
PolicyKit Local Authority policy to lockdown Ubuntu guest session from modifying the system. Should be installed into /var/lib/polkit-1/localauthority/90-mandatory.d or /etc/polkit-1/localauthority/90-mandatory.d
[Allow harmless stuff]
Identity=unix-user:guest-*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;com.canonical.indicator.sound.AccountsService.ModifyOwnUser;org.freedesktop.accounts.change-own-user-data
ResultActive=yes
[Allow handling removable media]
Identity=unix-user:guest-*
Action=org.freedesktop.udisks2.filesystem-mount;org.freedesktop.udisks2.eject-media;org.freedesktop.udisks2.ata-standby;org.freedesktop.udisks2.power-off-drive;org.freedesktop.udisks2.modify-device;org.freedesktop.udisks2.cancel-job;org.freedesktop.udisks2.rescan;org.freedesktop.udisks2.encrypted-unlock;org.freedesktop.udisks2.encrypted-change-passphrase
ResultActive=yes
@schlomo
schlomo / secure-umask.sh
Created February 7, 2015 18:55
Set umask to prevent world readable access
umask 007
@schlomo
schlomo / -glmark2 benchmarks.txt
Last active August 29, 2015 14:13
Some glmark2 benchmarks on my new computer
CPU: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
Kernel: 3.16.0-28-generic #38-Ubuntu SMP Fri Dec 12 17:37:40 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
OS: Ubuntu 15.04 vivid (Beta) from December/January 2015
(NVidia GT610 tested on Ubuntu 14.10 utopic on same hardware)
@schlomo
schlomo / login.php
Last active August 29, 2015 14:01
PHP Basic Auth Gateway. Requests basic auth (password is reversed username) and redirects to URL passed as query string
<?php
$username = 1;
$revpwd = 0;
if (isset($_SERVER['PHP_AUTH_USER']) and isset($_SERVER['PHP_AUTH_PW'])) {
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
$revpwd = strrev($password);
}
if ($username == $revpwd) {
if (isset($_SERVER['QUERY_STRING'])) {
@schlomo
schlomo / demo2.ipxe
Last active August 29, 2015 14:01
iPXE protected installation menu demo
#!ipxe
console -x 800 -y 600 --picture http://www.linux-magazin.de/extension/lnm/design/linux_magazin/images/lm_logo_online.png --top 350
:menu
menu Was moechten Sie jetzt machen?
item --key n local Normaler Systemstart
item --gap Fuer den Systemverwalter
item --key i install Installationsmenue aufrufen
item --key d diag PC-Diagnose starten
item --key r reboot Neu starten
@schlomo
schlomo / demo1.ipxe
Last active August 29, 2015 14:01
iPXE system inventarisation demo for Linux Magazin article. See https://docs.google.com/forms/d/1_wIEKGIMbSX1Qd5JqpaM_vLGglsl_rCOCB8SNJqHCtw/viewanalytics for results
#!ipxe
imgload https://docs.google.com/forms/d/1_wIEKGIMbSX1Qd5JqpaM_vLGglsl_rCOCB8SNJqHCtw/formResponse?entry.1027223351=${uuid}&entry.1507713783=${asset}&entry.46865035=${manufacturer}&entry.2129135320=${product}&entry.1181250351=${serial}&entry.2095563838=${mac}&entry.615831042=${chip} && echo Thank you for participating ||
sanboot --no-describe --drive 0x80 || shell
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">
<Menu>
<Name>Applications</Name>
<Menu>
<Name>Network</Name>
<Exclude>
<Or>
<Category>X-IS24</Category>
<Filename>exo-mail-reader.desktop</Filename>