poniedziałek, 8 marca 2010

OpenSolaris b134

Nie było jeszcze oficjalnego maila, jednak repozytorium http://pkg.opensolaris.org/dev zostało zaktualizowane do wersji b134.

PKG powinien pokazać dostępne nowe wersje paczek:

# pkg refresh --full
# pkg image-update -vn

Również dostępne są obrazy iso na genunix.

Zabezpieczenia w Crossbow

Dzięki projektowi Crossbow, tworząc wirtualny interfejs sieciowy (VNIC) w OpenSolaris możemy nałożyć na niego ciekawe restrykcje, które mają znaczenie jeśli delegujemy VNIC do wirtualnej maszyny xVM lub Kontenera/Zony ze stosem TCP/IP typu exclusive.

# dladm create-vnic -l e1000g0 dmz1
# dladm set-linkprop -p maxbw=2 -p priority=low -p protection=mac-nospoof,ip-nospoof,restricted -p allowed-ips=192.168.10.11 dmz1
# dladm show-linkprop -p maxbw,priority,protection,allowed-ips dmz1

W tym przykładzie:
  • maxbw - ograniczamy ruch sieciowy do 2mb/s
  • priority - ustawiamy niski priorytet ruchu sieciowego na interfejsie
  • mac-nospoof - po zmienia adresu MAC pakiety są dropowane na poziomie kernela
  • ip-nospoof - pakiety są dropowane na poziomie jądra, jeśli jest ustawiony inny adres IP niż podany w 'allowed-ips'
  • allowed-ips - lista dozwolonych adresów IP, jakie można przypisać na interfejsie
  • restricted - wszystkie inna protokoły sieciowe za wyjątkiem IPv4, IPv6, ARP są dropowane

Postfix w OpenSolaris, a NIS+

Jeśli ktoś będzie kompilować Postfixa na OpenSolarisie nowszym niż b130, otrzyma następujący błąd:

"dict_nisplus.c", line 123: undefined symbol: nis_result
"dict_nisplus.c", line 123: undefined symbol: reply
"dict_nisplus.c", line 182: warning: implicit function declaration: nis_list
"dict_nisplus.c", line 182: undefined symbol: FOLLOW_LINKS
"dict_nisplus.c", line 182: undefined symbol: FOLLOW_PATH
"dict_nisplus.c", line 188: left operand of "->" must be pointer to struct/union
"dict_nisplus.c", line 188: undefined symbol: NIS_SUCCESS
"dict_nisplus.c", line 189: undefined struct/union member: objects
"dict_nisplus.c", line 189: left operand of "->" must be pointer to struct/union
"dict_nisplus.c", line 189: undefined struct/union member: objects_len
"dict_nisplus.c", line 189: warning: left operand of "." must be struct/union object
"dict_nisplus.c", line 193: warning: implicit function declaration: nis_freeresult
"dict_nisplus.c", line 196: left operand of "->" must be pointer to struct/union
"dict_nisplus.c", line 196: undefined struct/union member: objects_val
"dict_nisplus.c", line 196: warning: left operand of "." must be struct/union object
"dict_nisplus.c", line 196: left operand of "->" must be pointer to struct/union
"dict_nisplus.c", line 203: left operand of "->" must be pointer to struct/union
"dict_nisplus.c", line 203: warning: left operand of "." must be struct/union object
"dict_nisplus.c", line 203: left operand of "->" must be pointer to struct/union
"dict_nisplus.c", line 220: left operand of "->" must be pointer to struct/union
"dict_nisplus.c", line 220: undefined symbol: NIS_NOTFOUND
"dict_nisplus.c", line 221: left operand of "->" must be pointer to struct/union
"dict_nisplus.c", line 221: undefined symbol: NIS_PARTIAL
"dict_nisplus.c", line 224: warning: implicit function declaration: nis_sperrno
"dict_nisplus.c", line 224: left operand of "->" must be pointer to struct/union
cc: acomp failed for dict_nisplus.c
make: *** [dict_nisplus.o] Error 1
make: *** [update] Error 1


Dzieje się tak dlatego, iż Postfix zakłada, że mamy biblioteki podsystemu NIS+, jednak ten system nazewniczy został usunięty w b131: Heads-Up: Removed NIS+ as Naming Service from Solaris Installer

Najlepszym rozwiązaniem problemu jest zdefiniowanie system OpenSolaris w src/util/sys_defs.h jako osobna platforma systemowa.
Prostszą i szybszą metodą jest usunięcie wpisu dotyczącą NIS+ ("#define HAS_NISPLUS") z pliku "src/util/sys_defs.h" w źródłach Postfixa.

Różnice w plikach wersji 2.7.0:

$ diff -u src/util/sys_defs.h_orig src/util/sys_defs.h
--- src/util/sys_defs.h_orig 2010-03-07 21:09:19.889612089 +0100
+++ src/util/sys_defs.h 2010-03-07 21:39:07.102353914 +0100
@@ -401,7 +401,6 @@
#define DEF_DB_TYPE "dbm"
#define ALIAS_DB_MAP "dbm:/etc/mail/aliases"
#define HAS_NIS
-#define HAS_NISPLUS
#define USE_SYS_SOCKIO_H /* Solaris 2.5, changed sys/ioctl.h */
#define GETTIMEOFDAY(t) gettimeofday(t)
#define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"


Następnie kompilujemy Postfixa. W najprostszej postaci:

$ make makefiles
$ make

Jeśli potrzebujemy kompilator GCC lub Sun Studio, można je zainstalować z repozytorium:
# pkg install -v gcc-dev

lub dla Sun Studio:
# pkg install -v sunstudio12u1
# ln -s /opt/sunstudio12.1 /opt/SUNWspro



Jeśli chcemy skompilować Postfixa za pomocą Sun Studio:
$ make makefiles CC=/opt/SUNWspro/bin/cc
$ make

sobota, 6 marca 2010

migracja ONNV do IPS

OpenSolaris b136 to przełomowy build, ponieważ od changesetu 11838 konsolidacja ONNV jest w stanie budować paczki IPS natywnie.
Dotychczasowy system aktualizacji systemu przez BFU/ACR zostanie wycofany w ciągu kilku najbliższych buildów.
Dla developerów systemu jest to spore uproszczenie ponieważ najnowszy build systemu będzie można zainstalować poprzez 'pkg image-update' lub przez wrapper 'onu'.

Na zdjęciu widać jak wygląda proces aktualizacji:

wtorek, 2 marca 2010

IPS - search

Taka mała ciekawostka.
Za pomocą 'pkg' można wyszukiwać pliki za pomocą ich hashy sha1.

W prostym przykładzie wyszukam /usr/bin/bash za pomocą jego hasha:

$ digest -a sha1 /usr/bin/bash
5e047055254cee181900f99553fe82af0e15e54f

$ pkg search 5e047055254cee181900f99553fe82af0e15e54f
INDEX ACTION VALUE PACKAGE
5e047055254cee181900f99553fe82af0e15e54f file usr/bin/bash pkg:/SUNWbash@3.2.50-0.122
5e047055254cee181900f99553fe82af0e15e54f file usr/bin/bash pkg:/SUNWbash@3.2.50-0.123