The syntom
While:
Installing nginx.
Getting option config:PS1.
Error: The option name in substitution, ${debian_chroot:+($debian_chroot)},
has invalid characters.
While:
Installing nginx.
Getting option config:PS1.
Error: The option name in substitution, ${debian_chroot:+($debian_chroot)},
has invalid characters.
su -c "iptables -tnat -F" su -c "iptables -tnat -A POSTROUTING -s 192.168.0.0/16 -o ccmni0 -j MASQUERADE" su -c "echo 1 > /proc/sys/net/ipv4/ip_forward"You can write the script using "adb shell" and "vi". Save the script to /sdcard. I called it "tether_enable". You could also write it using an Android Text Editor like Jota or using a Terminal with vi or some other native commands like cat, etc.
![]() |
| Select the script |
![]() |
| Mark as favorite, root and net |
![]() |
| Locate the tethering widget |
![]() |
| Hold and drag it to the home screen |
![]() |
| Choose Wifi tether |
![]() |
| Widget is on home screen |
MyType ::= SEQUENCE {
myObjectIdentifier OBJECT IDENTIFIER,
myNumbers SEQUENCE OF MyNumber,
myMessage VisibleString
}
MyNumber ::= INTEGER (0..255)
openssl x509 -in cert.pem -out cert.der -outform DER
Certificate ::= SEQUENCE {
tbsCertificate TBSCertificate,
signatureAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING }
TBSCertificate ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
serialNumber CertificateSerialNumber,
signature AlgorithmIdentifier,
issuer Name,
validity Validity,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo,
issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
-- If present, version shall be v2 or v3
subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
-- If present, version shall be v2 or v3
extensions [3] EXPLICIT Extensions OPTIONAL
-- If present, version shall be v3
}
The extensions defined for X.509 v3 certificates provide methods for associating additional attributes with users or public keys and for managing the certification hierarchy.
The subject alternative names extension allows additional identities to be bound to the subject of the certificate. Defined options include an Internet electronic mail address, a DNS name, an IP address, and a uniform resource identifier (URI). Other options exist, including completely local definitions. Multiple name forms, and multiple instances of each name form, may be included. Whenever such identities are to be bound into a certificate, the subject alternative name (or issuer alternative name) extension MUST be used. Because the subject alternative name is considered to be definitiviely bound to the public key, all parts of the subject alternative name MUST be verified by the CA.
#
# PKCS#12 syntax
#
# ASN.1 source from:
# ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12.asn
#
# Sample captures could be obtained with "openssl pkcs12" command
#
from pyasn1.type import tag, namedtype, namedval, univ, constraint
from pyasn1_modules.rfc2459 import *
from pyasn1_modules import rfc2251
class Attributes(univ.SetOf):
componentType = rfc2251.Attribute()
class Version(univ.Integer): pass
class CertificationRequestInfo(univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType('version', Version()),
namedtype.NamedType('subject', Name()),
namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()),
namedtype.NamedType('attributes',
Attributes().subtype(implicitTag=tag.Tag(
tag.tagClassContext, tag.tagFormatConstructed, 0)))
)
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.der -days 1000 -outform DER -nodes
$ sudo pip install pyasn1
Downloading/unpacking pyasn1
Downloading pyasn1-0.1.7.tar.gz (68kB): 68kB downloaded
Running setup.py egg_info for package pyasn1
Installing collected packages: pyasn1
Running setup.py install for pyasn1
Successfully installed pyasn1
Cleaning up...
$ sudo pip install pyasn1-modules
Downloading/unpacking pyasn1-modules
Downloading pyasn1-modules-0.0.5.tar.gz
Running setup.py egg_info for package pyasn1-modules
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.4 in /Library/Python/2.7/site-packages (from pyasn1-modules)
Installing collected packages: pyasn1-modules
Running setup.py install for pyasn1-modules
Successfully installed pyasn1-modules
Cleaning up...
$ python
>>> from pyasn1.codec.der.decoder import decode
>>> from pyasn1_modules import rfc2459
>>> derData = file('cert.der', 'rb').read()
>>> cert, rest = decode(derData, asn1Spec=rfc2459.Certificate())
>>> print cert.prettyPrint()
Certificate:
tbsCertificate=TBSCertificate:
version='v3'
serialNumber=1019333950
signature=AlgorithmIdentifier:
algorithm=1.2.840.113549.1.1.5
parameters=0x0500
issuer=Name:
=RDNSequence:
RelativeDistinguishedName:
AttributeTypeAndValue:
type=2.5.4.6
value=0x13024553
RelativeDistinguishedName:
AttributeTypeAndValue:
type=2.5.4.10
value=0x1304464e4d54
RelativeDistinguishedName:
AttributeTypeAndValue:
type=2.5.4.11
value=0x130f464e4d5420436c6173652032204341
validity=Validity:
notBefore=Time:
utcTime=100903074356Z
notAfter=Time:
utcTime=130903074356Z
subject=Name:
=RDNSequence:
RelativeDistinguishedName:
AttributeTypeAndValue:
type=2.5.4.6
value=0x13024553
RelativeDistinguishedName:
AttributeTypeAndValue:
type=2.5.4.10
value=0x1304464e4d54
RelativeDistinguishedName:
...
>>> cert = cert['tbsCertificate'] # just get the core part of the certificate
>>> subject = cert['subject']
>>> rdnsequence = subject[0] # the subject is only composed by one component
>>> for rdn in rdnsequence:
... oid, value = rdn[0] # rdn only has 1 component: (object id, value) tuple
... print oid, ':', str(value)
...
2.5.4.6 : ES
2.5.4.10 : FNMT
2.5.4.11 : FNMT Clase 2 CA
2.5.4.11 : 703002474
2.5.4.3 : 8NOMBRE REVILLA DERKSEN ALEJANDRO ERNESTO - NIF ...
$ openssl x509 -in ub1204/svn/pyx509/exampledata/cert.der -inform DER -subject -noout
subject= /C=ES/O=FNMT/OU=FNMT Clase 2 CA/OU=703002474/CN=NOMBRE REVILLA DERKSEN ALEJANDRO ERNESTO - NIF ...
./x509_parse exampledata/cert.der
=== X509 Certificate ===
X.509 version: 3 (0x2)
Serial no: 0x3cc1cd3e
Signature algorithm: SHA1/RSA
Issuer: C=ES, O=FNMT, OU=FNMT Clase 2 CA
Validity:
Not Before: 2010-09-03 07:43:56
Not After: 2013-09-03 07:43:56
Subject: C=ES, CN=NOMBRE REVILLA DERKSEN ALEJANDRO ERNESTO - NIF ..., O=FNMT, OU=703002474, OU=FNMT Clase 2 CA
Subject Public Key Info:
Public Key Algorithm: RSA
Modulus: (b64)
...
Exponent: 65537
Extensions:
...
Subject Alternative Name: is_critical: False
email: ernesto.revilla@gmail.com
dirName: Apellido1=REVILLA, Apellido2=DERKSEN, DNI=..., Nombre=ALEJANDRO ERNESTO
...
=== EOF X509 Certificate ===
This seems to give us a much more usable output and may be a good alternative to parsing OpenSSL output.
= PKCS7 signature block =
PKCS7 Version: 1
== Encapsulated content Info ==
ContentType: data
Content: None
== Signer info ==
Certificate serial number: 0x89bbba0749918db3
Issuer: C=es, ...
Digest Algorithm: SHA-1
Signature: (b64)
gXpU5jadSY+FVBoeCdvn1/m5bzEMzN3ZKuiN9sPk79iJgX+DDDOMH6K5Scnh
wLL7nHRT983GlhTY1A2QE1VryWTbuBGK08oalKIM8QZs3UfZa5dXsx83eS4b
/M/icfIf6CHu1fWZ4VBJ4mva2N3nh2r0FV09bvuj1bodl4kXJAs=
Attributes:
contentType: data
serialNumber: 0x89bbba0749918db3
signingTime: 2011-10-04 14:36:51
messageDigest: y8OX3qoZBY4/Cc6/w0xuRqzzQzU=
signingCertificate: 0x89bbba0749918db3
== EOF Signer info ==
=== X509 Certificate ===
X.509 version: 3 (0x2)
Serial no: 0x89bbba0749918db3
Signature algorithm: SHA1/RSA
Issuer: C=es, ...
Validity:
Not Before: 2011-09-17 00:00:00
Not After: 2031-09-12 11:09:54
Subject: C=es, CN=REVILLA DERKSEN, ALEJANDRO ERNESTO...
Subject Public Key Info:
Public Key Algorithm: RSA
Modulus: (b64)
AOs2/Pip46F5BJPBQd/5bwS1HO97lJ74ZjJfGtvEH831d6Ld4bsF9jdFOjlx
mv+kxYNFryZZFWM109+zng/PiU8NZPRZt4XlTO7qb3r2g5AR17EQWJNokQto
s3w3cXSEDPxxFmTHEhGarTLddEg2o1v9/UIlMS8mzHej0Q9uBuuh
Exponent: 65537
Extensions:
Authority Key Id Ext: is_critical: False
key id: (b64)
AiuDvGb4bxWnCsZJ9/RHNrRhSxk=
Basic Constraints Ext: is_critical: False
CA: False
max_path_len: None
Subject Alternative Name: is_critical: False
email: tramitacion.electronica@telefonica.es
dirName: Apellido1=REVILLA, Apellido2=DERKSEN, DNI=..., Nombre=ALEJANDRO ERNESTO
Subject Key Id: is_critical: False
key id: (b64)
Zh0L6JJSz+GgiCimE4U7s5PHH+g=
Signature: (b64)
k1OVoQyNZv0ASor/bitI6JgJm37piIheIzwdKSgEtKeQuIXfA5V5rclPVUg7
PW71JTQyY8iDbvJB4sb4FH5XyjOXUmf3CXiG7ppS48cQXSf1k3wHWZB0neTE
V3XxZnPjqWvv0x0ScsOGKxpHjyy8SFZMKR6tnfQ4TXfHMxid7dw=
=== EOF X509 Certificate ===
Some code saved some wrong (custom) property values but you have not the XML extensions to edit the values with Alfresco-Explorer or Alfresco Share.
If you haven't easy_install or python pip, please install this first. For Ubuntu/Debian this would be:
sudo apt-get install python-pip
So here we go:
sudo pip install cmislib
python
import cmislib
URL = 'http://localhost:8080/alfresco/cmis'
USERNAME = 'admin'
PASSWORD ='admin'
client = cmislib.CmisClient(URL, USERNAME, PASSWORD)
repo = client.getDefaultRepository()
doc = repo.getObjectByPath('/path/to/doc_or_folder')
doc.updateProperties({'propertyname': 'propertyvalue'})
The property value should have changed.
With some cloud projects in mind and some virtual hardware estimations I was curious to see if it's possible to hot plug virtual memory and CPU to Ubuntu guests. Here is what I discovered.
Check current CPUs:
# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 37
model name : Intel(R) Xeon(R) CPU L5640 @ 2.27GHz
stepping : 1
cpu MHz : 2266.747
cache size : 12288 KB
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc up arch_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat
bogomips : 4533.49
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
Now, add the virtual CPUs directly from the vCloud control panel (from the hardware tab of the VM properties). Initially, these new CPUs are offline. To active each new CPU we have to:
echo 1 > /sys/devices/system/cpu/cpuX/online
where X is the number of the new CPU.
Check that new CPUs are online:
# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 37
model name : Intel(R) Xeon(R) CPU L5640 @ 2.27GHz
stepping : 1
cpu MHz : 2266.747
cache size : 12288 KB
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc up arch_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat
bogomips : 4533.49
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 37
model name : Intel(R) Xeon(R) CPU L5640 @ 2.27GHz
stepping : 1
cpu MHz : 2266.747
cache size : 12288 KB
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc up arch_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat
bogomips : 4533.49
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
You can use the script provided in this article:
http://communities.vmware.com/docs/DOC-10493This enables automatically all new vCPUs.
# modprobe acpi_memhotplug
Let's check current memory first:
# free -m
total used free shared buffers cached
Mem: 997 112 885 0 10 42
-/+ buffers/cache: 59 937
Swap: 2015 0 2015
Add the memory through vCloud (or VMWare vSphere Infrastructure Cliente - VCLI). Although the kernel will have detected the new memory, it's still not available. We have to enable it in the same way we did it before with virtual CPUs:
echo 1 > /sys/devices/system/memory/memoryX/online
where X is the number of the new memory block.
After the memory blocks have been enabled, we can check the available memory:
# free -m
total used free shared buffers cached
Mem: 1893 141 1752 0 10 42
-/+ buffers/cache: 88 1805
Swap: 2015 0 2015
As with CPU hot plug, you can use the script provided in this article:
http://communities.vmware.com/docs/DOC-10492This enables automatically all new memory blocks.
It's easy to add new resources on the fly but it may not be that easy to remove them.
# install dependencies sudo apt-get install build-essential libpcre3-dev libxml2-dev libxslt1-dev cd mkdir -p src; cd src wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz tar xzf openssl* cd openssl* ./config shared zlib-dynamic make # This installs everything in /usr/local/ssl
sudo make install
wget http://nginx.org/download/nginx-1.2.5.tar.gz tar xzf nginx* cd nginx* # edit auto/lib/openssl/conf manually or use sed sed -i -e 's|\.openssl/||' auto/lib/openssl/conf ./configure --with-openssl=/usr/local/ssl --with-http_ssl_module make # test if SNI is displayed ./objs/nginx -V # if everithing is ok, install sudo make install