Posts tagged sysadmin

Moving from Sublime Text 2 to Sublime Text 3

Screen Shot 2013-11-15 at 16.46.02As Sublime Text 3 is around in public beta for quite some time, i thought i upgrade from my 2.x version to the new and – as it’s written on their homepage – faster version 3.

Ross Lawley has a perfect guide how to upgrade painlessly:
http://rosslawley.co.uk/posts/switching-to-sublimetext-3/

And thanks for the hint to check the compatibility of the plugins first on this great page:
http://www.caniswitchtosublimetext3.com/

 

Steps how i upgraded:

  • download Sublime Text 3
  • install package manager in Sublime Text 3 by showing the console (view -> show console) and entering this text:
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
  • using the package manager install all your (green) plugins you used on Sublime Text 2
  • copy and paste user settings (Preferences -> Settings -> User)
  • go to terminal and copy TM Themes, other settings and relink the commandline “subl” to the new version (i have ~/bin in my path):
$ cp ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/*.tmTheme* ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/
$ rm ~/bin/subl
$ ln -s /Applications/Sublime\ Text\ 3.app/Contents/SharedSupport/bin/subl ~/bin/subl

Enjoy!

Use multiple email addresses (SSH keys) with GitHub

There is a good tutorial on Gist that shows all the required tasks:

https://gist.github.com/2351996

This post is to remind me how to do it 😉

Shairtunes (airplay audio client) on Mac OS X 10.7


Based on Thias blog instructions on building shairtunes for Mac OS X.

  • install XCode using AppStore on Mac OS X 10.7 (a AppleID is needed for that)
  • open XCode, in the Preferences “Downloads” click on button to download and install the Command Line Tools
  • Download and install Mac Ports (http://macports.org/)
  • Open Terminal and type:
$ sudo port install git-core libao p5-io-socket-inet6 p5-libwww-perl p5-crypt-openssl-rsa
$ sudo port install pkgconfig

install shairtunes as a damon:

$ sudo mkdir -p /usr/local/bin/
$ sudo cp hairtunes shairport.pl /usr/local/bin/
$ sudo vi /usr/local/bin/shairport.pl # change the path of cli_hairtunes  /usr/local/bin/hairtunes
$ sudo cp org.mafipulation.shairport.plist Library/LaunchAgents/
$ launchctl load org.mafipulation.shairport.plist
$ launchctl unload org.mafipulation.shairport.plist # (to remove)

Attention:

works only while a user is logged in! (on the login screen there is no shairtunes possible) consider using autologin for this mac (but be aware of the possible security risks!)

OpenWRT on TP-Link MR3020 as infopoint with local webserver

Howto install OpenWRT on an TP-Link MR3020 mini router with external filesystem on a USB stick running a local webserver (lighttpd) to serve up webpages to act as an info point e.g. in a exhibition.

Inspired by the Piratebox Project: http://wiki.daviddarts.com/PirateBox_DIY_OpenWrt
Read More »

Nagios 3.0.x auf Ubuntu Server 10.04 LTSNagios 3.0.x on Ubuntu Server 10.04 LTS

Zuerst Nagios 3 Packages auf Ubuntu installieren:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install nagios3 nagios3-doc

Die Konfigurationsdateien befinden sich in /etc/nagios3 und /etc/nagios3/conf.d. Die Contacts und Hosts sind auf die eigenen BedĂŒrfnisse anzupassen.

Was mich sehr viel Zeit gekostet hat war das Aktivieren der “external commands”. Diese werden gebraucht wenn man ĂŒber das Webinterface Alarme auslösen will oder sonstige Aspekte von Nagios konfigurieren will.

/etc/nagios3/nagios.cfg editieren:

# EXTERNAL COMMAND OPTION
# Values: 0 = disable commands, 1 = enable commands

check_external_commands=1

# EXTERNAL COMMAND CHECK INTERVAL
# NOTE: Setting this value to -1 causes Nagios to check the external
# command file as often as possible.

command_check_interval=15s
#command_check_interval=-1

Um den Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’ loszuwerden, musste ich folgendes tun:

$ sudo /etc/init.d/nagios3 stop
$ sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
$ sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
$ sudo /etc/init.d/nagios3 start

Um Benachrichtigungen mittels SMTP Server mit Authentifikation zu versenden:

http://exchange.nagios.org/directory/Addons/Notifications/Notifications-using-ISP-SMTP-server-with-Authentication/details

$ sudo apt-get install sendemail

/etc/nagios3/resource.cfg:

$USER5$=your_isp_email_username
$USER6$=your_isp_email_password
$USER7$=your_isp_outgoing_mail_server

/etc/nagios3/commands.cfg

Ändere “notify-host-by-email” command line zu:

command_line /usr/bin/sendemail -o tls=yes -s $USER7$ -xu $USER5$ -xp $USER6$ -t $CONTACTEMAIL$ -f $CONTACTEMAIL$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"

Ändere die “notify-service-by-email” command line zu:

command_line /usr/bin/sendemail -o tls=yes -s $USER7$ -xu $USER5$ -xp $USER6$ -t $CONTACTEMAIL$ -f $CONTACTEMAIL$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$"

Nun noch folgendes:

$ sudo touch /var/log/sendEmail
$ sudo chown nagios:nagios /var/log/sendEmail
$ sudo /etc/init.d/nagios3 restart

install nagios3 packages:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install nagios3 nagios3-doc

config files are located in /etc/nagios3 and /etc/nagios3/conf.d configure your contacts and hosts accordingly.

what got me crazy was enabling external commands (needed to perform actions in the webinterface like sending alerts or enabling/disabling things).

edit /etc/nagios3/nagios.cfg:

# EXTERNAL COMMAND OPTION
# Values: 0 = disable commands, 1 = enable commands

check_external_commands=1

# EXTERNAL COMMAND CHECK INTERVAL
# NOTE: Setting this value to -1 causes Nagios to check the external
# command file as often as possible.

command_check_interval=15s
#command_check_interval=-1

to get rid of Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’, i had to do this:

$ sudo /etc/init.d/nagios3 stop
$ sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
$ sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
$ sudo /etc/init.d/nagios3 start

to send notification mails using the corporate smtp host i had to do this:

http://exchange.nagios.org/directory/Addons/Notifications/Notifications-using-ISP-SMTP-server-with-Authentication/details

$ sudo apt-get install sendemail

Edit /etc/nagios3/resource.cfg:

$USER5$=your_isp_email_username
$USER6$=your_isp_email_password
$USER7$=your_isp_outgoing_mail_server

Edit /etc/nagios3/commands.cfg

Change command_line for command_name notify-host-by-email:

command_line /usr/bin/sendemail -o tls=yes -s $USER7$ -xu $USER5$ -xp $USER6$ -t $CONTACTEMAIL$ -f $CONTACTEMAIL$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"

and the notify-service-by-email command line to

command_line /usr/bin/sendemail -o tls=yes -s $USER7$ -xu $USER5$ -xp $USER6$ -t $CONTACTEMAIL$ -f $CONTACTEMAIL$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$"
$ sudo touch /var/log/sendEmail
$ sudo chown nagios:nagios /var/log/sendEmail
$ sudo /etc/init.d/nagios3 restart

Using WordPress with SSL

Enable SSL for logins and admin pages in wordpress:

http://codex.wordpress.org/Administration_Over_SSL

enable SSL on your Apache server:

http://osinside.blogspot.com/2007/08/how-to-centos-apache-server-with-ssl.html
http://www.debian-administration.org/articles/349

install WordPress HTTPS http://mvied.com/projects/wordpress-https/

  • check Internal HTTPS Elements
  • check Disable Automatic HTTPS

further steps (not tested by me): Enable complete support for SSL on WordPress

Snow Leopard Firewall fragt dauernd nach Erlaubnis fĂŒr iTunes.appSnow Leopard Firewall keeps asking to allow iTunes.app

Nachdem ich meinen Mac neu aufgesetzt habe, bekam ich jedes mal wenn ich iTunes starte einen Dialog meiner OS X Firewall ob ich “Eingehende Verbindungen fĂŒr Applikation iTunes.app erlauben / ablehnen” will, obwohl ich das schon x-mal erlaubt habe. Nach sehr langer Suche im Netz stiess ich auf diese Webseite auf macyourself.com wo es eine (nicht sehr gute) Lösung, allerdings hat Shane Cook in den Kommentare die beste Lösung fĂŒr das Problem:

I have an even better solution for you. No uninstalling or re-downloading.

In security (located in system preferences) Click the firewall tab followed by the advanced button down the bottom. Check all the applications you want are set to allow incoming connections. Close security preferences. Then open a finder window Navigate to -> Macintosh HD -> Library -> Preferences -> there will be a file called, com.apple.alf.plist delete it, reboot and your done. Deleting this small file re-builds the Firewall preferences and you will no longer be asked to accept incoming network connection every time you open an app. As long as the app your opening is on the list in the firewall tab your good to go 😀 Email me atshane.shanus@gmail.com if this worked for you 😀

FĂŒr alle die dem Englischen nicht so mĂ€chtig sind, hier eine Zusammenfassung:

Im Finder in das Verzeichnis Library -> Preferences auf der Systemplatte gehen, dort gibt es eine Datei com.apple.alf.plist, diese Datei löschen, Rechner neu starten und dann in den Systemeinstellungen -> Sicherheit -> Firewall die Firewall wieder aktivieren und nun sollte wieder alles so funktionieren wie vorher.

Update:

Leider hat die Lösung von Shane bei mir doch nicht funktioniert, wie sich herausstellte, war die Firewall deaktiviert und ich habe wohl deshalb keine Meldungen mehr bekommen! Wie ich nun herausgefunden habe, musste ich tatsĂ€chlich iTunes.app löschen, eine aktuelle Version von iTunes 10 von Apple’s Servern herunterladen und installieren. Nun funktioniert es so wie es soll und ich hab noch einmal nachgeprĂŒft, dass die Firewall auch wirklich lĂ€uft.

I reinstalled my Mac and after that i got the “allow / deny incoming connections for application iTunes.app” every time I started iTunes 10. This is annoying because i allowed that a hundred times already. After a lot of googling i finally found this webpage on macyourself.com with some sort of solution, but more interestingly Shane Cook had the fix I needed posted in one of the comments to that article:

I have an even better solution for you. No uninstalling or re-downloading.

In security (located in system preferences) Click the firewall tab followed by the advanced button down the bottom. Check all the applications you want are set to allow incoming connections. Close security preferences. Then open a finder window Navigate to -> Macintosh HD -> Library -> Preferences -> there will be a file called, com.apple.alf.plist delete it, reboot and your done. Deleting this small file re-builds the Firewall preferences and you will no longer be asked to accept incoming network connection every time you open an app. As long as the app your opening is on the list in the firewall tab your good to go 😀 Email me atshane.shanus@gmail.com if this worked for you 😀

That worked like a charm, deleted the file in question, restarted, re-enabled the firewall in the System Preferences -> Security -> Firewall and everything went back to normal behavior.

Update:

The fix from Shane did not fix the problem it disabled the firewall and therefore I thought the problem was fixed!

The only working solution is to trash iTunes.app, download it from Apple’s iTunes webpage and reinstall iTunes 10. After that I checked the firewall preference pane for the firewall being enabled and now I’m sure everything is working as intended.

SNMPD auf Ubuntu funktionsfÀhig bekommenGetting SNMPD to work on Ubuntu

Snmpd auf Ubuntu zu installieren scheint einfach zu sein, ist es auch, aber hat bei mir nie wirklich 100% funktioniert. Der snmpd funktionierte immer nur lokal, aber nicht fĂŒr entfernte Zugriffe meines cacti Servers. Das Problem ist jenes, dass Ubuntu standartmĂ€ssig den snmpd auf dem Loopback Interface startet, was Zugriffe von aussen verhindert.

Meine /etc/default/snmpd sieht nun so aus:

# This file controls the activity of snmpd and snmptrapd

# MIB directories.  /usr/share/snmp/mibs is the default, but
# including it here avoids some strange problems.
export MIBDIRS=/usr/share/snmp/mibs

# snmpd control (yes means start daemon).
SNMPDRUN=yes

# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'

# snmptrapd control (yes means start daemon).  As of net-snmp version
# 5.0, master agentx support must be enabled in snmpd before snmptrapd
# can be run.  See snmpd.conf(5) for how to do this.
TRAPDRUN=no

# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'

# create symlink on Debian legacy location to official RFC path
SNMPDCOMPAT=yes

Das war’s. Nun nur noch mit $ sudo /etc/init.d/snmpd restart den snmp Server neu starten und alles funktioniert so wie’s soll.

Setting up snmpd on ubuntu seems easy, but i never got it full working. It was working locally, but not for a cacti setup from another server. The problem was that the default install of snmpd on Ubuntu starts the demon on the loopback interface only, refusing connections from other computers.

Edit /etc/default/snmpd to fix that:

# This file controls the activity of snmpd and snmptrapd

# MIB directories.  /usr/share/snmp/mibs is the default, but
# including it here avoids some strange problems.
export MIBDIRS=/usr/share/snmp/mibs

# snmpd control (yes means start daemon).
SNMPDRUN=yes

# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'

# snmptrapd control (yes means start daemon).  As of net-snmp version
# 5.0, master agentx support must be enabled in snmpd before snmptrapd
# can be run.  See snmpd.conf(5) for how to do this.
TRAPDRUN=no

# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'

# create symlink on Debian legacy location to official RFC path
SNMPDCOMPAT=yes

that’s it. To restart the snmp server enter $ sudo /etc/init.d/snmpd restart

Mac OS X 10.6, PHP und MySQLMac OS X 10.6, PHP and MySQL

Kev Chapman hat eine gute Dokumentation darĂŒber, wie man Apache auf Mac OS X 10.6 verwendet auf seinem Blog. Setting up Apache on Snow Leopard hat sehr viele nĂŒtzliche Tips und deshalb kopiere ich nur die (fĂŒr mich) wichtigsten Teile hier her (als Erinnerungshilfe fĂŒr mich), den Rest bitte bei Kev direkt lesen.

Problem: PHP kann nicht mit dem lokalen mySQL Server sprechen

Lösung: /etc/php.ini.default im Texteditor öffnen und die Zeile mit mysql.default_socket suchen (irgendwo bei Zeile #1213) und in folgendes Àndern:

mysql.default_socket = /tmp/mysql.sock

Die Datei speichern und Apache neu starten.

Damit .htaccess im “Sites” Ordner im OS X User Ordner funktioniert, /etc/apache2/users/<username>.conf editieren:

<Directory "/Users/USERNAME/Sites/">
  Options Indexes MultiViews FollowSymLinksAllow
  Override All
  Order allow,deny
  Allow from all
</Directory>

Kev Chapman has a good documentation about how Setting up Apache on Snow Leopard. It’s worth a read and has all you may need to sucessfully setup apache on Mac OS X 10.6.x – therefore i copy only the most important parts here (as a reminder for me):

Problem: PHP can’t talk to the locally running mySQL server

Fix: edit /etc/php.ini.default and find the line containing mysql.default_socket (around line #1213) and change it to:

mysql.default_socket = /tmp/mysql.sock

Save this file and restart the server.

Getting .htaccess to work in your home directory’s Sites folder edit /etc/apache2/users/<username>.conf:

<Directory "/Users/USERNAME/Sites/">
  Options Indexes MultiViews FollowSymLinksAllow
  Override All
  Order allow,deny
  Allow from all
</Directory>

MP4 Videos vom eigenen Webserver iPhone tauglich machenEnable your webserver to feed iPhone with MP4 videos

Ich verwende iPhone OS 3.x und hatte Probleme .mp4 Dateien direkt im Safari auf dem iPhone angezeigt zu bekommen. Ich habe verschiedenste Einstellungen beim Encodieren ausprobiert, aber immer wenn ich im iPhone Safari auf einen .mp4 Link auf meinem Webserver geklickt habe, kam die Fehlermeldung “Diese Datei kann nicht heruntergeladen / angezeigt werden”. Nach intensiver Suche im Internet fand ich dann Hinweise, dass es evtl. mit MIME types und der Apache Konfiguration zu tun haben könnte.

Lösung:

  1. Video fĂŒr iPhone / iPod Touch encodieren (Compressor, Quicktime, Adobe Media Encoder, …)
  2. Video auf dem GerĂ€t testen! (zur iTunes Library hinzufĂŒgen, aufs iPhone spielen und anschauen)
  3. Video auf den Webserver hochladen
  4. sicherstellen, dass folgende Zeile in der Apache Konfiguration bzw. in einer .htaccess Datei drin steht:
AddType video/mp4 mp4 mp4v mpg4 m4v

Das war’s, nun sollten .mp4 Videos vom Webserver als progressive Downloads (wieder) auf dem iPhone angezeigt werden können.

I’m using iPhone OS 3.x on my iPhone and recently i had problems to get my .mp4 files displayed in mobile Safari. I tried different settings for encoding the files but not a single one worked. When i clicked the link to the .mp4 file in mobile Safari, all i got was the “file can’t get downloaded” error. After some googling i found a clue that it might has something to do with MIME types and the apache server hosting the videos.

Solution:

  1. encode your videos for iPhone / iPod Touch (Compressor, Quicktime, Adobe Media Encoder, …)
  2. test them on the device (add the video to your iTunes library and upload it to your iPhone and watch it!)
  3. upload the video to your webserver
  4. make sure you have the following line in your apache config or in a .htaccess file in your directory on your webserver:
AddType video/mp4 mp4 mp4v mpg4 m4v

That’s it, now progressively watching .mp4 videos from your webserver on your iPhone should work (again).

Sprache Àndern

Categories

Archives