(phpファイルとして解釈されてしまうとパラメータとか諸々展開されてしまうので、正確な差分が取れない)
ただ、差分を確認するためにいちいちテキストファイルにして比較とかはしたくなかったので、
.htaccessファイルを使って、phpファイルはテキストファイルとして解釈するようにした。
その設定がこちら。
php_flag engine off
AddType text/plain php
php_flag engine off
AddType text/plain php
$ vagrant halt
An action 'halt' was attempted on the machine 'default',
but another process is already executing an action on the machine.
Vagrant locks each machine for access by only one process at a time.
Please wait until the other Vagrant process finishes modifying this
machine, then try again.
If you believe this message is in error, please check the process
listing for any "ruby" or "vagrant" processes and kill them. Then
try again.
$ vagrant destroy
Vagrant is attempting to interface with the UI in a way that requires
a TTY. Most actions in Vagrant that require a TTY have configuration
switches to disable this requirement. Please do that or run Vagrant
with TTY.
$ vagrant destroy --force
==> default: Destroying VM and associated drives...
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos64-100g'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vm-test
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 => 2231 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2231
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/cygwin64/home/user_name/VirtualBoxMachines/vm-test
$ ansible-playbook setup.yml
PLAY [vm-grp] *************************************************************
GATHERING FACTS ***************************************************************
fatal: [vm] => SSH Error: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
while connecting to 192.168.33.10:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
TASK: [check selinux off] *****************************************************
FATAL: no hosts matched or all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/home/user_name/setup.retry
vm : ok=0 changed=0 unreachable=1 failed=0
Host vm-test
HostName 192.168.33.10
Port 22
User vagrant
#IdentityFile C:\Users\user_name\.vagrant.d\insecure_private_key <- コメントアウト
IdentityFile /home/user_name/VirtualBoxMachine/vm1/.vagrant/machines/default/virtualbox/private_key <- 追記
$ ansible-playbook setup.yml
PLAY [vm-grp] *************************************************************
GATHERING FACTS ***************************************************************
fatal: [vm] => SSH Error: while connecting to 192.168.33.10:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
TASK: [check selinux off] *****************************************************
FATAL: no hosts matched or all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/home/user_name/setup.retry
vm : ok=0 changed=0 unreachable=1 failed=0
~/.ssh -> 700
~/.ssh/config -> 744
.vagrant/machines/default/virtualbox/private_key -> 700
<?php
include_once 'oauth.php';
$consumerKey = 'XXXXXXXXXXXX';
$consumerSecret = 'XXXXXXXXXXXX';
$accessToken = null;
$method = 'GET';
$url = 'http://XXXX/XXX.php';
$request_params = array(
'a' => 1,
'b' => 2
);
$OAuthConsumer = new OAuthConsumer($consumerKey, $consumerSecret);
$OAuthSignatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
$OAuthRequest = OAuthRequest::from_consumer_and_token($OAuthConsumer, $accessToken, $method, $url, $request_params);
$OAuthRequest->sign_request($OAuthSignatureMethod , $OAuthConsumer, $accessToken);
list($buf, $OAuthAuthorization) = explode(':', $OAuthRequest->to_header(''), 2);
$OAuthAuthorizationHeader = array(
'Authorization:'.$OAuthAuthorization,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url.'?'.http_build_query($request_params));
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $OAuthAuthorizationHeader);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$res = curl_exec($ch);
<?php
$consumerKey = 'XXXXXXXXXXXX';
$consumerSecret = 'XXXXXXXXXXXX';
$accessToken = null;
$method = 'POST';
$url = 'http://XXXX/XXX.php';
$request_params = array(
'a' => 1,
'b' => 2
);
$OAuthConsumer = new OAuthConsumer($consumerKey, $consumerSecret);
$OAuthSignatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
$OAuthRequest = OAuthRequest::from_consumer_and_token($OAuthConsumer, $accessToken, $method, $url, $request_params);
$OAuthRequest->sign_request($OAuthSignatureMethod , $OAuthConsumer, $accessToken);
list($buf, $OAuthAuthorization) = explode(':', $OAuthRequest->to_header(''), 2);
$OAuthAuthorizationHeader = array(
'Authorization:'.$OAuthAuthorization,
'Content-Type: application/x-www-form-urlencoded',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $OAuthAuthorizationHeader);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($request_params));
$res = curl_exec($ch);
<?php
include_once 'oauth.php';
$OAuthConsumerKey = 'XXXXXXXXXXXX';
$OAuthConsumerSecret = 'XXXXXXXXXXXX';
$request = OAuthRequest::from_request();
$OAuthSignatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
$consumer = new OAuthConsumer($OAuthConsumerKey, $OAuthConsumerSecret);
if ($OAuthSignatureMethod->check_signature($request, $consumer, null, $request->get_parameter('oauth_signature'))) {
echo 'This signature is OK.';
} else {
echo 'This signature is NG.';
}