Good Evening :) I wanted to know is it possible to write a script to alert me by email if anyone accessed to Samba. For example: 192.168.0.2 and 192.168.0.3 allowed to access to samba network (I wont get a alert). Any IP apart from 192.168.0.2 / 192.168.0.3 then it will alert me. thanks. Shahid
> > >Good Evening :) > >I wanted to know is it possible to write a script to alert me by email if anyone accessed to Samba. > >You could always use the pre-exec directive on a share and then evaluate the ip address of the client, passed with the %I variable like so [myshare] root preexec = /scripts/somecommand.pl %I Check out http://www.samba.org/samba/docs/man/smb.conf.5.html in the section for variable substitution for other interesting things you may want to pass. -- Paul Gienger Office: 701-281-1884 Applied Engineering Inc. Information Systems Consultant Fax: 701-281-1322 URL: www.ae-solutions.com mailto: pgienger@ae-solutions.com
hi, there are many ways to implement such script, ie. i have done a dos script at netlogon which checks the ip and does not install printers for vpn users. But there should be a way with root exec and perl too directly in share. Checking samba log by cron should be work too. ( cause normally you have there a file for each ip ) grep them, compare them to your list of wanted ips and mail it out. Perhaps somebody has done such scripts before on the list an can help you out. Regards Shahid Hussain schrieb:> Good Evening :) > > I wanted to know is it possible to write a script to alert me by email if anyone accessed to Samba. > > For example: > > 192.168.0.2 and 192.168.0.3 allowed to access to samba network (I wont get a alert). > > Any IP apart from 192.168.0.2 / 192.168.0.3 then it will alert me. > > > thanks. > > Shahid
Gee, sure you don't just want IPTables on your server protecting the services on the server? Let a firewall be a firewall, and the file/print server to be a file/print server? You could have it email if specifically for the rule of bad IP's trying to get to Samba... but since it would block it for you would you really need the email vs just checking your logs now and then to see what you didn't have to worry about since it took care of it for you? -- Michael Lueck Lueck Data Systems Remove the upper case letters NOSPAM to contact me directly.
Shahid Hussain schrieb:>Good Evening :) > >I wanted to know is it possible to write a script to alert me by email if anyone accessed to Samba. > >For example: > >192.168.0.2 and 192.168.0.3 allowed to access to samba network (I wont get a alert). > >Any IP apart from 192.168.0.2 / 192.168.0.3 then it will alert me. > > >You can take a look at smbstatus and Perl. matze