This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
61
Installation and Upgrades / Re: HowTo: Samba users logging, view through browser
« on: July 17, 2015, 04:35:47 pm »
If you liked that, you'll love this Here's the updated code I promised, with some easier-on-the-eye formatting and an a-z user sort.
Code: [Select]
<?php
error_reporting(0);
exec("sudo /usr/bin/smbstatus -p -d 1",$top);
exec("sudo /usr/bin/smbstatus -S -d 1",$log);
exec("sudo /usr/bin/smbstatus -L",$lock);
$nowt = date('H:i:s');
$nowd = date('d-m-Y');
$pid_us = array();
for($i=4;$i<sizeof($top);$i++)
if(!trim($top[$i])=="") {
$users2[] = split("[ ]+",$top[$i],5);
$pid_us2[$users2[sizeof($users2)-1][1]] = $users2[sizeof($users2)-1][2];
}
for($i=3;$i<sizeof($log);$i++)
if(!trim($log[$i])=="") {
$users[] = split("[ ]+",$log[$i],4);
$pid_us[$users[sizeof($users)-1][1]] = $users[sizeof($users)-1][2];
}
for($i=3;$i<sizeof($lock);$i++)
if(!trim($lock[$i])=="") {
$line = split("[ ]+",$lock[$i],7);
$usr = $pid_us[$line[0]];
if(trim($usr)=="") $usr = $line[0];
$locks[$line[0]][] = array($line[0],$usr,substr_replace($line[6]," @ ",-24,0)); //Add @ between file and date
}
foreach($users as $key => $row) {
$column1[$key] = $row[0];
$column2[$key] = $row[1];
$column3[$key] = $row[2];
$column4[$key] = $row[3];
}
array_multisort($column4, SORT_DESC, $users);
//die("");
echo "<head>\n";
echo "<link rel='icon' type='image/png' href='favicon.png'>";
echo "<link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono'/>";
echo "<style type='text/css'>\n";
echo "table {border: 5px solid #aaaaaa; -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; border-collapse: separate; border-spacing: 0; -webkit-box-shadow: 0px 8px 6px 2px #333; -moz-box-shadow: 0px 8px 6px 2px #333; box-shadow: 0px 8px 6px 2px #333;}";
echo "th, td {border-bottom: 1px solid #999; border-right: 1px solid #999;}";
echo "body, h1, ptitle, th, td, p, pf {font-family: 'Droid Sans Mono', sans-serif,;}";
echo "p {font-family: 'Droid Sans Mono', ;}";
echo "table {margin-left: 50px; margin-top: 14px; margin-bottom: 20px;}";
echo "p { margin: 6px; font-size: 16px; }";
echo "pf {margin: 12px; }";
echo "ptitle {background: #ddd; font-size: 26px; margin: 22px; border: 3px solid #ccc; -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px;}";
echo "ptitle {border-collapse: separate; border-spacing: 0; -webkit-box-shadow: 0px 8px 6px -6px #555; -moz-box-shadow: 0px 8px 6px -6px #555; box-shadow: 0px 8px 6px 2px #555;}";
echo "ttitle {font-size: 24px; margin: 22px; }";
echo "th {font-size: 18px; color: #fff; background: #49708A; }";
echo "td {font-size: 14px; }";
echo "body {width: 95%; margin-left: auto; margin-right: auto; font-family: 'Droid Sans Mono', sans-serif; background: #eeeeee;}";
echo ".machine {font-weight: bold; background: #98bBd2; }";
echo ".pid {font-weight: bold; background: #88ABC2; }";
echo ".filet {background: #e1e1e1; }";
echo "</style>\n";
echo "</head>\n";
echo "<title>Samba Network Status</title>";
echo "<body>\n";
echo "<h1>[ SAMBA User Activity / ".$nowt." / ".$nowd." ]</h1></ br>";
echo "<ptitle>[ Connected Users ]</ptitle>\n\n";
echo "<table>\n";
echo "<br />";
echo "<tr><th><ttitle>PID</ttitle></th><th><ttitle>Machine</ttitle></th><th><ttitle>User</ttitle></th><th><ttitle>Group</ttitle></th>\n";
foreach($users2 as $user2){
list($pid,$username,$groupa,$groupb,$machine) = $user2;
echo "<tr>\n";
echo "<td align='center' class='pid'><p>".$pid."</p></td>\n";
echo "<td class='machine'><p>".$machine."</p></td>\n";
echo "<td align='center' class='user'><p>".$username."</p></td>\n";
echo "<td align='center'><p>".$groupa." ".$groupb."</p></td>\n";
echo "</tr>\n";
}
echo "</table>\n\n";
echo "<br />";
echo "<table >\n";
echo "<ptitle>[ Current Open/Locked files ]</ptitle>\n";
echo "<tr><th><ttitle>PID</ttitle></th><th><ttitle>Machine</ttitle></th><th><ttitle>File</ttitle></th>\n";
$cuser = "";
$first = true;
foreach($locks as $l){
foreach($l as $lck){
list($pid, $user, $file) = $lck;
if($user != $cuser){
if(!$first){
echo "<tr>\n";
echo "<td style='border-right: none;'> </td>\n";
echo "<td style='border-right: none;'> </td>\n";
echo "<td style='border-right: none;'> </td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td align='center' class=\"pid\"><p>".$pid."</p></td>\n";
echo "<td align='center' class='machine'><p>".$user."</p></td>\n";
echo "<td class='filet' align='left' ><pf>".$file."</pf></td>\n";
echo "</tr>\n";
$cuser = $user;
}
else {
echo "<tr>\n";
echo "<td style='border: none;'> </td>\n";
echo "<td style='border-bottom: none; border-right: 1px solid #999;'> </td>\n";
echo "<td class='filet'><pf>".$file."</pf></td>\n";
echo "</tr>\n";
}
$first = false;
}
}
echo "</table>\n";
echo "<br />";
echo "<ptitle>[ User Shares Log ]</ptitle>\n";
echo "<br />";
echo "<table >\n";
echo "<tr><th><ttitle>PID</ttitle></th><th><ttitle>Machine</ttitle></th><th><ttitle>Share</ttitle></th><th><ttitle>Date/Time</ttitle></th>\n";
foreach($users as $user){
list($service,$pid,$mach,$date) = $user;
echo "<tr\n>";
echo "<td align='center' class='pid'><p>".$pid."</p></td>\n";
echo "<td align='center' class='machine'><p>".$mach."</p></td>\n";
echo "<td ><p>".$service."</p></td>\n";
echo "<td><p>".$date."</p></td>\n";
echo "</tr>\n";
}
echo "</table>\n\n";
echo "</body>\n";
echo "</html>\n";
?>
62
Installation and Upgrades / Re: How to check user's mailbox size on zentyal2.2 server by command line ?
« on: July 01, 2015, 09:49:28 am »
Are you using Zentyal 2.2 in testing or production ? It's based on Ubuntu 10.04 and the long term support for this version has ended in April. You should be looking to migrate the data on this server to an updated version..
63
Installation and Upgrades / Re: HowTo: Samba users logging, view through browser
« on: June 24, 2015, 12:23:06 pm »
PHP version.
This was made possible by the template from moiristo, which I have modified to remove the 'kick user' function and format the returned data differently.
For this, if it's not already enabled you'll need to enable PHP within apache.
Create a php file (e.g. status.php), copy paste the following code, and place it in your /var/www/html/smbstatus folder (create the folder /var/www/html/smbstatus if it doesn't exist);
To allow the script to run smbstatus as root, add the following to the end of the /etc/sudoers file;
Then load up the php file you just created;
http://your.server.address/smbstatus/status.php
Opening the page will pull the required data on the fly and format it. As with the 'basic version' you'll probably want to restrict access to this folder by creating an htpasswd and adding an .htaccess file to your /var/www/html/smbstatus folder;
It's not pretty, but it works
I'm planning to make a prettier version with a little CSS formatting and will post up when it's finished.
This was made possible by the template from moiristo, which I have modified to remove the 'kick user' function and format the returned data differently.
For this, if it's not already enabled you'll need to enable PHP within apache.
Code: [Select]
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
Create a php file (e.g. status.php), copy paste the following code, and place it in your /var/www/html/smbstatus folder (create the folder /var/www/html/smbstatus if it doesn't exist);
Code: [Select]
<?php
error_reporting(0);
exec("sudo /usr/bin/smbstatus -p -d 1",$top);
exec("sudo /usr/bin/smbstatus -S -d 1",$log);
exec("sudo /usr/bin/smbstatus -L",$lock);
$pid_us = array();
for($i=4;$i<sizeof($top);$i++)
if(!trim($top[$i])=="") {
$users2[] = split("[ ]+",$top[$i],5);
$pid_us2[$users2[sizeof($users2)-1][1]] = $users2[sizeof($users2)-1][2];
}
for($i=8;$i<sizeof($log);$i++)
if(!trim($log[$i])=="") {
$users[] = split("[ ]+",$log[$i],4);
$pid_us[$users[sizeof($users)-1][1]] = $users[sizeof($users)-1][2];
}
for($i=3;$i<sizeof($lock);$i++)
if(!trim($lock[$i])=="") {
$line = split("[ ]+",$lock[$i],7);
$usr = $pid_us[$line[0]];
if(trim($usr)=="") $usr = $line[0];
$locks[$line[0]][] = array($line[0],$usr,substr_replace($line[6]," @ ",-24,0)); //Add @ between filename and date accessed
}
//die("");
echo "<table style='border: 1px solid black;'>\n";
echo "<font style=\"font-family: Verdana;\"><b>Connected Users:</b></font>\n\n";
echo "<br />";
echo "<font style=\"font-family: Verdana;\"><tr><th>PID</th><th>User</th><th>Group</th><th>Machine</th></font>\n";
foreach($users2 as $user2){
list($pid,$username,$groupa,$groupb,$machine) = $user2;
echo "<tr>\n";
echo "<td class=\"user\" style='border-right: 1px solid black;'>".$pid."</td>\n";
echo "<td class=\"pid\" style='border-right: 1px solid black;'>".$username."</td>\n";
echo "<td style='border-right: 1px solid black;'>".$groupa." ".$groupb."</td>\n";
echo "<td >".$machine."</td>\n";
echo "</tr>\n";
}
echo "</table>\n\n";
echo "<br /><br />";
echo "<br />";
echo "<table style='border: 1px solid black;'>\n";
echo "<font style=\"font-family: Verdana;\"><b>Open files:</b></font>\n";
echo "<font style=\"font-family: Verdana;\"><tr><th>PID</th><th>Machine</th><th>File</th></font>\n";
$cuser = "";
$first = true;
foreach($locks as $l){
foreach($l as $lck){
list($pid, $user, $file) = $lck;
if($user != $cuser){
if(!$first){
echo "<tr>\n";
echo "<td> </td>\n";
echo "<td> </td>\n";
echo "<td> </td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td style='border-right: 1px solid black;' class=\"pid\">".$pid."</td>\n";
echo "<td style='border-right: 1px solid black;' class=\"user\">".$user."</td>\n";
echo "<td style='border-left: 1px solid black;'>".$file."</td>\n";
echo "</tr>\n";
$cuser = $user;
}
else {
echo "<tr>\n";
echo "<td> </td>\n";
echo "<td> </td>\n";
echo "<td>".$file."</td>\n";
echo "</tr>\n";
}
$first = false;
}
}
echo "</table>\n";
echo "<br />";
?>
To allow the script to run smbstatus as root, add the following to the end of the /etc/sudoers file;
Code: [Select]
www-data ALL=NOPASSWD: /usr/bin/smbstatus
Then load up the php file you just created;
http://your.server.address/smbstatus/status.php
Opening the page will pull the required data on the fly and format it. As with the 'basic version' you'll probably want to restrict access to this folder by creating an htpasswd and adding an .htaccess file to your /var/www/html/smbstatus folder;
It's not pretty, but it works
I'm planning to make a prettier version with a little CSS formatting and will post up when it's finished.
64
Installation and Upgrades / HowTo: Samba users logging, view through browser
« on: June 24, 2015, 11:54:31 am »
I was very disappointed to find that the samba user info that used to get logged to the management pages has been removed from the recent Zentyal versions. I wanted to restore this very useful diagnostic function and so looked for an alternative method to create a similar web-based log.
Prerequisites;
You need apache2 installed and configured > https://wiki.zentyal.org/wiki/Apache_web_server
Basic version;
Use smbstatus to dump its output to a text file that you open in a browser. Make a folder called smbstatus in /var/www/html/
As root, create a cron job (crontab -e) that looks like this;
* * * * * smbstatus > /var/www/html/smbstatus/smb.txt
This will pull samba info once per minute and dump it into /var/www/html/smbstatus/smb.txt
(if you want it to be updated more often than once per minute, you can create a bash file that calls 'smbstatus > /var/www/html/smbstatus/smb.txt' and then 'sleep 15' i.e. wait for 15 seconds' and call smbstatus again, sleep, repeat.. and call that bash file from crontab instead)
You can then access this via;
http://your.server.address/smbstatus/smb.txt
You'll probably want to restrict access to this folder by creating an htpasswd and adding an .htaccess file;
I'll post up the PHP version shortly
Prerequisites;
You need apache2 installed and configured > https://wiki.zentyal.org/wiki/Apache_web_server
Basic version;
Use smbstatus to dump its output to a text file that you open in a browser. Make a folder called smbstatus in /var/www/html/
As root, create a cron job (crontab -e) that looks like this;
* * * * * smbstatus > /var/www/html/smbstatus/smb.txt
This will pull samba info once per minute and dump it into /var/www/html/smbstatus/smb.txt
(if you want it to be updated more often than once per minute, you can create a bash file that calls 'smbstatus > /var/www/html/smbstatus/smb.txt' and then 'sleep 15' i.e. wait for 15 seconds' and call smbstatus again, sleep, repeat.. and call that bash file from crontab instead)
You can then access this via;
http://your.server.address/smbstatus/smb.txt
You'll probably want to restrict access to this folder by creating an htpasswd and adding an .htaccess file;
I'll post up the PHP version shortly
65
Installation and Upgrades / Re: VPN error
« on: June 24, 2015, 11:28:22 am »
As root, take a look in /var/log/openvpn/ and tail the log file before you connect. Then you can see all the logging for the connection. There should be two active logs status-<VPN Name>.log and <VPN Name>.log, it's the second one you want;
tail -f /var/log/openvpn/<VPN-Name>.log
have a look in your log files and see what your logs are called, replace <VPN-name> accordingly. Try connecting your router and see what errors are thrown up in the process.
tail -f /var/log/openvpn/<VPN-Name>.log
have a look in your log files and see what your logs are called, replace <VPN-name> accordingly. Try connecting your router and see what errors are thrown up in the process.
66
Installation and Upgrades / Re: VPN error
« on: June 09, 2015, 04:12:44 pm »
That's all excellent advice.. When you try to connect the VPN do you get an 'UNDEF' connection in the VPN section of the management pages ? If so, then the connection is proceeding but the server is refusing authentication and you should look at the configuration of the VPN server or your local bundle.
Did you manage to get it connected KJackson50 ? If not, post some logs.
Did you manage to get it connected KJackson50 ? If not, post some logs.
67
Installation and Upgrades / Re: Changing ownership
« on: May 30, 2015, 07:38:20 pm »
Glad you got it sorted.
So the share was mounted by someone other than root ?
So the share was mounted by someone other than root ?
68
Installation and Upgrades / Re: Changing ownership
« on: May 26, 2015, 10:08:20 pm »
Actually I just noticed that you have no group permissions set after you chown the folder to supervisor, I think this is why you're having issues. As root;
Make sure you set the group properly on the folder.
Code: [Select]
chmod g+rwx /home/samba/shares/DATA
To set group read/write/execute permissions on the folderCode: [Select]
chmod -R g+rwx /home/samba/shares/DATA
if you need to change the permissions on the contents of DATA too.Make sure you set the group properly on the folder.
Code: [Select]
chown administrator:adm /home/samba/shares/DATA
orCode: [Select]
chown -R administrator:adm /home/samba/shares/DATA
if you need to change the permissions on the contents of DATA too.
69
Installation and Upgrades / Re: Importing Existing Configs
« on: May 21, 2015, 04:34:44 pm »
System > configuration-backup
Change from cloud to local using the tab at the top of the page. You can create config backups and import/export them from this page. Is that what you meant ?
Change from cloud to local using the tab at the top of the page. You can create config backups and import/export them from this page. Is that what you meant ?
70
Installation and Upgrades / Re: Unable to download certain modules
« on: May 18, 2015, 12:12:25 am »
What do you have in your /etc/apt/sources.list file ?
It sounds like you're using unstable sources..
It sounds like you're using unstable sources..
71
Installation and Upgrades / Re: [SOLVED]amavisd error after last upgrade
« on: May 15, 2015, 10:14:54 am »
Found in the Internet Archive;
Quote
Hello Smashe,
this is a setup error and it is solved in [3b02cba]
However to fix any system with the mailfilter module, already installed and enabled, you should use the following commands
sudo -s
su postgres -c'psql -c"create database spamassassin" '
su postgres -c'psql spamassassin < /usr/share/zentyal-mailfilter/sql/spamassassin.sql'
/etc/init.d/zentyal mailfilter restart
Some misplaced tables will be left in the eboxlogs database, you could remove if they bother you. They are bayes_expire ,bayes_global_vars, bayes_seen, bayes_token and bayes_vars
Regards,
Javier
72
Installation and Upgrades / Re: Change File permission and ownership.
« on: May 15, 2015, 10:11:45 am »
If this fixed your problem, can you please mark your question as SOLVED ? Thanks.
73
Installation and Upgrades / Re: Unable to download certain modules
« on: May 15, 2015, 10:08:19 am »
Yes we can help, but only if you can give us something to work on ! What's the error you are getting ?
74
Installation and Upgrades / Re: Build HTTP Module
« on: May 14, 2015, 05:22:42 pm »
Good question. I've been wondering that too..
75
Installation and Upgrades / Re: External retrieval of mail
« on: May 14, 2015, 05:14:34 pm »
Sorry guza91ns, I can't comment because it's a long time since I played with Zentyals mail features, but since you asked so nicely - Hello !
I agree, it's a bit quite around here. Need to get more people posting..
I agree, it's a bit quite around here. Need to get more people posting..