Monthly Archive for Aralık, 2009

PostgreSQL’e Hot Standby desteği eklendi

PostgreSQL geliştiricilerinden Simon Riggs geçtiğimiz Cuma günü PostgreSQL’e Hot Standby desteğinin commit edildiğini duyurdu.

Hot Standy özelliği sayesinde Log shipping replikasyon yöntemi ile yapılan standby sunucularında read-only sorgu çalıştırılabiliyor.  Konuyla ilgili detayları aşağıdaki adreslerden alabilirsiniz.

http://database-explorer.blogspot.com/2009/12/hot-standby-todo.html

http://database-explorer.blogspot.com/2009/09/im-currently-working-on-hot-standby.html

qmail multilog localtime patch for daemontools-0.76

For performance issue multilog binary in daemontools logs in TAI format like following:

@400000004a9b768834d8118c status: local 0/500 remote 4/299

You have to pipe output to tai64nlocal binary to see date in human readable format.  This is being annoying while searching in log files.

We created a small patch to enable human readable logging in multilog via localtime function. The new log lines will look like following:

Sat Dec 19 03:02:51 2009  status: local 0/500 remote 0/299

I belive that some people will not like this idea.  We found it useful and wanted to share with open source community.

The patch is located at http://files.endersys.com/patches/daemontools-0.76-localtime.patch


diff -ruN daemontools-0.76.orig/src/multilog.c daemontools-0.76/src/multilog.c
--- daemontools-0.76.orig/src/multilog.c        2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/multilog.c     2009-12-19 02:52:09.000000000 +0200
@@ -514,7 +514,8 @@
 }
 if (!linelen)
 if (flagtimestamp) {
-          timestamp(line);
+          /* timestamp(line); */
+          timestamplocal(line);
 line[25] = ' ';
 linelen = 26;
 }
diff -ruN daemontools-0.76.orig/src/timestamp.c daemontools-0.76/src/timestamp.c
--- daemontools-0.76.orig/src/timestamp.c       2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/timestamp.c    2009-12-19 02:53:02.000000000 +0200
@@ -1,7 +1,13 @@
+#include <sys/types.h>
+#include <time.h>
+#include <sys/time.h>
+#include <unistd.h>
 #include "taia.h"
 #include "timestamp.h"

 static char hex[16] = "0123456789abcdef";
+time_t lt;
+struct tm *t;

 void timestamp(char s[TIMESTAMP])
 {
@@ -18,3 +24,11 @@
 s[i * 2 + 2] = hex[nowpack[i] & 15];
 }
 }
+
+void timestamplocal(char s[TIMESTAMP])
+{
+      lt = time(NULL);
+      t = localtime(&lt);
+      asctime_r(t, s);
+      s[24] = ' ';
+}
diff -ruN daemontools-0.76.orig/src/timestamp.h daemontools-0.76/src/timestamp.h
--- daemontools-0.76.orig/src/timestamp.h       2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/timestamp.h    2009-12-19 02:52:17.000000000 +0200
@@ -4,5 +4,6 @@
 #define TIMESTAMP 25

 extern void timestamp(char *);
+extern void timestamplocal(char *);

 #endif

Endersys to attend ISS World in Dubai

Murat BALABAN, our Director of R&D Division,  will give a talk entitled “Network Level VoIP Interception with Voitap(tm)” at ISS World Middle East, on February 24, 2010 at 9:00-9:30 in Dubai.

The talk will be about voitap(tm), Endersys’ approach to VoIP LI at the network level, discussing the pros and cons of the network and service level interception as well as how voitap(tm) fits in the overall LI infrastructure of an institution to do the VoIP LI.

ISS World MEA is the world’s largest gathering of Middle East and African Law Enforcement, Intelligence and Homeland Security Analysts and Telecom Operators responsible for Lawful Interception, Electronic Investigations and Network Intelligence gathering. ISS World Programs present the methodologies and tools to bridge the chasms from lawful intercept data gathering to information creation to investigator knowledge to actionable intelligence.

issworld

qmail from address and SMTP-AUTH username check patch

qmail SMTP-AUTH control mechanism is very good way to stop spams and give flexibility user to send email from anywere in the world. But current SMTP-AUTH patches do not check whether from address and SMTP-AUTH username is same.

The following patch will simply reject the mail if the SMTP-AUTH username does not match with the from address.
To be enable use this patch SMTP-AUTH username must be in email address format (user@domain.com). This can be
possible only in qmail+vpopmail or qmail-ldap (if the uid is in email address format) installation.

This patch is based on netqmail-1.06 and Erwin Hoffmann’s qmail-authentication-0.68 patch. But I believe that you can simply integrate your qmail source.

PS:  qmail-remote-logging.patch and qmail-smtp-auth-fromcheck.patch are integrated into JMS1 combined patch and Shupp Toaster patch.

URLs:

http://files.endersys.com/patches/qmail-1.03-jms1.7.08_endersys.patch

http://files.endersys.com/patches/qmail-toaster-0.9.1_endersys.patch

INSTALLATION and CONFIGURATION

1.  Stop qmail
2. Apply this patch to your qmail toaster and compile it (don’t install!)
3. Take backup of your qmail-smtpd binary and override new qmail-smtpd binary
4. Create control/checksenderauth to enable this control
5. Start qmail

You can get the patch from here


--- qmail-smtpd.c.orig  2009-12-16 00:09:42.000000000 +0200
+++ qmail-smtpd.c       2009-12-16 00:20:34.000000000 +0200
@@ -1,3 +1,4 @@
+#include <sys/stat.h>
#include "sig.h"
#include "readwrite.h"
#include "stralloc.h"
@@ -346,6 +347,7 @@
out("250 ok\r\n");
}
void smtp_rcpt(arg) char *arg; {
+struct stat st;
if (!seenmail) { err_wantmail(); return; }
if (!addrparse(arg)) { err_syntax(); return; }
if (flagbarf) { err_bmf(); return; }
@@ -356,6 +358,22 @@
}
else
if (!addrallowed()) { err_nogateway(); return; }
+/* This small patch compare mail from value and smtp auth username.
+* if they are not identical,  the mail will not be relayed!
+* This control will be ignored, if the remote IP is defined in tcp.smtp.cdb
+* create/delete control/checksenderauth file to enable/disable this feature
+*  - Developed by Endersys Ltd R&D Team - http://www.endersys.com
+*/
+  if ((stat("control/checksenderauth",&st) == 0) && (remoteinfo)) {
+
+ /* remoteinfo:username issued during the smtp auth state
+ *   mailfrom.s: From value issued at mail from: state */
+        if (str_diff(remoteinfo, mailfrom.s))  {
+               out("535 Mail From address and SMTP-AUTH username does not match (#5.7.1)\r\n");
+                       return;
+       }
+ }
+

TÜBİTAK TEYDEB desteğinde birinci dönem başarıyla tamamlandı

Endersys, geliştirdiği yazılımlardan biri için aldığı TÜBİTAK TEYDEB (1507 KOBI Ar-GE) desteğinde birinci fazı başarıyla tamamladı. Yakın zamanda diğer iki yazılım projemiz içinde başvuruda bulunacağız.

Rapid7 firması, “Deloitte Technology Fast 500″ yazılım kategorisinde 15. sırada

Rapid7 firması son 5 yılda 2459% büyüme göstererek, “Deloitte Technology Fast 500” raporunda genelde 72. sırayı, yazılım kategorisinde 15. sırayı aldı.

Haberin detayını buradan adresinden okuyabilirsiniz.

Endersys, Rapid7 firmasının ürünü olan güvenlik zaafiyet yazılımı Nexpose‘ın Türkiye yetkili satıcısıdır.

Linux’da kullanıcıları OpenLDAP üzerinden yetkilendirme

Daha önceki yazımız genel olarak LDAP ve OpenLDAP yapılandırması üzerineydi. Bu yazıda ise önceki yazıdaki alt yapıya göre Linux kullanıcılarını OpenLDAP üzerinden yetkilendirme anlatılacaktır.
Bu yazıyı okumadan önce mutlaka önceki yazıyı okumalısınız. Bu örnekte OpenLDAP sunucusu, OpenLDAP üzerinden yetkilendirme yapacak Linux istemci makinasına üzerine kurulmuştur. Dolayısıyla LDAP sunucu olarak 127.0.0.1 kullanılmıştır.

Kullanıcı yetkilendirmek için nss_ldap paketinin kurulması gerekir. Redhat’de bu paket nss_ldap ve pam_ldap modüllerini içerir. nss (Name Service Switch) passwd, group ve host gibi bilgilere nasıl erişileceğini tanımlarken, pam (Pluggable Authentication Modules) ise yetkilendirme işlemini yapar. Aşağıdaki komutla nss_ldap paketi kurulu değilse kurulur.

yum install nss_ldap

/etc/ldap.conf dosyasına aşağıdaki satırlar eklenir.

base dc=example,dc=com
rootbinddn cn=root,dc=deneme,dc=com
uri ldap://127.0.0.1/
ssl no
tls_cacertdir /etc/openldap/cacerts
scope one
pam_filter objectclass=posixaccount
pam_login_attribute uid,
pam_member_attribute gid
pam_password md5
nss_base_passwd         ou=People,dc=deneme,dc=com?one
nss_base_shadow         ou=People,dc=deneme,dc=com?one
nss_base_group          ou=Group,dc=deneme,dc=com?one
scope

LDAP arama seviyeleri (scope)

/etc/ldap.secret dosyasına ldap yönetici parolası yazılır. Dosya izni 600 yapılır.

echo secret > /etc/ldap.secret
chmod 600 /etc/ldap.secret

/etc/nsswitch.conf dosyasındaki aşağıdaki satırlara ldap parametresi eklenir.

passwd:     files
shadow:     files
group:      files

ldap değerlerini ekledikten sonra kayıtlar aşağıdaki gibi gözükmelidir.

passwd:     files ldap
shadow:     files ldap
group:      files ldap
cat /etc/pam.d/system-auth
#%PAM-1.0
# This file is auto-generated.

# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        sufficient    pam_ldap.so use_first_pass
auth        required      pam_deny.so

account     required      pam_unix.so broken_shadow
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     sufficient    pam_ldap.so
account     required      pam_ldap.so
#account    [default=bad success=ok user_unknown=ignore] pam_ldap.so
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok
password    sufficient    pam_ldap.so use_first_pass
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_mkhomedir.so skel=/etc/skel umask=0022 silent
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_ldap.so

Mevcut kullanıcı ve parola bilgilerini veritabanına atmak için /usr/share/openldap/migration/ altındaki scriptler kullanılabilir.

cd /usr/share/openldap/migration/
vi migrate_common.ph
# Default DNS domain
$DEFAULT_MAIL_DOMAIN = "deneme.com";

# Default base
$DEFAULT_BASE = "dc=deneme,dc=com";
$EXTENDED_SCHEMA = 1;
mkdir -p /root/ldap/migration
./migrate_base.pl >/root/ldap/migration/base.ldif
more /root/ldap/migration/base.ldif
dn: dc=deneme,dc=com
dc: deneme
objectClass: top
objectClass: domain
objectClass: domainRelatedObject
associatedDomain: deneme.com

dn: ou=Hosts,dc=deneme,dc=com
ou: Hosts
objectClass: top
objectClass: organizationalUnit
objectClass: domainRelatedObject
associatedDomain: deneme.com
./migrate_group.pl /etc/group  >/root/ldap/migration/group.ldif
more /root/ldap/migration/group.ldif
dn: cn=root,ou=Group,dc=deneme,dc=com
objectClass: posixGroup
objectClass: top
cn: root
userPassword: {crypt}x
gidNumber: 0
ETC_SHADOW=/etc/shadow
./migrate_passwd.pl /etc/passwd > /root/ldap/migration/passwd.ldif

Son olarak yukarıda oluşturulan ldiff dosyaları ldapadd komutu ile eklenir.

qmail canonicalised recipient logging and more patch

As Endersys R&D team, we made simple but very useful patch to qmail-remote about the delivery report.

After this patch, qmail-remote will log sender and recipient of the email in addition to remote IP adddress.  So tracking an email result will be easier than before.

Here is the sample log file:

@400000004b1bdd4d1f89d84c delivery 10: success: <From:owner-freebsd-current@freebsd.org_To:user@remotedomain.com>_193.140.X.X_accepted_message.
/Remote_host_said:_250_ok_1260117440_qp_15626/

@400000004b1bdbb8191f1954 delivery 6: failure: <From:a@surgate.net_To:test323232@remoteserver.com>_212.252.x._does_not_like_recipient.
/Remote_host_said:_550_non-existent_recipient/alici_bulunamadi/Giving_up_on_212.252.x.x/

Here is the patch based on netqmail-1.6. You can download the patch from http://files.endersys.com/patches/qmail-remote-logging.patch

PS:  qmail-remote-logging.patch and qmail-smtp-auth-fromcheck.patch are integrated into JMS1 combined patch and Shupp Toaster patch.

URLs:

http://files.endersys.com/patches/qmail-1.03-jms1.7.08_endersys.patch

http://files.endersys.com/patches/qmail-toaster-0.9.1_endersys.patch

# diff -ruN qmail-remote.c.orig qmail-remote.c
--- qmail-remote.c.orig 2009-12-06 17:55:41.000000000 +0200
+++ qmail-remote.c      2009-12-06 18:35:31.000000000 +0200
@@ -246,15 +246,23 @@
     substdio_flush(&smtpto);
     code = smtpcode();
     if (code >= 500) {
-      out("h"); outhost(); out(" does not like recipient.\n");
+      /* added by Endersys R&D Team */
+      out("h<From:"); outsafe(&sender); out(" To:"); outsafe(&reciplist.sa[i]); out("> ");  outhost(); out(" does not like recipient.\n");
       outsmtptext(); zero();
     }
     else if (code >= 400) {
-      out("s"); outhost(); out(" does not like recipient.\n");
+      /* added by Endersys R&D Team */
+      out("s<From:"); outsafe(&sender); out(" To:"); outsafe(&reciplist.sa[i]);  out("> ");  outhost(); out(" does not like recipient.\n");
       outsmtptext(); zero();
     }
     else {
-      out("r"); zero();
+       /*
+       * James Raftery <james@now.ie>
+       * Log _real_ envelope recipient, post canonicalisation.
+       * and modified by Endersys R&D Team
+       */
+
+      out("r<From:"); outsafe(&sender); out(" To:"); outsafe(&reciplist.sa[i]); out("> "); zero();
       flagbother = 1;
     }
   }

Yazılım geliştirme süreçleri – Sanallaştırma

ÇarklarEndersys AR-GE ekibi olarak yazılım test sürecinde sanal makinaları yoğun olarak kullanıyoruz.

Endersys yazılım ürünleri her gece saat 03:00′te kendiişler bir süreç ile SVN‘den çekilip derleniyor. Kuruluma hazır hale gelen ürünler kendileri için ayrılmış sanal makinalara kuruluyor. Bu kurulumlar yazılım ekibi tarafından geliştirilen yeni özelliklerin, giderilen hataların ve uygulanan güvenlik güncellemelerinin test ekibi tarafından günübirlik incelenebilmesi için kullanılıyor. Böylece test ekibi yeni özelliklerin verimliliğinin ve kullanılabilirliğinin arttırılması, geriye dönük uyumluluğun sağlanması gibi konularda yazılım ekibine rapor hazırlayabiliyor.

Bu yazıda anlattıklarım yazılım test sürecimizin yalnızca bir parçasıdır. İleride bu sürecin diğer parçaları olan sürekli entegrasyon ve kendiişler testler hakkında ayrıntılı yazılar yayımlayacağım.

Ürünlerini benzer bir yöntemle test eden geliştiricilerin yorumlarını bekliyorum.

OpenLDAP Kurulum ve Yapılandırması

Endersys Sistem Ekibi olarak bilgi paylaşımına blog platformumuzda devam ediyoruz. Çok yakın zamanda yeni makaleleri bu sayfa görebilirsiniz.
Continue reading ‘OpenLDAP Kurulum ve Yapılandırması’