Ivan Radovanovic's picture

How to create pdfs from man pages

man -t page_name | ps2pdf - page_name.pdf

Sometimes this pdf actually looses some formatting (I don't have any idea why), so it might make more sense to create plain ps file

man -t page_name > page_name.ps

Note: You might want to change page size in /usr/share/groff_font/devps/DESC (by default it is set to letter there)

Ivan Radovanovic's picture

How to make tsclient use freerdp instead of rdesktop in freebsd

First of all why anyone would do that? Because rdesktop doesn't support newer encryption schemes supported by remote desktop while freerdp does.

Ivan Radovanovic's picture

How to prevent annoying crackers from brute force login attacks

Add following to your /etc/pf.conf

# if re0 is your card
# this goes in the top
table <bad_guys> persist
block in quick on $ext_if from <bad_guys> to any

Add following to your /etc/syslog.conf

auth.info;authpriv.info |/root/auth_checker.pl

(assuming that auth_checker.pl is in /root directory)

Ivan Radovanovic's picture

How to gracefully restart lighttpd

Gracefully here meaning without loosing any request which is in processing (request which are not accepted yet might still be rejected)

Send SIGINT to lighttpd and then start new instance of it - the one received INT will stop listening for new connections but it will finish all connections it already accepted and exit after it
killall -INT lighttpd && lighttpd -f config_file

Ivan Radovanovic's picture

RabbitMQ start with FreeBSD

1. Install erlang from ports
2. grab latest binary tar.gz package from their website download session (file name should be something like rabbitmq-server-generic-unix-X.Y.Z.tar.gz) - unpack it somewhere
3. start server from the directory where you unpack it sbin/rabbitmq-server
4. when you need to stop it run sbin/rabbitmqctl stop

Ivan Radovanovic's picture

.htaccess based authentication with apache

Put this in .htaccess file

AuthUserFile path_goes_here
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic
require valid-user

File with usernames and passwords can be generated with htpasswd path username utility from command line, or use the following line to display hashed pairs in console htpasswd -n username

Ivan Radovanovic's picture

Running ASP.Net with Lighttpd on FreeBSD

As a first step for running asp.net applications using lighttpd webserver on FreeBSD you need to download source for xsp from mono project site. Here follow instructions for patching and compiling this source in order to run (hopefully) better on FreeBSD. These instructions apply to xsp-2.10.2

You need to patch following files
1. src/Mono.WebServer.FastCgi/Record.cs (patch Record.cs < Record.cs.diff)
2. src/Mono.WebServer.FastCgi/UnmanagedSocket.cs
3. src/Mono.WebServer.FastCgi/main.cs

Ivan Radovanovic's picture

Compiling Mono 2.10.9 on FreeBSD 8

Mono sources as downloaded from original website unfortunately can't be compiled out of the box on FreeBSD 8 amd64. In order to make them compile it is necessary to modify several files:

1. mcs/class/System/System.IO/KeventWatcher.cs (patch KeventWatcher.cs < KeventWatcher.cs.diff)
2. mono/metadata/appdomain.c
3. mono/utils/mono-sigcontext.h

After this mono should compile without problems

There is port directory attached (mono2.10.9.tar.bz2)


Subscribe to codenicer.com RSS