Wednesday, January 2, 2013

VSFTPD Bloccare limitare user alla home directory

Spesso quando configuriamo un daemon ftp su linux abbiamo la necessità di limitare l'accesso dei nostri utenti solamente alla rispettiva home directory.
Nel nostro caso consideriamo di usare vsftpd
In una configurazione minimale  ci troveremo nella situazione di avere un file vsftpd.conf del tipo



#--------------------------------------------------
# VSFTPD configuration file, powered by Brokenpipe
#--------------------------------------------------
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES

xferlog_enable=YES
xferlog_file=/var/log/xferlog
xferlog_std_format=YES

idle_session_timeout=600
data_connection_timeout=120

ascii_upload_enable=YES
ascii_download_enable=YES
ftpd_banner=Welcome to Ftp service. Powered by Brokenpipe

chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list


listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES


Ed un file chroot_list di configurazione in /etc/vsftpd/  contenente gli utenti chrooted
ad esempio

 ftptestuser

E' importante ricordare se in vsftpd.conf settiamo:

chroot_local_user=YES
chroot_list_enable=YES

significa che di default TUTTI gli user saranno chrooted AD ECCEZIONE di quelli elencati nel file chroot_list

Invece se in vsftpd settiamo:
chroot_local_user=NO
chroot_list_enable=YES

significa che di default SOLAMENTE gli user elencati nel file chroot_list saranno chrooted



500 OOPS: vsftpd: refusing to run with writable root inside chroot ()
allow_writeable_chroot=YES












Sunday, June 10, 2012

ZigBee ProBee-ZE10 DLL coming soon

I'm working on first beta release for dll library on Sena ProBee ZE 10 chipset
Goals are to abstrac low level requests, to simply high level c# class.
Project basen on event driven task such as class will supply all events directly on your class handler code.
Those interested can ask questions here or follow the development on www.brokenpipe.it

Sunday, April 8, 2012

atheros ar8151 pci on linux debian squeeze

La ethernet cart Atheros AR8151 non viene vista da nessuna distro Debian, Prima di procedere con annosi upgrade del kernel (nel mio caso una 2.6.32-5 amd64) vi consiglio di provare questa soluzione:

verifica la versione della nic card installata

lsipci |grep Ethernet
05:00.0 Ethernet controller: Atheros Communications Device 1083 (rev c0)

La mia scheda ethernet viene vista dall'os ma quando provo un ifconfig non c'è ne traccia

Per risolvere il problema aggiungiamo la seguente istruzione alla fine del file rc.local (che trovate in /etc/init.d/)

modprobe atl1c
echo "1969 1083" > /sys/bus/pci/drivers/atl1c/new_id

Per verificare la presenza del modulo kernel in questione:

modinfo atl1c

Riavviamo il sistema
shutdown -r now

e verifichiamo ora il funzionamento corretto della nostra nic.

Se ritieni che questo articolo possa esserti stato d'aiuto lascia un commento.






Thursday, September 22, 2011

GRUB Installation Issue with 2 TB HDD

Few days ago i need across to install  a box with 2 x 2 TB HDD WD  Caviar Green with  Debian Squeeze with RAID 1. So I started the installation.
Even now I have noticed some strange, when partitioning first hd it don't ask me to set primary partition and bootable flag was not exchangeable
Apart from this was going well until the GRUB installation. It failed with the error message below!
Sep 22 01:34:43 grub-installer: grub-setup: warn: This GPT partition label has no BIOS Boot Partition; embedding won’t be possible!
Sep 22 01:34:43 grub-installer: grub-setup: error: Embedding is not possible, but this is required when the root device is on a RAID array or LVM volume
I started googlin for two days, with numeros forum suggestion with technical details about WD caviar green 4KB sector setup on linux and relative bugs, GPT configuration suggestion... all these attemps failed! :(   
Today I decided to try another way... and this time successfully :)
Problems could be solved adding a small partition (200MB) BIOS Boot Partition which was missing on both sda devices.
If this post was useful to you, please follow me.

Tuesday, June 21, 2011

Crystal Reports filed text newline, carriage return, \r\n

Nel mio crystal report ho un textFiled, vorrei settare il suo valore runtime.

rpt.DataDefinition.FormulaFields["fieldTarga"].Text =TextBoxTarga.Text;
Tutto funziona correttamente, fino a quando il valore da assegnare non contiene i caratteri speciali linefeed e carriage return "\r\n". Questo è un bug di Crystal Report for .NET 
Per risolvere il problema, anche se di primo acchito appare insensato, possiamo ovviare usando questa semplice funzione:
string FormatCRField(string s)
        {
            return "'" + s.Replace("\r\n", "' + chr(10) + '") + "'";
        }
Sostituisce "\r\n"  con chr(10) che verrà interpetato correttamente dal "parser" di CR.
Spero che questo possa aiutarti.

Friday, May 20, 2011

c# Activerecord ExecuteQuery isnull sqlite

Come indicato nel precedente post http://brokenpipe-it.blogspot.com/2011/05/sqlite-equivalent-isnull-statement.html la corrispondente sintassi "isnull" è ifnull(x,y) ma si presenta un problema nell'esecuzione del metodo Executequery di Activerecordmediator con query scalare; vediamo un esempio:

     string hql = "SELECT SUM(p.Pz) FROM PackingDetails p " +
                    "WHERE p.Id_packing = :parIdPack "

    ScalarQuery q = new ScalarQuery(typeof(PackingDetails), hql);

    q.SetParameter("parIdPack", IdPack);

    long totalPz = ActiveRecordMediator.ExecuteQuery(q);
              
    return Convert.ToInt32(totalPz);




Nel caso in cui la condizione indicata dalla clausola where non sia verificata ci aspetteremo in uscita 0, ma in realtà ci troveremo , invece, una SystemNullException.
Per ovviare al problema risolviamo così:
     try
      {
      string hql = "SELECT SUM(p.Pz) FROM PackingDetails p " +
                   "WHERE p.Id_packing = :parIdPack " +


     ScalarQuery q = new ScalarQuery(typeof(PackingDetails), hql);

     q.SetParameter("parIdPack", IdPack);

     long? totalPz = (long?)ActiveRecordMediator.ExecuteQuery(q);
               
     return Convert.ToInt32((totalPz.HasValue) ? totalPz : -1);
     }
    catch (Exception ex)
    {
       Console.WriteLine(ex.Message);
       return -1;
    }



 long? totalPz =(long?)ActiveRecordMediator.ExecuteQuery(q);

informerà il compilatore che la variabile totalPz non dovrà obbligatoriamente essere valorizzata e quindi poi utilizzeremo 

       ((totalPz.HasValue) ? totalPz : -1)

per ritornare totalPz se valorizzata e -1 in caso valga null

Considerazioni o altri  suggerimenti sono ben accetti. 

Sqlite equivalent ISNULL statement

Come descritto dalle core function http://www.sqlite.org/lang_corefunc.html#ifnull l'equivalente statement è IFNULL.