Linux

Cannot connect using PPTP (Fedora 24)

Make sure that the firewall allows GRE packets:
	firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p gre -j ACCEPT
	firewall-cmd --permanent --direct --add-rule ipv6 filter INPUT 0 -p gre -j ACCEPT
	firewall-cmd --reload

Media Codecs on Fedora 24

H264 Codec

	sudo dnf config-manager --set-enabled fedora-cisco-openh264
	sudo sudo dnf install gstreamer1-plugin-openh264 mozilla-openh264

Enable in Firefox, go to menu → Add-ons → Plugins and enable OpenH264 plugin.

Then type about:config, type in 264 in the search bar and set the following preferences:

	media.gmp-gmpopenh264.autoupdate
	media.gmp-gmpopenh264.enabled
	media.gmp-gmpopenh264.provider.enabled
	media.peerconnection.video.h264_enabled

Restart firefox.

Other Codecs

	sudo dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
	sudo dnf install http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
	sudo nf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
	sudo dnf install gstreamer{1,}-{ffmpeg,libav,plugins-{good,ugly,bad{,-free,-nonfree}}} --setopt=strict=0
	sudo dnf install gstreamer{1,}-{plugin-crystalhd,ffmpeg,plugins-{good,ugly,bad{,-free,-nonfree,-freeworld,-extras}{,-extras}}} libmpg123 lame-libs --setopt=strict=0
	sudo dnf install vlc

Avoid lockdown error when connecting an iPhone 5S

	sudo chmod 777 /var/lib/lockdown

Convert audio cd to mp3

  1. Copy all *.wav files to a folder on the computer.
  2. shnjoin -r none "Track 1.wav" "Track 2.wav" ... "Track N.wav"
  3. avconv -i joined.wav output_filename.mp3

Convert mov to mp4

	ffmpeg -i movie.mov -f mp4 -vcodec copy -acodec copy output.mp4

Convert mkv to avi

	ffmpeg -i "input.mkv" -f avi -c:v mpeg4 -b:v 4000k -c:a libmp3lame -b:a 320k "converted.avi"

Join 3gps

	MP4Box -cat fil1.3gp -cat fil2.3gp .. output.mp4

Remove sound from mpg files

	ffmpeg -i input.mpg -an -vcodec copy output.mpg

Ubuntu: disable root account

	sudo passwd -dl root

Ubuntu: enable root account

	sudo -i
	sudo passwd root        # set password

Ubuntu: install font

	wget http://img.dafont.com/dl/?f=old_london -O old_london.zip
	unzip old_london.zip
	mv OldLondon.ttf OldLondonAlternate.ttf /usr/share/fonts/
	fc-cache -f
	fc-list | grep -i OldLondon

wpa_supplicant

  1. sudo vim /etc/network/interfaces
  2. Add this to the bottom:
    	auto wlan0
    	iface wlan0 inet static
    	pre-up wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
    	post-down killall -q wpa_supplicant
    	address 192.168.1.243
    
  3. Setup wpa_supplicant.conf:
    	wpa_passphrase Rock | tee /etc/wpa_supplicant.conf # Enter passphrase for SSID
    

Realtek RTS5229 PCI

Device info (lspci): 01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5229 PCI Express Card Reader (rev 01)

If it doesn't work in Ubuntu try:

	sudo apt-get install libnss-myhostname

Postfix is not able to resolve domain name

If you get the following error in the mail.log file:

	Host or domain name not found. Name service error for name ...

... it may be the DNS resolv.conf file for postfix which is missing or damaged.

Make sure that /var/spool/postfix/etc/resolv.conf is the same as /etc/resolv.conf.

Hiawatha

SSL .pem layout

-----BEGIN RSA PRIVATE KEY-----
[webserver private key]
-----END RSA PRIVATE KEY-----

-----BEGIN CERTIFICATE-----
[webserver certificate]
-----END CERTIFICATE-----

-----BEGIN CERTIFICATE-----
[optional intermediate CA certificates]
-----END CERTIFICATE-----

Apache

htaccess

	RewriteEngine On 
	RewriteCond %{SERVER_PORT} 80 
	RewriteRule ^(.*)$ https://www.schau.dk/$1 [R,L

Authentication

<Directory "/filesystem/path/to/directory/to/protect">
	DirectoryIndex index.html index.php
	AllowOverride AuthConfig
	AuthType basic
	AuthName "Restricted Content"
	AuthUserFile /path/to/password-file
	AuthGroupFile /path/to/group-file
	Require group prv
	Satisfy all
</Directory>

Password-file:

	bs:$apr1$base64encodedstuff

Webgroup-file:

	prv: bs

Install php-5.6.x on CentOS 7

	yum -y update
	yum -y install epel-release
	wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
	wget https://centos7.iuscommunity.org/ius-release.rpm
	rpm -Uvh ius-release*.rpm
	yum -y update
	yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath

ssh_scan

Install:

	sudo apt install ruby gem
	sudo apt install ssh_scan

... run:

	sudo ssh_scan -t hostname_or_ip_address

... and follow recommendations!