0

Avaya Phone System forwarding for external calls only \ Link an external phone number to an internal number

Posted by paris on Apr 20, 2017 in Random

Had a user complain only external calls went to the default hunt group forward.

Open Avaya IP Office Manager

Go to User’s , and check forwarding Tab

Go to Incoming Call Route

Add an incoming call route to the extension 

Save the Config to write back to phone system

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , , , ,

 
0

iManage – Index one workspace or multiple via SQL

Posted by paris on Apr 20, 2017 in Fixes

You can make a change to the WorkSpace description (add a full stop to the description or other characters), save it, and then reverse the change, and save it, it to force a WorkSpace to be re-indexed.

This will update the time stamp on the WorkSpace and the Indexer should pick it up to be indexed.

WorkSite Connector service is only looking for the EDITWHEN or EDITPROFILEWHEN column in the MHGROUP.DOCMASTER table

https://support.imanage.com/forums/showthread.php?t=1660&highlight=workspace

 

If changing this does not get this Workspace in the indexer it seems your connector might be broken , make sure you update to the latest version ( connector.jar )

 

 

If you have a batch of workspaces you can also do this through SQL:

To check if you are running UTC go to the below registry path on your iManage Servers
HKEY_LOCAL_MACHINE\SOFTWARE\Interwoven\WorkSite\imDmsSvc
UTC In Use = N
Or:
UTC In Use = Y

If this key does not exist 

Run this query in SQL

SELECT 'GETDATE() ', GETDATE(); 
SELECT 'GETUTCDATE() ', GETUTCDATE();

Check both the times , and update a workspace name ( by adding a full stop at the end and deleting ) and then use a select query to see which time is closer to see if it’s using UTC or not

SELECT *FROM MHGROUP.DOCMASTER DWSJOIN MHGROUP.PROJECTS PWS ON DWS.DOCNUM = PWS.DOCNUMWHERE PWS.PRJ_NAME LIKE '%name of workspace%'


Check the PRJ_NAME matches your WorkSpace Description.

If you are UTC In Use = N, ( not ) use the below.

To update the WorkSpace for re-indexing:

UPDATE MHGROUP.DOCMASTERSET EDITPROFILEWHEN = GETDATE()FROM MHGROUP.DOCMASTER DWSJOIN MHGROUP.PROJECTS PWS ON DWS.DOCNUM = PWS.DOCNUMWHERE PWS.PRJ_NAME LIKE '%name of workspace%'

If you are UTC In Use = Y, ( Yes ) use the below.

To update the WorkSpace for re-indexing:


UPDATE MHGROUP.DOCMASTERSET EDITPROFILEWHEN = GETUTCDATE()FROM MHGROUP.DOCMASTER DWSJOIN MHGROUP.PROJECTS PWS ON DWS.DOCNUM = PWS.DOCNUMWHERE PWS.PRJ_NAME LIKE '%name of workspace%'

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , , , , , , ,

 
0

Securing Apache to use Certificate Authentication auth_x509

Posted by paris on Apr 16, 2017 in Code, Random

 

Query to see if Certificate Exists via  x509 based logins

<?php
include(__DIR__."/auth_mysql.php");
 
/**
 * Mysql based authentication
 * The standard username/password based authentication library
 *
 * @package CMS
 * @author Sid Karunaratne
 **/
class auth_x509 extends auth_mysql
{
	public function pre_login()
	{
		foreach($_SERVER as $key => $value)
		{
			if (!$value || strncmp($key, 'SSL_CLIENT_S_DN_Email', 21) !== 0)
				continue;
			$user = $this->_check_email_is_valid($value);
			if ($user)
				return $user;
		}
		return false;
	}
 
	protected function _check_email_is_valid($email)
	{
		$user = $this->db->select("
					u.id,
					u.name,
					GROUP_CONCAT(g.id SEPARATOR ',') as team_ids,
					u.username as email,
					GROUP_CONCAT(g.name SEPARATOR ', ') as teams,
					permission_last_set
				")
			->from("_auth_user u")
			->join("_auth_user_group_xrefs aux", "aux.user_id = u.id")
			->join("_auth_group g", "g.id = aux.group_id")
			->where("u.username", $email)
			->group_by("u.id")
			->get()->result();
		if (!$user)
			return false;
 
 
		// The user is valid
		$user = array_shift($user);		
		$user = $this->_finalise_user_login($user);
		return $user;
	}
 
	public function login($credentials)
	{
		return false;
	}
}
// END class auth_x509

 

 

httpd-ssl.conf

Listen 443
 
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
 
<VirtualHost *:443>
DocumentRoot "/srv/http/"
ServerName website.domain.com:443
ServerAdmin email@address.com
ErrorLog /var/log/httpd/ssl.error.log
TransferLog /var/log/httpd/ssl.access.log
BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
 
SSLEngine on
SSLProtocol -all +TLSv1 +SSLv3
SSLCipherSuite HIGH:MEDIUM
SSLProxyEngine off
# The certificate CACert signed
SSLCertificateFile /etc/httpd/conf/ssl/dev.zealothost.net.crt
# The private key
SSLCertificateKeyFile /etc/httpd/conf/ssl/dev.zealothost.net.key
# CACert's certificate - Seems to not be required
SSLCertificateChainFile /etc/httpd/conf/ssl/ca.crt
# CACert's certificate - The CA I require certificates to be signed with
SSLCACertificateFile /etc/httpd/conf/ssl/ca-dskort.crt
SSLOptions +StrictRequire +OptRenegotiate +StdEnvVars +ExportCertData
 
SSLVerifyClient require
SSLVerifyDepth 1
</VirtualHost>

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , ,

 
0

Bash Script for creating virtual hosts (along with the unix user, the db etc)

Posted by paris on Apr 16, 2017 in Code

Synopsis

This is the documentation for the create-website script I’ve created. The results of passing the -h parameter print out the following help:

SYNOPSIS:
create-website -u USER -w WEBSITE [-s|-f|-d|-h|-i <ip>]
DESCRIPTION:
Creates a new web site for a new user on the system. This
includes creating the user, the FTP account, the Database and
the virtual host

USER is the username of the owner of the web site. If the
account name doesn’t exist it will be created. Must be a valid
UNIX and MySQL username

WEBSITE is the url of the site to be created. Must be a FQDN,
should not include the www prefix. Preferably should be lower-
case.

-s Allow SSH based logins for the user [default = false]
-f Allow FTP based logins for the user [default = false]
-d Create a database for the user [default = false]
-i The IP the virtual host will listen on, by default the IP of eth0
-h Show this help message

That should be pretty self explanatory.
Configuration and execution

This script needs root privileges to run, so it is important that only root is able to edit the script. The script is stored in /usr/sbin/create-website.

This script does pull in a configuration file from /etc/.create-website. This file should be owned by root and chmodded to 400 (only readable by root). The contents of that configuration file should be something like:

<?php
$config = array(
‘mysql_username’ => ‘builder’,
‘mysql_password’ => ‘some_password’,
‘mysql_host’ => ‘localhost’
);
?>

This MySQL account need full privileges in order to be allowed to create accounts and give out the correct privileges itself.

Log rotation configurations are put into place that will rotate the access.log and error.log on a weekly basis, keeping 52 weeks of log files for each web site.
Files this script potentially touches:

Files Trigger
/etc/passwd Creating User
/etc/groups Creating User
/etc/shadow Creating User
/etc/apache2/sites-available/$website Creating Website
/etc/apache2/sites-enabled/$website Creating Website
/etc/logrotate.d/apache2_$website Creating Website
/etc/vsftpd.user_list When user is granted FTP access
/etc/ssh/sshd_config When user is granted SSH access
/home/$user/$website/ Directory where public facing web content resides
/home/$user/log/www/$website Directory where Apache log files reside

Note that this script has made specifically for the Ubuntu server with all the software installed where apt-get installs them by default. This script will need tweaking if used on a different set up.

 

#!/usr/bin/php
<?php
/**
 * Create Website
 * 
 * Entirely in house, very system dependent. Works on an Ubuntu installation with Apache and Mysql at pretty much default preferences.
 * If you're moving this to a new server you will very likely have to re-write parts of it (paths etc)
 * 
 * @license Public Domain
 * @author Sid Karunaratne
 */
 
error_reporting(0);
// Options: user, website, has_ssh, has_ftp, has_db
$opts		= getopt('u:w:sfdhi:');
$user		= $opts['u'];
$website	= $opts['w'];
$ip			= array_key_exists('i',$opts) ? $opts['i'] : get_ip();
$has_ssh	= (bool) array_key_exists('s',$opts);
$has_ftp	= (bool) array_key_exists('f',$opts);
$has_db		= (bool) array_key_exists('d',$opts);
$help		= (bool) array_key_exists('h',$opts);
 
$err = fopen('php://stderr','w');
$out = fopen('php://stdout','w');
$db = null;
 
if ($help || (!$user || !$website))
{
	display_help();
	exit;
}
 
if (posix_getuid() !== 0)
{
	_err('I need to be run as root');
	exit(1);
}
 
if (site_exists($website))
{
	_err('The website already exists, if you want to add more users to control this site you are going to have to do it manually');
	exit(1);
}
 
# Check with the user we are doing the right thing
_err("About to create the account $user with the website $website with the virtual host listening on $ip");
$str = $has_ssh ? '' : 'NOT ';
_err($str. "allowing SSH login");
$str = $has_ftp ? '' : 'NOT ';
_err($str. "allowing FTP login");
$str = $has_db ? '' : 'NOT ';
_err($str. "creating a database");
_err("Press y/n to confirm action: ", false);
if (!in_array(_in(), array('y', 'Y', 'yes', 'true')))
{
	_err('Exiting');
	exit(1);
}
 
require('/etc/.create-website');
connect_db();
 
if (!user_exists($user))
{
	_out("User '$user' does not exist and will be created");
	`adduser --gecos "" $user`;
}
if ($has_ssh && !user_has_ssh($user))
{
	_out("User '$user' is being given SSH access");
	`echo 'AllowUsers $user' >> /etc/ssh/sshd_config`;
}
if ($has_ftp && !user_has_ftp($user))
{
	_out("User '$user' is being given chrooted FTP access");
	`echo $user >> /etc/vsftpd.user_list`;
}
if ($has_db)
{
	# Create DB
	global $db;
	_out("Database being created (or already exists), user being created and access to database being given");
	$mysql_password = prompt_silent("Please enter a MySQL password: ");
	$db_name = str_replace('.', '_', $website);
	mysql_query("CREATE DATABASE IF NOT EXISTS `$db_name`");
	mysql_query("CREATE USER '$user'@'%' IDENTIFIED BY '".mysql_real_escape_string($mysql_password)."'");
	mysql_query("GRANT USAGE ON * . * TO '$user'@'%' IDENTIFIED BY '".mysql_real_escape_string($mysql_password)."'");
	mysql_query("GRANT ALL PRIVILEGES ON `$db_name` . * TO '$user'@'%'");
	mysql_query("FLUSH PRIVILEGES");
 
}
_out("Virtual host for $website is being created");
# Create vhost
 
mkdir("/home/$user/$website", 0755, true);
chown("/home/$user/$website", $user);
chgrp("/home/$user/$website", $user);
mkdir("/home/$user/log/www/$website", 0755, true);
chown("/home/$user/log/www/$website", $user);
chgrp("/home/$user/log/www/$website", $user);
$vhost = "<VirtualHost {$ip}:80>
    ServerAdmin $user@keepthinking.it
    DocumentRoot /home/$user/$website
    ServerName $website
    ServerAlias www.$website
    ErrorLog /home/$user/log/www/$website/error.log
    CustomLog /home/$user/log/www/$website/access.log combined
</VirtualHost>";
file_put_contents("/etc/apache2/sites-available/$website", $vhost);
symlink("/etc/apache2/sites-available/$website", "/etc/apache2/sites-enabled/$website");
 
_out("Configuration for the logrotation are being put in place");
# Adding logrotate
$logrotate = "/home/$user/log/www/$website/*.log {
	weekly
	missingok
	rotate 52
	compress
	notifempty
	copytruncate
}
";
file_put_contents("/etc/logrotate.d/apache2_{$user}_{$website}", $logrotate);
 
_err("Services are being reloaded for the changes to take effect");
`service apache2 reload`;
`service vsftpd reload`;
`service ssh reload`;
 
 
/**************************
/* HERE ARE THE FUNCTION THAT YOU SHOULDN'T NEED TO TOUCH
**************************/
 
function user_exists($user)
{
	$users = file('/etc/passwd', FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES);
	foreach ($users as $line)
	{
		$components = explode(':', $line);
		if ($components[0] === $user)
			return true;
	}
	return false;
}
 
function site_exists($website)
{
	return file_exists("/etc/apache2/sites-enabled/$website");
}
 
function user_has_ssh($user)
{
	$config = file('/etc/ssh/sshd_config', FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES);
	foreach ($config as $line)
	{
		if (strncasecmp($line, 'AllowUsers', 10) === 0)
			if (in_array($user, explode(' ', $line)))
				return true;
	}
	return false;
}
 
function user_has_ftp($user)
{
	$users = file('/etc/vsftpd.user_list', FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES);
	foreach ($users as $line)
	{
		if ($line === $user)
			return true;
	}
	return false;
}
 
function connect_db()
{
	global $db;
	global $config;
	$db = mysql_connect($config['mysql_host'], $config['mysql_username'], $config['mysql_password']);
	mysql_select_db('mysql', $db);
	echo mysql_error();
}
 
function display_help()
{
	$help = "
	SYNOPSIS:
		create-website -u USER -w WEBSITE [-s|-f|-d|-h|-i <ip>]
	DESCRIPTION:
		Creates a new web site for a new user on the system. This 
		ncludes creating the user, the FTP account, the Database and
		the virtual host
 
		USER is the username of the owner of the web site. If the
		account name doesn't exist it will be created. Must be a valid
		UNIX and MySQL username
 
		WEBSITE is the url of the site to be created. Must be a FQDN,
		should not include the www prefix. Preferably should be lower-
		case.
 
		-s	Allow SSH based logins for the user [default = false]
		-f	Allow FTP based logins for the user [default = false]
		-d	Create a database for the user [default = false]
		-i	The IP the virtual host will listen on, by default the IP of eth0
		-h	Show this help message";
	_err($help);
}
 
/**
 * Interactively prompts for input without echoing to the terminal.
 * Requires a bash shell and won't work with safe_mode settings (Uses `shell_exec`)
 * from: http://www.sitepoint.com/blogs/2009/05/01/interactive-cli-password-prompt-in-php/
 */
function prompt_silent($prompt = "Enter Password:")
{
	$command = "/usr/bin/env bash -c 'echo OK'";
	if (rtrim(shell_exec($command)) !== 'OK')
	{
		trigger_error("Can't invoke bash");
		return;
	}
	$command = "/usr/bin/env bash -c 'read -s -p \"" . addslashes($prompt) . "\" mypassword && echo \$mypassword'";
	$password = rtrim(shell_exec($command));
	_out('');
	return $password;
}
 
function get_ip()
{
	return substr(`ifconfig | grep 'addr:' | head -n1 | awk '{print $2}' | sed 's/addr://'`, 0, -1);
}
 
 
function _err($msg, $nl=true) { global $err; if($nl) $msg.=PHP_EOL; fwrite($err, $msg); }
function _out($msg) { global $out; fwrite($out, $msg . PHP_EOL); }
function _in() { return trim(fgets(STDIN)); }
 
?>

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , , ,

 
0

PHP to Read Keyword, Title and Description

Posted by paris on Apr 16, 2017 in Code
<?php
if ($_POST)
{
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	echo "
	<table border='1'>
		<thead>
			<tr>
				<th>URL</th>
				<th>Title</th>
				<th>Description</th>
				<th>Keywords</th>
			</tr>
		</thead>
		<tbody>";
	foreach (explode(PHP_EOL, $_POST['textarea']) as $url)
	{
		$url = trim($url);
		if (!preg_match("/^https?:\/\//i", $url))
		{
			continue;
		}
		else
		{
			curl_setopt($ch, CURLOPT_URL, $url);
			$html = curl_exec($ch);
			if (!$html)
				continue;
			$data = parse_page($html);
 
			// secure the data for printing
			$url = htmlentities($url, ENT_QUOTES);
			foreach ($data as $key => $value)
				$data[$key] = htmlentities($value, ENT_QUOTES, "UTF-8");
			echo "<tr>";
			echo "<td>{$url}</td>";
			echo "<td>{$data['title']}</td>";
			echo "<td>{$data['description']}</td>";
			echo "<td> {$data['keywords']}</td>";
			echo "</tr>";
		}
	}
	curl_close($ch);
	echo "
		</tbody>
	</table>";
}
 
 
function parse_page($html)
{
     /* get page's title */
     preg_match("/<title>(.+)<\/title>/siU", $html, $matches);
     $title = $matches ? $matches[1] : null;
     /* get page's keywords */
 
$re="<meta\s+name=['\"]??keywords['\"]??\s+content=['\"]??(.+)['\"]??\s*\/?>";
     preg_match("/$re/siU", $html, $matches);
     $keywords = $matches ? $matches[1] : null;
 
     /* get page's description */
 
$re="<meta\s+name=['\"]??description['\"]??\s+content=['\"]??(.+)['\"]??\s*\/?>";
     preg_match("/$re/siU", $html, $matches);
     $desc = $matches ? $matches[1] : null;
 
     /* parse links */
     $re="<a\s[^>]*href\s*=\s*(['\"]??)([^'\">]*?)\\1[^>]*>(.*)<\/a>";
     preg_match_all("/$re/siU", $html, $matches);
     $links = $matches ? $matches[2] : null;
 
	return array(
		"title" => $title,
		"description" => $desc,
		"keywords" => $keywords,
	);
}
?>
 
<form method="post" action="?">
<textarea name="textarea" cols="45" rows="5"><?php echo @htmlentities($_POST['textarea'], ENT_QUOTES, "UTF-8")?></textarea><br />
<input type="submit" name="button" id="button" value="Submit" />
</form>

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , , , ,

 
0

Export failed startindex cannot be less than zero – Veeam Restore

Posted by paris on Apr 12, 2017 in Random

Just tried to restore a veeam SQL backup , however got the error message

Export failed startindex cannot be less than zero

Changed the location of the MDF/LDF files to local instead of a network path , and this fixed the issues 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , ,

 
0

Reset Skype for Business settings

Posted by paris on Apr 12, 2017 in Random

Had a user who was getting blank screens when opening chat windows for Skype for Business and he couldn’t see text or type in messaging window so I thought I’d reset all the settings :

1)

Close Lync.exe

Close Outlook.exe

2)

Delete Folder : \%AppData%\Roaming\Microsoft\Office\16.0\Lync

Delete in Registry following key:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Lync

3) Reopen Skype for Business

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , , , , , ,

 
0

Mimecast – Connection Attempt – Attempt Greylisted

Posted by paris on Apr 4, 2017 in Random

Find the email in Administration – Gateway – Tracking

See : Connection Attempt

Go to Administration – Monitoring – Connections

See : Attempt Greylisted

Go to : Gateway – Policies – Greylisted

Add new Policy to Overide the existing Policy and Whitelist email address or domain

Get Email sent again

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , ,

 
0

Excel 2010 Crashing on Windows Updates

Posted by paris on Mar 29, 2017 in Research

Microsoft Released a Windows Update : KB3178690 on March 14 which made Excel instable when doing calculations , they released a fix yesterday recently to fix this:

 

https://support.microsoft.com/en-us/help/3191855/march-28-2017-update-for-excel-2010-kb3191855

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , , , , , ,

 
0

How to list all user’s group membership in 365

Posted by paris on Mar 27, 2017 in Random


Get Distinguished Name:

get-Mailbox [Username] | fl Name,Distinguishedname

Groups:

get-group -ResultSize Unlimited -Filter ‘Members -eq “[User Distinguished Name]”‘

Distribution Groups:

Get-DistributionGroup -ResultSize Unlimited -Filter ‘Members -eq “[User Distinguished Name]”‘

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: ,

Copyright © 2017 Welcome to Pariswells.com All rights reserved. Theme by Laptop Geek. Privacy Policy