2006 November 12

Apache redirect

This directive is equivalent to Redirect, but makes use of standard
regular expressions, instead of simple prefix matching. The
supplied regular expression is matched against the URL-path,
and if it matches, the server will substitute any parenthesized
matches into the given string and use it as a filename. For
example, to redirect all GIF files to like-named JPEG files on
another server, one might use:

    RedirectMatch (.*).gif$ http://www.anotherserver.com$1.jpg
By WladyX on 12 November, 2006 | Apache | A comment?

IP Tables network magic SysRq

Why to use the remote sysrq?

Sometimes a remote server hangs and only responds to icmp echo
request (ping). Every administrator of such machine is very unhappy
because (s)he must go there and press the reset button. It takes a long
time and it’s inconvenient. So here is a solution. Use the Network
Magic SysRq and you will be able to do more than just pressing a reset
button. You can remotely sync disks, remount them read-only, then do a
reboot. And everything comfortably and only in a few seconds. ;-)

Marek Zelem : IP Tables network magic SysRq function 0.4

PS: Nu l-am testat inca.

By WladyX on | General | A comment?

Squid

To translate the timestamps in Squid’s access.log pipe the data through: perl -pe 's/^\d+\.\d+/localtime($&)/e;'
E.g. tail -f /var/log/squid/access.log | perl -pe 's/^\d+\.\d+/localtime($&)/e;'

By WladyX on | Proxy | 1 comment

Passwordless SU

1. Edit /etc/pam.d/su, after
Code:
auth sufficient /lib/security/pam_rootok.so
add
Code:
auth sufficient /lib/security/pam_listfile.so item=ruser \
onerr=fail sense=allow file=/etc/security/su-nopass

2. Create a /etc/security/su-nopass file, and it put one username per line. Only put users that you want to have access to root without a password.
3. Double check the permissions on the file, we don’t want it world writable, and world readable is a matter of personal preference.

By WladyX on | General | A comment?

MC

If you paste something in mceditor, sometimes you get many spaces for every line, to avoid that start mcedit, press F9, select Options->General->Return does autoindent(uncheck it).

By WladyX on | Cool Apps | A comment?

Outlook

Creating a Permanent New Mail Desktop Alert in Outlook 2003:

  1. Tools-> Wizards and Alerts… (press OK if you get an HTTP warning)
  2. Button New Rule…
  3. Select “Start from a blank rule” and verify that “Check messages when they arrive” is selected
  4. Press Next to go to the Conditions screen
  5. Verify that no condition is selected and press Next
  6. A warning will pop-up stating that this rule will apply to all messages. Press “Yes” to indicate that that is correct
  7. Select the action “display a Desktop Alert”
  8. Press Finish to complete the rule
  9. If needed move the “display a Desktop Alert” rule all the way to the top

http://www.sparnaaij.net/howto/mailalert2003.htm

By WladyX on | General | A comment?

Gnome

To remove the Computer, Home and Trash icons from your desktop:

start gconf-editor and modify:

/apps/nautilus/desktop/computer_icon_visible

/apps/nautilus/desktop/home_icon_visible

/apps/nautilus/desktop/trash_icon_visible

If you don’t like the new “spatial” Nautilus and you just want the old “browse” as a default, fire up gconf-editor and modify:

/apps/nautilus/preferences/always_use_browser

By WladyX on | General, Style | A comment?

Postfix

Postfix relay:

main.cf:

relay_domains = example.com, example2.com

smtpd_recipient_restrictions = …, reject_unauth_destination (recomandat)

pentru a defini unde se trimit mailurile de relay:

/etc/postfix/transport:

example.com smtp:mx.example.com

Links:
http://www.postfix.org/faq.html#backup

Postgrey (Greylisting) :

Se copiaza din arhiva de postfix din directorul examples/smtpd-policy scriptul greylist.pl in /usr/local/bin
Se editeaza greylist.pl:

$database_name=”/etc/postfix/greylist.db”;
$greylist_delay=60;

Nota: prima variabilal este fisierul unde se va pastra baza de date, iar a doua delay-ul in secunde dupa care se accepta mailul.
trebuie creat /etc/postfix/greylist.db si modificate permisiile astfel incat postfix sa poata citi si modifica acest fisier.

master.cf:

policy unix – n n – - spawn
user=nobody argv=/usr/bin/perl /usr/local/bin/greylist.pl -v

Nota: -v este pentru a fi verbose in loguri.

/etc/postfix/main.cf:

smtpd_recipient_restrictions =
reject_unlisted_recipient

reject_unauth_destination
check_sender_access hash:/etc/postfix/sender_access
check_policy_service unix:private/policy

policy_time_limit = 3600

Nota: in sender_access se pun domeniile considerate ca nu trimit spam si astfel vor sari de verificarea greylisting.
Trebuie creat acest fisier si dupa fiecare modificare rulat: postmap /etc/postfix/sender_access

Exemplu de fisier:
/etc/postfix/sender_access:
securityfocus.com OK

links:
How to kill 95%+ off your SPAM fast!
http://www.postfix.org/SMTPD_POLICY_README.html

By WladyX on | Files, Mail | A comment?