pfsense and active ftp

I had the problem, that i had to run an active FTP server behind my pfsense box. Who ever dealed with FTP and firewall knows, that it is very painfull.

So first, i configured a vitrtual IP:

After that the NAT Rule:

Then a 1:1 NAT Rule for the outgoing traffic:

Till now, it was easy. But for the next option i searched hours and hours. First thanks to Commander for the hint. I don’t know why i had to deactivate “debug.pfftpproxy”, but after disabling this, it worked.

Tags: , ,

Volume Widget for the windowmanager Awesome

I’ve written a small volume widget with icons and a volbar for my window manager awesome. First you will need to put this line in oyur require section:

require(“obvious.volume_alsa”)

This is the real widget:

– Initialize widgets
volbar = awful.widget.progressbar()

volwidget = widget({ type = “textbox” })
volbar:set_vertical(true):set_ticks(true)
volbar:set_height(18):set_width(8):set_ticks_size(2)
volbar:set_background_color(beautiful.fg_off_widget)
volbar:set_gradient_colors({ beautiful.fg_widget,
beautiful.fg_center_widget, beautiful.fg_end_widget
})
– Enable caching
vicious.cache(vicious.widgets.volume)
– Register widgets
vicious.register(volbar, vicious.widgets.volume, “$1″, 1, ‘Front’)
vicious.register(volwidget, vicious.widgets.volume, ” $1% “, 1, ‘Front’)

– Register buttons
volbar.widget:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.util.spawn(“amixer -q sset ‘Front’,0 toggle”) end),
awful.button({ }, 2, function () awful.util.spawn(“amixer -q sset ‘Front’,0 toggle”) end),
awful.button({ }, 3, function () awful.util.spawn(terminal..” -e alsamixer”) end),
awful.button({ }, 4, function () awful.util.spawn(“amixer -q sset ‘Front’ 1+”) end),
awful.button({ }, 5, function () awful.util.spawn(“amixer -q sset ‘Front’ 1-”) end),
awful.button({ }, 6, function () awful.util.spawn(“amixer -q sset ‘Front’ 1-”) end),
awful.button({ }, 7, function () awful.util.spawn(“amixer -q sset ‘Front’ 1+”) end)
))

– Register assigned buttons
volwidget:buttons(volbar.widget:buttons())

volicon = widget({ type = “imagebox” })
vicious.register(volicon, vicious.widgets.volume,
function (widget, args)
if args[1] == 0 or args[2] == ‘♩’ then
volicon.image=image(beautiful.widget_vol_mute)
elseif args[1] > 66 then
volicon.image=image(beautiful.widget_vol_hi)
elseif args[1] > 33 and args[1] <= 66 then
volicon.image=image(beautiful.widget_vol_mid)
else
volicon.image=image(beautiful.widget_vol_low)
end
end,
1, 'Front')

To see the icons you have to add some lines to your theme

theme.widget_vol_mute = “/home/user/.config/awesome/shells_theme/icons/audio-volume-muted.png”
theme.widget_vol_hi = “/home/user/.config/awesome/shells_theme/icons/audio-volume-high.png”
theme.widget_vol_mid = “/home/user/.config/awesome/shells_theme/icons/audio-volume-medium.png”
theme.widget_vol_low = “/home/user/.config/awesome/shells_theme/icons/audio-volume-low.png”
theme.widget_vol = “/home/user/.config/awesome/shells_theme/icons/audio-volume-low.png”

Now you can:

* toggle mute with left mouse button
* in-/decrease volume with your scroll wheel
* launch an app (in this case alsamixer) with your right mouse button

Tags: , ,

FSMO Rollen unter Windows Server 2008 R2

Gestern habe ich mich mit einem Admin noch über dem FSMO Rollen in einer Windows Server 2008 R2 Domäne unterhalten. Ich Konnte mich leider weder an alle Rollen ernniern, noch wie man sie sich anzeigen lassen kann. Zuerst die Rollen:

* Schema Master
* Domain Naming Master
* RID Master
* PDC Emulator
* Infrastruktur Master

Aber wie bekommt man raus, welcher Server welchen Master bereit stellt? Klar, als erstes fällt einem natürlich ntdsutil ein. Der Befehl um sich die Rollen anziegen zu lassen, ist dann doch etwas länger:

ntdsutil roles connections “connect to server localhost” q ” select operation target” “list roles for connected server”

Diesen Befehl auf einem DC ausführen und schon werden einem die FSMO Master angezeigt und welcher Server sie bereit hält.

Tags: ,

pfsense und ipsec

Beim Versuch eine rsa ipsec Verbindung einzurichten bekam ich von der Gegenstelle immer die Fehlermeldung:

we require peer to have ID 'C=DE, ST=NRW, L=Telgte, O=Company,  E=myemail@address.com, CN=some.cn.name',  but peer declares '127.212.145.123'

Kleiner Netzwerkerspass am Rande ;-)

Schuld an dieser Meldung ist der PFsense. Er sendet als Identifier in der Phase 1 immer seine eigene IP. Erste Idee war, dann einfach den CN den er haben will zu kopieren und auf dem PFsense einzutragen. In der   Phase 1 des ipsec habe ich dann ‘My identifier’ umgestellt auf  ‘ASN.1 distinguished name’ und dort den oben genannten DN eingetragen (copy & paste).

Die Idee war so weit ganz gut. Das Ergebnis waren dann aber wilde Fehlermeldung. Zuerst kryptische PHP Syntax-Meldungen und anschleissend Meldungen über das komplette Versagen des ipsec Tunnels.

Nach mehreren Stunden Suchens und Rumbastelns habe ich dann endlich den Fehler gefunden. Eigentlich nur ein ganz simpler Syntaxfehler. Der DN muss in bestimmter Reihenfolge eingetragen werden und die Felder müssen auch richtig betitelt sein. Letzendlich war es das E-Mail Feld, welchse ihm nicht passte. Habe nun den ‘My identifier‘ auf ‘ASN.1 distinguished name‘ gestellt und dort folgendes eingetragen:

C=DE,ST=NRW,L=Telgte,O=Company,emailAddress=myemail@address.com,CN=some.cn.name

Tags: , ,

FreeBSD Bastelecke

Momentan spiele ich sehr viel FreeBSD herum. Hier werde ich einfach ein paar Dinge dokumentieren.

/etc/rc.conf

hostname="test"
# Zu verwendende Konsoleschrift (iso8859-15)
font8x14="iso15-8x14"
font8x16="iso15-8x16"
font8x8="iso15-8x8"
# Deutsche Tastaturbelegung
keymap="german.iso"
allscreens_flags="MODE_279"
ifconfig_em0=" inet 172.23.10.50 netmask 255.255.0.0"
defaultrouter="172.23.10.190"
sshd_enable="YES"
ntpd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
vmware_guest_vmblock_enable="YES"
#vmware_guest_vmhgfs_enable="YES"
vmware_guest_vmmemctl_enable="YES"
vmware_guest_vmxnet_enable="YES"
vmware_guestd_enable="YES"
route_net1="-net 192.168.1.0/24 172.23.10.250"
static_routes="net1"

Damit unter vim die Cursor-Tasten und auch den END, DEL, POS1 und Backspace-Tasten funktionieren muss die .vimrc angepasst werden:

.vimrc

:set nocompatible
:set backspace=start

/boot/loader.conf

zfs_load="YES"
vfs.root.mountfrom="zfs:zroot"
kern.hz=100
splash_bmp_load="YES"
bitmap_load="YES"
bitmap_name="/boot/splash.bmp"
loader_logo="beastie"

~/.tcshrc

set prompt = "%{\033[36m%}[%{\033[34m%}`whoami`%{\033[33m%}@%{\033[32m%}%m%{\033[36m%}:%{\033[35m%}%c%{\033[36m%}]%#%{\033[0m%} "
setenv GREP_OPTIONS --color=auto
setenv GREP_COLOR
setenv LS_COLORS 'no=00:fi=00:di=01;37:ln=01;36:pi=40;33:so=40;33:bd=40;33:cd=40;33:ex=01;32:*.sh=01;32:*.pl=01;32:*.bin=01;32:*.class=01;32:*.php=01;32:*.php3=01;32:*.js=01;32:*.tar=01;31:*.tgz=01;31:*.rpm=01;31:*.deb=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.rar=01;31:*.pkg=01;31:*.jpg=35:*.jpeg=35:*.gif=35:*.png=35:*.bmp=35:*.xbm=35:*.xpm=35:*.pm=35:*.xwd=35:*.pic=35:*.mp3=35:*.xcf=35:*.rm=35:*.avi=35:*.flac=35:*.ogg=35:*.mpg=35:*.wav=35:*.mpeg=35:*.ps=34:*.pdf=34:*.rtf=34:*.html=34:*.htm=34:*.xls=34:*.gnumeric=34:*.abw=34:*.tex=34:*.txt=34:*.doc=34:*.c=33:*.h=33:*.java=33:*.cc=33:*.hh=33:'
set color = (ls-F)
alias ls "ls-F"
bindkey -e
bindkey "^W" backward-delete-word
bindkey "^?" backward-delete-char
bindkey "^[[3~" delete-char
bindkey "^[[28~" run-help
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey -k up history-search-backward
bindkey -k down history-search-forward
stty sane
stty echoe
stty erase "^?"

Ok, jetzt wird ‘s heftig. Ich logge mich aus einem urxvt terminal über ssh auf den Server ein. Damit alle Tasten (DEL, HOME, END, PG UP, PG DOWN…) sauber funktionieren muss man folgendes machen:

  1. Auf dem Server muss ncurses isntalliert sein (/usr/ports/devel/ncurses )
  2. Auf dem Client folgendes ausführen:infocmp rxvt-unicode | ssh USER@SERVER “mkdir -p .terminfo && cat >/tmp/ti && tic /tmp/ti”
  3. .tcshrc anpassen. (s.o.)

JAILS

Ports in Jail mounten:

mount_nullfs /usr/ports /usr/jail/JAILNAME/usr/ports

Internet Access fürs Jail (evtl. reboot erforderlich):

/etc/sysctl.conf

security.jail.allow_raw_sockets=1

 

Tags:

Bitlbee + ZNC and weechat

Just some snippets for the Installation of Bitlbee, ZNC and weechat.

The connection chart:

Bitlbee (server) <= ZNC (server) <= Weechat (Client)

I’ve created an extra user (im) for the server programs.

Installation and configuration of Bitlbee

wget http://get.bitlbee.org/src/bitlbee-3.0.4.tar.gz
tar xfv bitlbee-3.0.4.tar.gz
cd bitlbee-3.0.4

aptitude install  libotr2-dev libssl-dev libglib2.0-dev
./configure --otr=1 --msn=1 --jabber=1 --oscar=1 --twitter=1 --yahoo=0 --otr=1 --ssl=openssl --etcdir=/etc/bitlbee

make
make install install-etc install-doc

Changes i’ve made to the config.

/etc/bitlbee/bitlbee.conf:

RunMode = ForkDaemon
User = im
DaemonInterface = 127.0.0.1
DaemonPort = 6667
HostName = SomeHostName

Connect to your Server and do the normal Configuration (may be you have to change the DaemonInterface IP to connect remotely).  Type "help quickstart1" in the channel. It will tell you what to do...

Installation and configuration of ZNC

aptitude install znc
sudo -i -u im
znc -c

Configuration:

...
Nick [Nick defined in the bitlbee configuration]
Server localhost 6667
...
User Module perform

Then connect to your znc and type in the following command (replace Password with your bitlbee password):

/msg *perform PRIVMSG &bitlbee :identify Password
/save

This will identify ZNC against bitlbee. More Information about configuring ZNC and Weechat can be found here.

 

Tags: , , ,

How to identify the harddisks filesystem

I had an harddisk with an unknown filesystem. The mount command without any option didn’t work, so i had to find out the filesystem.

There is one simpel command to do this:

hellmann linux # file -s /dev/sdb1
/dev/sdb1: x86 boot sector, code offset 0x3c, OEM-ID "TSD FAT ", sectors/cluster 64, sectors 976771120 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 119221, serial number 0x4d1d59b, unlabeled

Now i can use the mount command with the -t option to simply mount this partition (don’t know why it doesn’t detect the filesystem automatically):

mount -t vfat /dev/sdb1 /mnt/usb

Tags: ,

Netzwerk testen mit ping

Viele kennen das Problem:

Man will mal eben schnell überprüfen, ob der Server / Client / Netzwerkdevice Netzwerkprobleme hat und ping ihn. So weit so gut, soll der ping dann doch länger laufen weiß man bei Probleme oftmals nie wann genau sie aufgetreten sind.

Ein normaler ping sieht wie folgt aus und lässt keinen Rückschluss zu, wann er ausgeführt wurde.

user@computer:~ $ ping pcspinnt.de
PING pcspinnt.de (81.28.232.70) 56(84) bytes of data.
64 bytes from 81.28.232.70: icmp_req=1 ttl=54 time=55.3 ms
64 bytes from 81.28.232.70: icmp_req=2 ttl=54 time=53.5 ms
64 bytes from 81.28.232.70: icmp_req=3 ttl=54 time=52.4 ms
64 bytes from 81.28.232.70: icmp_req=4 ttl=54 time=55.4 ms
64 bytes from 81.28.232.70: icmp_req=5 ttl=54 time=54.4 ms
64 bytes from 81.28.232.70: icmp_req=6 ttl=54 time=53.3 ms

Um nun auch die Uhrzeit zu bekommen, kann man folgendes machen:

user@computer:~ $ ping pcspinnt.de|while read ping; do echo "$(date +%d.%m.%Y\ %H:%M:%S) => $ping"; done
18.11.2011 13:41:58 => PING pcspinnt.de (81.28.232.70) 56(84) bytes of data.
18.11.2011 13:41:58 => 64 bytes from 81.28.232.70: icmp_req=1 ttl=54 time=52.9 ms
18.11.2011 13:41:59 => 64 bytes from 81.28.232.70: icmp_req=2 ttl=54 time=55.3 ms
18.11.2011 13:42:00 => 64 bytes from 81.28.232.70: icmp_req=3 ttl=54 time=54.2 ms
18.11.2011 13:42:01 => 64 bytes from 81.28.232.70: icmp_req=4 ttl=54 time=53.2 ms

Sollte es dann zu einem Ausfall kommen, weiß man genau, wann er stattgefunden hat. Hier nun noch einmal der eigentliche Befehl:

ping pcspinnt.de|while read ping; do echo "$(date +%d.%m.%Y\ %H:%M:%S) => $ping"; done

Gefunden habe ich das ganze auf hak5.org

Tags: , ,

Einrichten eines Relay unter Exchange 2010

Gerade musste ich auf einem Exchangeserver 2010 ein Relay einrichten, über den ein Server ohne Authentifizierung eine E-Mail verschicken soll.

Dazu richtet man in der Exchange Management Console unter Server Konfiguration => HubTransport einen neuen Receive Connector ein.

Unter dem Reiter Netzwerk, muss zum einen der Mailserver selber (im oberen Teil) und der Server, der die Mail sendet (im unteren Teil), eingetragen werden.  Da ich keine Authentifizierung habe, wurden alle Häckchen im Reiter Authentifizierung entfernt.

Damit “jeder Benutzer” E-Mails verschicken darf, muss im letzten Reiter der Haken bei “Anonyme Gruppen” gesetzt werden.

So weit so gut, bloss ist dies leider nur die halbe Miete. Bis hierher kann der Server E-Mails nur intern relayen. Bei dem Versuch E-Mails an eine externe Adresse zu verschicken bekommt man aber weiterhin die Meldung “Relay access denied.”.

Um in dem Connector die Berechtigung zu setzen, damit man auch E-Mails nach extern schicken kann, muss man in die Exchange Power Shell wechseln. Dort führt man dann folgenden Befehl aus. Mein Connector heisst hierbei schlicht und einfach relay.

Get-ReceiveConnector “relay” | Add-ADPermission -User “NT AUTHORITY\ANONYMOUS LOGON” -ExtendedRights “ms-Exch-SMTP-Accept-Any-Recipient”

Sollte man eine deutsche GUI haben muss der Name des Users angepasst werden:

Get-ReceiveConnector “relay” | Add-ADPermission -User “ANONYMOUS-ANMELDUNG”  -ExtendedRights “ms-Exch-SMTP-Accept-Any-Recipient”

Danach ist auch das Versenden nach extern möglich.

Tags: , , ,

Volle Windeln, lautes Geschrei und kurze Nächte…

… wir haben ihn. Am 9.8.2011 ist unser Sohn Marian (3760g  53 cm) gesund und mit Papas Frisur :-D   auf die Welt gekommen.  Wir freuen uns riesig.