SlideShare a Scribd company logo
Service Intergration 
Jang Jaemin 
jaeminj@gmail.com
Openssh + authentication key(1) 
fabio@morpheus:~$ ssh-keygen 
Generating public/private rsa key pair. 
Enter file in which to save the key (/home/fabio/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/fabio/.ssh/id_rsa. 
Your public key has been saved in /home/fabio/.ssh/id_rsa.pub. 
The key fingerprint is: 
44:3e:ef:58:94:15:52:c2:88:ca:ab:21:43:53:3d:42 fabio@morpheus 
fabio@morpheus:~$ 
fabio@morpheus:~$ ssh-keygen -p 
Enter file in which the key is (/home/fabio/.ssh/id_rsa): 
Key has comment '/home/fabio/.ssh/id_rsa' 
Enter new passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved with the new passphrase. 
fabio@morpheus:~$
Openssh + authentication key(2) 
Install the public key on the servers 
fabio@morpheus:~$ ssh-copy-id -i .ssh/id_rsa.pub ornellas@apanela.com 
15 
ornellas@apanela.com's password: 
Now try logging into the machine, with "ssh 'ornellas@apanela.com'", and check in: 
.ssh/authorized_keys 
to make sure we haven't added extra keys that you weren't expecting. 
fabio@morpheus:~$
freesshd(1) 
Overview 
Install and configure FreeSSHd on the server 
Create keys 
configure Putty to connect to the server 
Install FreeSSHd 
Download FreeSSHd from http://www.freesshd.com/?ctt=download 
Double click to start installer on the server 
As a service 
Accept all other defaults
freesshd(2) 
Configure FreeSSHd 
Open FreeSSHd settings (may have to kill the service and start manually to get the GUI) 
SSH tab: 
Max number = 2 
idle = 600 
Authentication tab 
Pub key folder = C:Program Files (x86)freeSSHdkeys 
Password auth = disabled 
Pub key auth = required 
Users tab 
add 
login=chef 
auth = 'Pub key (ssh only)' 
user can use = shell 
click OK
freesshd(3) 
Generate Public and Private keys 
Open PuttyGen 
Click ‘Generate’ 
move the mouse pointer around as instructed to generate the key 
Save a Putty compatible private key 
Click ‘Save private key’ 
Save this to the client PC, Putty will need this 
You should really save with a passphrase for extra security 
Save OpenSSL compatible private key for Chef knife 
‘Conversions’ menu > ‘Export OpenSSH Key’ > save as a *.pem 
Save the public key 
Copy the contents of ‘Public key for pasting into OpenSSH authorized file:’ and paste into a textfile. 
rename this file ‘chef’ (no file extension, the filename must match the user login name created drop this file into the public key folder C:Program Files (x86)freeSSHdkeys on the server.
freesshd(4) 
Connecting with Putty 
Open Putty (or Putty portable) 
Enter the IP address of the server 
Connection type = SSH (obviously!) 
In the left menu tree 
Connection > SSH > Auth > ‘Private key file for authentication:’ > click browse 
Select the private key that was generated above 
Click ‘Open’ 
when prompted ‘login:’ > enter ‘chef’ > hit enter 
If the private key was saved with a passphrase then enter this when prompted 
You should now be connected to the server. 
ssh -o ConnectTimeOut=10 -o Port='22' -o IdentityFile=key/'id_rsa'  
-o GSSAPIAuthentication=no -o PasswordAuthentication=no  
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null  
-o LogLevel=ERROR 'XXX'@'192.168.XXX.XXX'
Sshclient.php 
<? 
$this->cli= parent::newClass("sshclient", $ssh_conf); 
$this->cli->exec( $cmd); 
$data['stdout'] = $this->stdout ; 
$data['stderr'] = $this->stderr; 
?>
JSON, Rest Api , bash, PHP, 
Powershell
Json (Javascript Object Notation) 
{ 
"glossary": { 
"title": "example glossary", 
"GlossDiv": { 
"title": "S", 
"GlossList": { 
"GlossEntry": { 
"ID": "SGML", 
"SortAs": "SGML", 
"GlossTerm": "Standard Generalized Markup Language", 
"Acronym": "SGML", 
"Abbrev": "ISO 8879:1986", 
"GlossDef": { 
"para": "A meta-markup language, used to create markup languages such as DocBook.", 
"GlossSeeAlso": ["GML", "XML"] 
}, 
"GlossSee": "markup" 
} 
} 
} 
} 
}
Restful api 
HTTP Method URI Action 
GET http://[hostname]/todo/api/v1.0/tasks 
Retrieve list of 
tasks 
GET 
http://[hostname]/todo/api/v1.0/tasks/ 
[task_id] 
Retrieve a task 
POST http://[hostname]/todo/api/v1.0/tasks 
Create a new 
task 
PUT 
http://[hostname]/todo/api/v1.0/tasks/ 
[task_id] 
Update an 
existing task 
DELETE 
http://[hostname]/todo/api/v1.0/tasks/ 
[task_id] 
Delete a task
PHP Server Side (1) 
<?php 
switch ($_SERVER['REQUEST_METHOD'] ) { 
case 'PUT': 
case 'POST': 
case 'GET': 
case 'HEAD': 
case 'DELETE': 
case 'OPTIONS': 
break; 
default: 
break; 
} 
?> 
.htaccess 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-s 
RewriteRule ^(.*)$ api.php?rquest=$1 [QSA,NC,L] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^(.*)$ api.php [QSA,NC,L] 
RewriteCond %{REQUEST_FILENAME} -s 
RewriteRule ^(.*)$ api.php [QSA,NC,L] 
</IfModule>
PHP Server Side (2) 
<?php 
$request = file_get_contents('php://input'); 
// return associative array of JSON 
$input = json_decode($request, true); 
$input['request'] = $request; 
$input['rx_datetime'] = date('Y-m-d H:i:s') ; 
header("Content-type: application/json"); 
echo json_encode($input); 
?>
Bash 
curl -i -X POST -H "Content-Type: application/json ; charset=UTF-8"  
-d '{"username":"xyz","password":"xyz"}' http://localhost:3000/api/login 
curl -i -d @credentials.json -H "Content-Type: application/json"  
http://localhost:3000/api/login 
-X [PUT | POST | GET | DELETE] 
http://blogs.plexibus.com/2010/04/12/rest-esting-with-curl-file-handling/
PHP 
<? 
$data = array("name" => "Hagrid", "age" => "36"); 
$data_string = json_encode($data); 
$ch = curl_init('http://api.local/rest/users'); 
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 
'Content-Type: application/json', 
'Content-Length: ' . strlen($data_string)) 
); 
$result = curl_exec($ch, true); 
curl_Close($ch) 
$data = json_decode($result, true) ; 
print_r($data) 
?>
Powershell Client(1) 
http://www.powershellcookbook.com/recipe/Vlhv/interact-with-rest-based-web-apis 
Invoke-RestMethod cmdlet 
PS > $url = "https://api.stackexchange.com/2.0/questions/unanswered" + 
"?order=desc&sort=activity&tagged=powershell&pagesize=10&site=stackoverflow" 
PS > $result = Invoke-RestMethod $url 
PS > $result.Items | Foreach-Object { $_.Title; $_.Link; "" } 
PS> $contact = @{ 
first_name="Jack"; 
last_name="Smith"; 
emails=@{preferred="jsmith@contoso.com";business="Jack.Smith@contoso.com"} 
} | ConvertTo-Json 
PS> Invoke-RestMethod -Uri "$ApiUri/me/contacts?access_token=$AccessToken" 
-Method Post -ContentType "application/json" -Body $contact
Powershell Client(2) 
$url = "http://www.seismi.org/api/eqs" 
$request = [System.Net.WebRequest]::Create($url) 
$request.Method="Get" 
$response = $request.GetResponse() 
$requestStream = $response.GetResponseStream() 
$readStream = New-Object System.IO.StreamReader $requestStream 
$data=$readStream.ReadToEnd() 
if($response.ContentType -match "application/xml") { 
$results = [xml]$data 
} elseif($response.ContentType -match "application/json") { 
$results = $data | ConvertFrom-Json 
} else { 
try { 
$results = [xml]$data 
} catch { 
$results = $data | ConvertFrom-Json 
} 
} 
$results

More Related Content

What's hot

preventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabadpreventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabad
Ravi Rajput
 
The Joy of Smartmatch
The Joy of SmartmatchThe Joy of Smartmatch
The Joy of SmartmatchAndrew Shitov
 
ZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 VersionZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 Version
Ian Barber
 
Creating a keystroke logger in unix shell scripting
Creating a keystroke logger in unix shell scriptingCreating a keystroke logger in unix shell scripting
Creating a keystroke logger in unix shell scripting
Dan Morrill
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The Answer
Ian Barber
 
News of the Symfony2 World
News of the Symfony2 WorldNews of the Symfony2 World
News of the Symfony2 WorldFabien Potencier
 
Php functions
Php functionsPhp functions
Php functions
JIGAR MAKHIJA
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
Ian Barber
 
Not Really PHP by the book
Not Really PHP by the bookNot Really PHP by the book
Not Really PHP by the book
Ryan Kilfedder
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
Eleanor McHugh
 
Redis for your boss
Redis for your bossRedis for your boss
Redis for your boss
Elena Kolevska
 
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Andrew Lavers
 
On secure application of PHP wrappers
On secure application  of PHP wrappersOn secure application  of PHP wrappers
On secure application of PHP wrappersPositive Hack Days
 
Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0
Elena Kolevska
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
Ross Tuck
 
Whispered secrets
Whispered secretsWhispered secrets
Whispered secrets
Eleanor McHugh
 
User registration and login using stored procedure in php
User registration and login using stored procedure in phpUser registration and login using stored procedure in php
User registration and login using stored procedure in php
PHPGurukul Blog
 
神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)
guregu
 

What's hot (20)

preventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabadpreventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabad
 
The Joy of Smartmatch
The Joy of SmartmatchThe Joy of Smartmatch
The Joy of Smartmatch
 
ZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 VersionZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 Version
 
Creating a keystroke logger in unix shell scripting
Creating a keystroke logger in unix shell scriptingCreating a keystroke logger in unix shell scripting
Creating a keystroke logger in unix shell scripting
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The Answer
 
News of the Symfony2 World
News of the Symfony2 WorldNews of the Symfony2 World
News of the Symfony2 World
 
Php functions
Php functionsPhp functions
Php functions
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Perl6 grammars
Perl6 grammarsPerl6 grammars
Perl6 grammars
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
 
Not Really PHP by the book
Not Really PHP by the bookNot Really PHP by the book
Not Really PHP by the book
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
 
Redis for your boss
Redis for your bossRedis for your boss
Redis for your boss
 
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
 
On secure application of PHP wrappers
On secure application  of PHP wrappersOn secure application  of PHP wrappers
On secure application of PHP wrappers
 
Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
 
Whispered secrets
Whispered secretsWhispered secrets
Whispered secrets
 
User registration and login using stored procedure in php
User registration and login using stored procedure in phpUser registration and login using stored procedure in php
User registration and login using stored procedure in php
 
神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)
 

Viewers also liked

Wireless Feature Update
Wireless Feature UpdateWireless Feature Update
Wireless Feature Update
Cisco Canada
 
Enterprise Network Design and Deployment
Enterprise Network Design and Deployment Enterprise Network Design and Deployment
Enterprise Network Design and Deployment
Sandeep Yadav
 
Overview of web services
Overview of web servicesOverview of web services
Overview of web services
People Strategists
 
Introduction to Patterns in WebSphere Message Broker
Introduction to Patterns in WebSphere Message BrokerIntroduction to Patterns in WebSphere Message Broker
Introduction to Patterns in WebSphere Message BrokerAnt Phillips
 
WebSphere Message Broker Training | IBM WebSphere Message Broker Online Training
WebSphere Message Broker Training | IBM WebSphere Message Broker Online TrainingWebSphere Message Broker Training | IBM WebSphere Message Broker Online Training
WebSphere Message Broker Training | IBM WebSphere Message Broker Online Training
ecorptraining2
 
WebSphere Message Broker installation guide
WebSphere Message Broker installation guideWebSphere Message Broker installation guide
WebSphere Message Broker installation guide
Vijaya Raghava Vuligundam
 
WebSphere Message Broker Training Agenda
WebSphere Message Broker Training AgendaWebSphere Message Broker Training Agenda
WebSphere Message Broker Training Agenda
Vijaya Raghava Vuligundam
 
WebSphere Message Broker Application Development Training
WebSphere Message Broker Application Development TrainingWebSphere Message Broker Application Development Training
WebSphere Message Broker Application Development Training
Vijaya Raghava Vuligundam
 
Introduction to WebSphere Message Broker
Introduction to WebSphere Message BrokerIntroduction to WebSphere Message Broker
Introduction to WebSphere Message BrokerAnt Phillips
 

Viewers also liked (10)

Wireless Feature Update
Wireless Feature UpdateWireless Feature Update
Wireless Feature Update
 
Enterprise Network Design and Deployment
Enterprise Network Design and Deployment Enterprise Network Design and Deployment
Enterprise Network Design and Deployment
 
Overview of web services
Overview of web servicesOverview of web services
Overview of web services
 
Introduction to Patterns in WebSphere Message Broker
Introduction to Patterns in WebSphere Message BrokerIntroduction to Patterns in WebSphere Message Broker
Introduction to Patterns in WebSphere Message Broker
 
WebSphere Message Broker Training | IBM WebSphere Message Broker Online Training
WebSphere Message Broker Training | IBM WebSphere Message Broker Online TrainingWebSphere Message Broker Training | IBM WebSphere Message Broker Online Training
WebSphere Message Broker Training | IBM WebSphere Message Broker Online Training
 
WebSphere Message Broker installation guide
WebSphere Message Broker installation guideWebSphere Message Broker installation guide
WebSphere Message Broker installation guide
 
WebSphere Message Broker Training Agenda
WebSphere Message Broker Training AgendaWebSphere Message Broker Training Agenda
WebSphere Message Broker Training Agenda
 
Ibm message broker basic
Ibm message broker basicIbm message broker basic
Ibm message broker basic
 
WebSphere Message Broker Application Development Training
WebSphere Message Broker Application Development TrainingWebSphere Message Broker Application Development Training
WebSphere Message Broker Application Development Training
 
Introduction to WebSphere Message Broker
Introduction to WebSphere Message BrokerIntroduction to WebSphere Message Broker
Introduction to WebSphere Message Broker
 

Similar to Service intergration

PHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source ProjectPHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source Project
xsist10
 
PHP code examples
PHP code examplesPHP code examples
PHP code examples
programmingslides
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
Yusuke Wada
 
Introduction to devsecdotio
Introduction to devsecdotioIntroduction to devsecdotio
Introduction to devsecdotio
Bram Vogelaar
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Arc & Codementor
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
Elizabeth Smith
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploySimon Su
 
How to send files to remote server via ssh in php
How to send files to remote server via ssh in phpHow to send files to remote server via ssh in php
How to send files to remote server via ssh in php
Andolasoft Inc
 
Legacy applications - 4Developes konferencja, Piotr Pasich
Legacy applications  - 4Developes konferencja, Piotr PasichLegacy applications  - 4Developes konferencja, Piotr Pasich
Legacy applications - 4Developes konferencja, Piotr PasichPiotr Pasich
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
Ismail Mukiibi
 
php part 2
php part 2php part 2
php part 2
Shagufta shaheen
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vuln
Sandro Zaccarini
 
Tomáš Čorej - OpenSSH
Tomáš Čorej - OpenSSHTomáš Čorej - OpenSSH
Tomáš Čorej - OpenSSHwebelement
 
PHP and Databases
PHP and DatabasesPHP and Databases
PHP and Databases
Things Lab
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014
Puppet
 
Php talk
Php talkPhp talk
Php talk
Jamil Ramsey
 
Ssh cookbook
Ssh cookbookSsh cookbook
Ssh cookbook
Jean-Marie Renouard
 

Similar to Service intergration (20)

PHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source ProjectPHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source Project
 
PHP code examples
PHP code examplesPHP code examples
PHP code examples
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Php Security
Php SecurityPhp Security
Php Security
 
Introduction to devsecdotio
Introduction to devsecdotioIntroduction to devsecdotio
Introduction to devsecdotio
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploy
 
How to send files to remote server via ssh in php
How to send files to remote server via ssh in phpHow to send files to remote server via ssh in php
How to send files to remote server via ssh in php
 
secure php
secure phpsecure php
secure php
 
Legacy applications - 4Developes konferencja, Piotr Pasich
Legacy applications  - 4Developes konferencja, Piotr PasichLegacy applications  - 4Developes konferencja, Piotr Pasich
Legacy applications - 4Developes konferencja, Piotr Pasich
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
php part 2
php part 2php part 2
php part 2
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vuln
 
Tomáš Čorej - OpenSSH
Tomáš Čorej - OpenSSHTomáš Čorej - OpenSSH
Tomáš Čorej - OpenSSH
 
PHP and Databases
PHP and DatabasesPHP and Databases
PHP and Databases
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014
 
Php talk
Php talkPhp talk
Php talk
 
Ssh cookbook v2
Ssh cookbook v2Ssh cookbook v2
Ssh cookbook v2
 
Ssh cookbook
Ssh cookbookSsh cookbook
Ssh cookbook
 

Recently uploaded

Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
VivekSinghShekhawat2
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
Gal Baras
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 

Recently uploaded (20)

Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 

Service intergration

  • 1. Service Intergration Jang Jaemin jaeminj@gmail.com
  • 2. Openssh + authentication key(1) fabio@morpheus:~$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/fabio/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/fabio/.ssh/id_rsa. Your public key has been saved in /home/fabio/.ssh/id_rsa.pub. The key fingerprint is: 44:3e:ef:58:94:15:52:c2:88:ca:ab:21:43:53:3d:42 fabio@morpheus fabio@morpheus:~$ fabio@morpheus:~$ ssh-keygen -p Enter file in which the key is (/home/fabio/.ssh/id_rsa): Key has comment '/home/fabio/.ssh/id_rsa' Enter new passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved with the new passphrase. fabio@morpheus:~$
  • 3. Openssh + authentication key(2) Install the public key on the servers fabio@morpheus:~$ ssh-copy-id -i .ssh/id_rsa.pub ornellas@apanela.com 15 ornellas@apanela.com's password: Now try logging into the machine, with "ssh 'ornellas@apanela.com'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. fabio@morpheus:~$
  • 4. freesshd(1) Overview Install and configure FreeSSHd on the server Create keys configure Putty to connect to the server Install FreeSSHd Download FreeSSHd from http://www.freesshd.com/?ctt=download Double click to start installer on the server As a service Accept all other defaults
  • 5. freesshd(2) Configure FreeSSHd Open FreeSSHd settings (may have to kill the service and start manually to get the GUI) SSH tab: Max number = 2 idle = 600 Authentication tab Pub key folder = C:Program Files (x86)freeSSHdkeys Password auth = disabled Pub key auth = required Users tab add login=chef auth = 'Pub key (ssh only)' user can use = shell click OK
  • 6. freesshd(3) Generate Public and Private keys Open PuttyGen Click ‘Generate’ move the mouse pointer around as instructed to generate the key Save a Putty compatible private key Click ‘Save private key’ Save this to the client PC, Putty will need this You should really save with a passphrase for extra security Save OpenSSL compatible private key for Chef knife ‘Conversions’ menu > ‘Export OpenSSH Key’ > save as a *.pem Save the public key Copy the contents of ‘Public key for pasting into OpenSSH authorized file:’ and paste into a textfile. rename this file ‘chef’ (no file extension, the filename must match the user login name created drop this file into the public key folder C:Program Files (x86)freeSSHdkeys on the server.
  • 7. freesshd(4) Connecting with Putty Open Putty (or Putty portable) Enter the IP address of the server Connection type = SSH (obviously!) In the left menu tree Connection > SSH > Auth > ‘Private key file for authentication:’ > click browse Select the private key that was generated above Click ‘Open’ when prompted ‘login:’ > enter ‘chef’ > hit enter If the private key was saved with a passphrase then enter this when prompted You should now be connected to the server. ssh -o ConnectTimeOut=10 -o Port='22' -o IdentityFile=key/'id_rsa' -o GSSAPIAuthentication=no -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR 'XXX'@'192.168.XXX.XXX'
  • 8. Sshclient.php <? $this->cli= parent::newClass("sshclient", $ssh_conf); $this->cli->exec( $cmd); $data['stdout'] = $this->stdout ; $data['stderr'] = $this->stderr; ?>
  • 9. JSON, Rest Api , bash, PHP, Powershell
  • 10. Json (Javascript Object Notation) { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } }
  • 11. Restful api HTTP Method URI Action GET http://[hostname]/todo/api/v1.0/tasks Retrieve list of tasks GET http://[hostname]/todo/api/v1.0/tasks/ [task_id] Retrieve a task POST http://[hostname]/todo/api/v1.0/tasks Create a new task PUT http://[hostname]/todo/api/v1.0/tasks/ [task_id] Update an existing task DELETE http://[hostname]/todo/api/v1.0/tasks/ [task_id] Delete a task
  • 12. PHP Server Side (1) <?php switch ($_SERVER['REQUEST_METHOD'] ) { case 'PUT': case 'POST': case 'GET': case 'HEAD': case 'DELETE': case 'OPTIONS': break; default: break; } ?> .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)$ api.php?rquest=$1 [QSA,NC,L] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.*)$ api.php [QSA,NC,L] RewriteCond %{REQUEST_FILENAME} -s RewriteRule ^(.*)$ api.php [QSA,NC,L] </IfModule>
  • 13. PHP Server Side (2) <?php $request = file_get_contents('php://input'); // return associative array of JSON $input = json_decode($request, true); $input['request'] = $request; $input['rx_datetime'] = date('Y-m-d H:i:s') ; header("Content-type: application/json"); echo json_encode($input); ?>
  • 14. Bash curl -i -X POST -H "Content-Type: application/json ; charset=UTF-8" -d '{"username":"xyz","password":"xyz"}' http://localhost:3000/api/login curl -i -d @credentials.json -H "Content-Type: application/json" http://localhost:3000/api/login -X [PUT | POST | GET | DELETE] http://blogs.plexibus.com/2010/04/12/rest-esting-with-curl-file-handling/
  • 15. PHP <? $data = array("name" => "Hagrid", "age" => "36"); $data_string = json_encode($data); $ch = curl_init('http://api.local/rest/users'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)) ); $result = curl_exec($ch, true); curl_Close($ch) $data = json_decode($result, true) ; print_r($data) ?>
  • 16. Powershell Client(1) http://www.powershellcookbook.com/recipe/Vlhv/interact-with-rest-based-web-apis Invoke-RestMethod cmdlet PS > $url = "https://api.stackexchange.com/2.0/questions/unanswered" + "?order=desc&sort=activity&tagged=powershell&pagesize=10&site=stackoverflow" PS > $result = Invoke-RestMethod $url PS > $result.Items | Foreach-Object { $_.Title; $_.Link; "" } PS> $contact = @{ first_name="Jack"; last_name="Smith"; emails=@{preferred="jsmith@contoso.com";business="Jack.Smith@contoso.com"} } | ConvertTo-Json PS> Invoke-RestMethod -Uri "$ApiUri/me/contacts?access_token=$AccessToken" -Method Post -ContentType "application/json" -Body $contact
  • 17. Powershell Client(2) $url = "http://www.seismi.org/api/eqs" $request = [System.Net.WebRequest]::Create($url) $request.Method="Get" $response = $request.GetResponse() $requestStream = $response.GetResponseStream() $readStream = New-Object System.IO.StreamReader $requestStream $data=$readStream.ReadToEnd() if($response.ContentType -match "application/xml") { $results = [xml]$data } elseif($response.ContentType -match "application/json") { $results = $data | ConvertFrom-Json } else { try { $results = [xml]$data } catch { $results = $data | ConvertFrom-Json } } $results