Monday, 30 September 2013

OpenSSH not connecting to IPv6 host unless 'AddressFamily inet6'

OpenSSH not connecting to IPv6 host unless 'AddressFamily inet6'

I have an OpenSSH client and server. Both are running on Debian 7 with
OpenSSH 6.0. I have a VPN established between the two machines, and the
VPN has functional IPv6. It does not have any IPv4.
The frustrating problem is that I can only connect to the server using
IPv6 if I have set the AddressFamily inet6 option in my ssh_config. I
really don't want to have to set this option. It sure seems like I should
be able to set AddressFamily any and have my connections work.
My Working connection over IPv6 looks like this.
working ssh_config
Host test-fw-01 test-fw-01.example.org
HostKeyAlias test-fw-01.example.org
HostName test-fw-01.example.org
AddressFamily inet6
Working console output
# ssh -v test-fw-01.example.org
OpenSSH_6.0p1 Debian-4, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 122: Applying options for
test-fw-01.example.org
debug1: /etc/ssh/ssh_config line 370: Applying options for *
debug1: Connecting to test-fw-01.example.org. [2607:fa78:1051:2001::1:26]
port 22.
...
Linux test-fw-01 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64
root@test-fw-01:~#
working tcpdump for port 53
# tcpdump -n port 53
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
17:05:27.294506 IP 10.2.4.5.59917 > 10.2.4.51.53: 34233+ AAAA?
test-fw-01.example.org. (59)
17:05:27.295398 IP 10.2.4.51.53 > 10.2.4.5.59917: 34233* 1/0/0 AAAA
2607:fa78:1051:2001::1:26 (87)
17:05:27.295762 IP 10.2.4.5.42664 > 10.2.4.51.53: 42285+ AAAA?
test-fw-01.example.org. (59)
17:05:27.295970 IP 10.2.4.51.53 > 10.2.4.5.42664: 42285 1/0/0 AAAA
2607:fa78:1051:2001::1:26 (87)
When I use AddressFamily any or AddressFamily inet I see this.
broken ssh_config
Host test-fw-01 test-fw-01.example.org
HostKeyAlias test-fw-01.example.org
HostName test-fw-01.example.org
AddressFamily any #supposed to use any?
broken console output
# ssh -v test-fw-01.example.org
OpenSSH_6.0p1 Debian-4, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 122: Applying options for
test-fw-01.example.org
debug1: /etc/ssh/ssh_config line 370: Applying options for *
ssh: Could not resolve hostname test-fw-01.example.org.: Name or service
not known
tcpdump for port 53 on broken connection
# tcpdump -n port 53
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
17:03:30.814876 IP 10.2.4.5.33824 > 10.2.4.51.53: 23711+ A?
test-fw-01.esd189.org. (59)
17:03:30.815276 IP 10.2.4.5.33824 > 10.2.4.51.53: 65399+ AAAA?
test-fw-01.esd189.org. (59)
17:03:30.815746 IP 10.2.4.51.53 > 10.2.4.5.33824: 65399* 1/0/0 AAAA
2607:fa78:1051:2001::1:26 (87)
17:03:35.819158 IP 10.2.4.5.33824 > 10.2.4.51.53: 23711+ A?
test-fw-01.esd189.org. (59)
17:03:39.481119 IP 10.2.4.51.53 > 10.2.4.5.33824: 23711 ServFail 0/0/0 (59)
17:03:40.819636 IP 10.2.4.5.33824 > 10.2.4.51.53: 23711+ A?
test-fw-01.esd189.org. (59)
17:03:45.824898 IP 10.2.4.5.51629 > 10.2.4.51.53: 63582+ A?
test-fw-01.esd189.org.esd189.org. (70)
17:03:45.825252 IP 10.2.4.51.53 > 10.2.4.5.51629: 63582 NXDomain* 0/1/0 (137)
17:03:45.825423 IP 10.2.4.5.51629 > 10.2.4.51.53: 12711+ AAAA?
test-fw-01.esd189.org.esd189.org. (70)
17:03:45.825669 IP 10.2.4.51.53 > 10.2.4.5.51629: 12711 NXDomain* 0/1/0 (137)
17:03:45.825874 IP 10.2.4.5.56246 > 10.2.4.51.53: 64150+ A?
test-fw-01.esd189.org.nwesd.org. (69)
17:03:45.826062 IP 10.2.4.51.53 > 10.2.4.5.56246: 64150 NXDomain* 0/1/0 (139)
17:03:45.826177 IP 10.2.4.5.56246 > 10.2.4.51.53: 21391+ AAAA?
test-fw-01.esd189.org.nwesd.org. (69)
17:03:45.826302 IP 10.2.4.51.53 > 10.2.4.5.56246: 21391 NXDomain* 0/1/0 (139)
17:03:49.621048 IP 10.2.4.51.53 > 10.2.4.5.33824: 23711 ServFail 0/0/0 (59)
Dig output for the test server.
# dig -t aaaa @10.2.4.51 test-fw-01.example.org.
; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> -t aaaa @10.2.4.51
test-fw-01.example.org.
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33798
;; flags: qr aa ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;test-fw-01.example.org. IN AAAA
;; ANSWER SECTION:
test-fw-01.example.org. 0 IN AAAA 2607:fa78:1051:2001::1:26
;; Query time: 1 msec
;; SERVER: 10.2.4.51#53(10.2.4.51)
;; WHEN: Mon Sep 30 17:01:41 2013
;; MSG SIZE rcvd: 87
I will have about 70 hosts using this IPv6 VPN. I want to simply put the
AddressFamily any in the Host * section of my ssh_config and then have my
connections get established. I don't want to have to explicitly list all
my IPv6 hosts in my SSH config. There will be no consistent naming pattern
so I can't do something like Host *.ipv6. I don't want to have to type the
-6 to connect via IPv6. Am I missing something obvious? What do I have to
do to get OpenSSH to connect use the IPv6 address since it is available?

How to crop borders/white spaces from image?

How to crop borders/white spaces from image?

I have a lot of images which have white borders around it. I would like to
crop those borders in one batch, preferably from command line. I believe
that it can be done with ImageMagick, but I couldn't find suitable
command.
I know that it can be done with Windows program named Irfanview with "Auto
crop borders" option, but I am looking for Ubuntu-based and preferably
command-line based solution.

Return odd elements with/without block

Return odd elements with/without block

I'm trying to return odd elements using this method
def odd_elements(array)
retArr = Array.new
array.each_with_index do |item, index|
if block_given?
yield(item)
else
retArr << item
end if index % 2 != 0
end
return retArr
end
so that I could pass both these tests
it "should yield odd elements" do
res = odd_elements([1,2,3,4,5,6])
res.should be_an_instance_of Array
res.should have(3).items
res.should include(2)
res.should include(4)
res.should include(6)
end
it "should yield" do
res = odd_elements([1,2,3,4,5,6]) {|x| x**2 }
res.should be_an_instance_of Array
res.should have(3).items
res[0].should == 4
res[1].should == 16
res[2].should == 36
end
but I'm failing in the second one. It seems I don't understand how to
yield and I didn't manage to get it right in two hours trying so many
different things. Could you please explain me why it does not work?

Looking for a "add input field" button function in my case

Looking for a "add input field" button function in my case

I'm looking for a way to have a button in my form that will add another
text input when clicked, similar to the attachments form in Yahoo Mail.
This way the user can have exactly as many input fields as they need.
Any ideas? Thanks, Luk
Here's my input field : (add.gif is the add.gif add icon for input field &
delete.gid which is remove the input field)
response.Write "<td align='left'><img src=""..\common_pic\add.gif""
border=0><input type='text' value='" & adoRecordset("production_unit") &
"'name='production_unit' size='10'><img src=""..\common_pic\delete.gif""
border=0></td>"

Sunday, 29 September 2013

Allow user post products

Allow user post products

I need to know if I can in prestashop or another eccommerce framework
allow the users to publish his own products.
I ask this because i need that feature to my site.
Thanks in advance !

How do I transform polygon into rect on hover?

How do I transform polygon into rect on hover?

I would like to create an interactive map of the USA. Whenever a user puts
their mouse over a state, I would like the polygon to transform into a
hovering rectangle filled with information that the user can click. Would
I need to create a rect that is normally invisible until a mouse hovers
over it or is there another way to go about this?
<polygon
points="19,133 81,152 67,210 132,309 134,319 134,330 127,340 126,350
81,348 79,339 79,329 69,322 60,310 46,299
35,296 37,285 24,256 22,247 27,239 20,234 20,226 20,221 19,214 9,195
8,183 8,172 8,166 13,162 15,140"/>
<rect x="33" y="220" rx="20" ry="20" width="250" height="150">
<animateTransform attributeName="x" from="10" to="200" dur="3s"
fill="freeze"/>
<animateTransform attributeName="transform" type="scale" from="0"
to="1" dur="3s"/>
</rect>

Console states method not available but it seems like it should be

Console states method not available but it seems like it should be

I've got a rails app and I'm trying to add a thumbnail scroller. It prints
the div, but the js is not working. Here's the file:
<div id="tS2" class="jThumbnailScroller">
<div class="jTscrollerContainer">
<div class="jTscroller">
<% @illustrations.each do |illustration| %>
<% if illustration.aws_image_thumbnail_url %>
<%= link_to
image_tag(illustration.aws_image_thumbnail_url, :title =>
illustration.name), illustration %>
<% else %>
<%= link_to image_tag(illustration.image.url(:thumb),
:title => illustration.name), illustration %>
<% end %>
<% end %>
</div>
</div>
</div>
<script>
jQuery.noConflict();
(function($){
window.onload=function(){
$("#tS2").thumbnailScroller({
scrollerType:"hoverPrecise",
scrollerOrientation:"horizontal",
scrollSpeed:2,
scrollEasing:"easeOutCirc",
scrollEasingAmount:600,
acceleration:4,
scrollSpeed:800,
noScrollCenterSpace:10,
autoScrolling:0,
autoScrollingSpeed:2000,
autoScrollingEasing:"easeInOutQuad",
autoScrollingDelay:500
});
}
})(jQuery);
</script>
Here's the error in the console:
Uncaught TypeError: Object [object Object] has no method
'thumbnailScroller' 138:168
window.onload 138:168
window.onload
Here's the thumbnailScroller method within jquery.thumbnailScroller.js:
(function($){
$.fn.thumbnailScroller=function(options){
var defaults={ //default options
scrollerType:"hoverPrecise", //values: "hoverPrecise",
"hoverAccelerate", "clickButtons"
scrollerOrientation:"horizontal", //values: "horizontal", "vertical"
scrollEasing:"easeOutCirc", //easing type
scrollEasingAmount:800, //value: milliseconds
acceleration:2, //value: integer
scrollSpeed:600, //value: milliseconds
noScrollCenterSpace:0, //value: pixels
autoScrolling:0, //value: integer
autoScrollingSpeed:8000, //value: milliseconds
autoScrollingEasing:"easeInOutQuad", //easing type
autoScrollingDelay:2500 //value: milliseconds
};
And here you can see that that js file is being loaded in to the rails app
(output from chrome developmnet tools 'resources' tab:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
...
<link href="/assets/jquery.thumbnailscroller.css?body=1" media="all"
rel="stylesheet" type="text/css" />
...
<script src="/assets/jquery.thumbnailScroller.js?body=1"
type="text/javascript"></script>
...
</head>
Does anyone see why this method is not available?