Tuesday, April 23, 2019

[proxmox] - online resize container partition LVM

1. click resize disk

enter increment in GB



2. # growpart /dev/sda 3
CHANGED: partition=3 start=2101248 old: size=65005568 end=67106816 new: size=85979103,end=88080351

this will grow from 32gb to 43gb

3. # pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized

this resize volume group to new size

4. # pvs
  PV         VG        Fmt  Attr PSize    PFree
  /dev/sda3  ubuntu-vg lvm2 a--   <41 .00g="" b="" g="" nbsp="">
  /dev/sdb1  ssdMySQL  lvm2 a--    <2 .00g="" nbsp="" p="">  /dev/sdc1  ssd1gb    lvm2 a--  1016.00m 1016.00m

Done!

ref:
https://ask.fedoraproject.org/en/question/115383/need-to-resize-lv_home-to-use-remaining-space-on-pv-but-cannot/

https://askubuntu.com/questions/24027/how-can-i-resize-an-ext-root-partition-at-runtime

Thursday, February 14, 2019

implement own CA for own use

parking here: https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/

openssl genrsa -des3 -out myCA.key 2048
 
openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem
 

Creating CA-Signed Certificates for Your Dev Sites

Now that we’re a CA on all our devices, we can sign certificates for any new dev sites that need HTTPS. First, we create a private key:

openssl genrsa -out dev.mergebot.com.key 2048 
 
Then we create a CSR:
openssl req -new -key dev.mergebot.com.key -out dev.mergebot.com.csr 


create the certificate:
openssl x509 -req -in dev.mergebot.com.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial \
-out dev.mergebot.com.crt -days 1825 -sha256 -extfile dev.mergebot.com.ext 
 
 

Tuesday, May 16, 2017

Wednesday, April 12, 2017

setup openvpn with routing (debian)

ref: https://nikinuryadin.wordpress.com/2010/04/16/step-by-step-setting-up-openvpn-in-debian-with-routing-tun-connection/

Configure openvpn using routing (tun) connection
Configuring the server
#vim /etc/openvpn/server.conf
(add the following lines)
port 443
proto udp
dev tun
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/vpnsarandi.crt
key /etc/openvpn/easy-rsa/keys/vpnsarandi.key
dh /etc/openvpn/easy-rsa/keys/dh1024.pem
ifconfig-pool-persist ipp.txt
server 10.1.0.0 255.255.255.0
client-config-dir ccd
route 192.168.1.0 255.255.255.0
route 192.168.2.0 255.255.255.0
client-to-client
push “route 192.168.1.0 255.255.255.0”
push “route 192.168.2.0 255.255.255.0”
keepalive 10 120
comp-lzo
persist-key
persist-tun
status /var/log/openvpn-status.log
verb 3
Making directory ccd:
#mkdir /etc/openvpn/ccd
Making  file client1 in ccd directory
#vim /etc/openvpn/ccd/clent1
(add the following lines)
iroute 192.168.1.0 255.255.255.0
Restart OpenVPN:
#/etc/init.d/openvpn restart
Setting up the windows client. First, download the OpenVPN client from here (at the time of writing, select 2.1 RC15). Install it, and create a file ‘client.conf’ in the config directory with the following parameters
client
dev tun
proto udp
remote x.x.x.x  443 # (replace with your server IP)
resolv-retry infinite
nobind
pkcs12 client1.p12 # (replace with the client name)
ns-cert-type server
comp-lzo
verb 3
#redirect-gateway
You can also add ‘redirect-gateway’ to the client configuration to pass all traffic down the VPN tunnel (rather than just traffic intended for the VPN itself).
copy the client1.p12 certificate file to the config directory on the client, start the gui, and connect.
If you need to create any clients in the future, do the following command:
#cd /etc/openvpn/easy-rsa
#source ./vars
#./build-key-pkcs12 clientx
Enable IP and TUN/TAP forwarding:
On  linux client
IP Forwarding

Check if IP Forwarding is enabled

#sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0 
or
cat /proc/sys/net/ipv4/ip_forward
0 
As we can see in both the above examples this was disabled (as show by the value 0).

Enable IP Forwarding on the fly

#sysctl -w net.ipv4.ip_forward=1 
or
#echo 1 > /proc/sys/net/ipv4/ip_forward 

Permanent setting using /etc/sysctl.conf

#/etc/sysctl.conf:
net.ipv4.ip_forward = 1
#sysctl -p /etc/sysctl.conf
 
On RedHat based systems this is also enabled when restarting the network service:
#service network restart
 
and on Debian/Ubuntu systems this can be also done restarting the procps service:
#/etc/init.d/procps.sh restart 

Using distribution specific init scripts

Although the methods presented above should work just fine and you would not need any other method of doing this, I just wanted to note that there are also other methods to enable IP Forwarding specific to some Linux distributions.
For example Debian based distributions might use the setting:
 
#/etc/network/options:
ip_forward=no 
set it to yes and restart the network service.
Also RedHat distributions might set this using:
#/etc/sysconfig/network:
FORWARD_IPV4=true 
and again restart the network service.
Regardless the method you have used once you have completed this you can check it out using the same method shown above:
#sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1 
#cat /proc/sys/net/ipv4/ip_forward
1 
If the result is 1 then the Linux system will start forwarding IP packets even if they are not destined to any of its own network interfaces.
TUN/TAP forwarding:
Allow TUN interface connections to OpenVPN server
# iptables -A INPUT -i tun+ -j ACCEPT
Allow TUN interface connections to be forwarded through other interfaces
# iptables -A FORWARD -i tun+ -j ACCEPT
Allow TAP interface connections to OpenVPN server
# iptables -A INPUT -i tap+ -j ACCEPT
Allow TAP interface connections to be forwarded through other interfaces
# iptables -A FORWARD -i tap+ -j ACCEPT

** rule iptables for  internet  sharing from eth1  to  eth0.
#iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
#iptables-save
Restart Networking and OpenVPN
#/etc/init.d/networking restart
#/etc/init.d/openvpn restart

Wednesday, September 07, 2016

SMTP Relay With 'STARTTLS'

ref: https://simon.heimlicher.com/articles/2010/08/29/smtp-smarthost

A smart host is simply the SMTP server of another party, often your ISP, that is preferable to your own for reasons such as reliability or credibility.
To set the port, append :, for example smtp.example.com:587.
You may need to authenticate to the smart host. This is also possible. However, your email may still not go through—and often it is because the smart host expects a STARTTLS command. This is true for GMail SMTP.
Check if you find 530 5.7.0 Must issue a STARTTLS command first. in /var/log/mail.log.
If this is the case, try to append these two lines to /etc/postfix/main.cf:
smtp_tls_security_level = may
smtp_sasl_security_options = noanonymous
Then issue postfix reload.

Wednesday, July 08, 2015

CSF blank page webmin mobile on centos 7 (fixed!)

ref: https://www.vultr.com/docs/setup-csf-on-centos-7

If you having problem running csf module on webmin please install dependencies:
* notes: i'm using Epel and rpmforge repos before running this installation. worked for me.
Install the CSF dependencies.
  yum -y install wget perl unzip net-tools perl-libwww-perl perl-LWP-Protocol-https perl-GDGraph

Monday, May 11, 2015

ipv6 unifi on centos using PPPoE (final)

ref: https://www.bidon.ca/en/node/634

This is working setting for IPv6 unifi.

I uses route announcements (RA) so that the home router configures the default route as well as a /64 prefix for auto-configuration. We don't need the /64, but it can be useful for the default route.
For PPP on a router, this is disabled by default.
To enable the default route from route advertisements:
# sysctl -w net.ipv6.conf.ppp0.accept_ra=2
To auto-configure an IP address to ppp0:
# sysctl -w net.ipv6.conf.ppp0.autoconf=1
After a few seconds, "ifconfig ppp0" should show a global IPv6 address, and "ip -6 route" will show a default route. You should also be able to "ping6 google.com" or he.net from your router.
IMPORTANT: to make sysctl configurations permanent, you can try to add them to /etc/sysctl.conf, or to /etc/ppp/ipv6-up.d/my-network (script executed when the ppp connection is enabled).

Configuring the /56 prefix with DHCPv6-PD

A /64 network prefix is recommend for a single network. However, most IPv6 home topologies need more than one network. For example, the wireless access point (AP) should use its own network (bye bye network bridging), the wired network another network, another for home servers, appliances, etc.
Install the 'WIDE DHCPv6 client':
# apt-get install wide-dhcpv6-client
The Debian configuration wizard may ask for which interface to listen on: ppp0.
Sample configuration in /etc/wide-dhcpv6/dhcp6c.conf :
# c.f. http://www.ipcalypse.ca/?p=204
interface ppp0 {
  # Identity Association for Prefix Delegation
  send ia-pd 1;

  # Identity Association for Non-temporary Addresses
  send ia-na 1;

  # request domain-name-servers;
  # request domain-name;
  # script "/etc/wide-dhcpv6/dhcp6c-script";
};

id-assoc pd 1 {
  prefix-interface eth1 {
    # Assign subnet 1 to eth1
    sla-id 1;

    # IP address "postfix". if not set it will use EUI-64 address of the interface.
    # Combined with SLA-ID'd prefix to create full IP address of interface.
    ifid 1;

    # Prefix bits assigned.
    # Take the prefix size you're assigned (/48 or /56) and subtract it from 64.
    # In my case I was being assigned a /56, so 64-56=8
    sla-len 8;
  };
};

id-assoc na 1 {
};
Test from the command line:
# dhcp6c -fD -c /etc/wide-dhcpv6/dhcp6c.conf ppp0

Configure radvd for auto-configuration on the networks

Each network with clients (desktops/workstations/laptops) will need radvd so that the clients can auto-configure themselves.
Install radvd:
# apt-get install radvd
Example configuration for a subnet, in /etc/radvd.conf :
interface eth1
{
  AdvSendAdvert on;
  MaxRtrAdvInterval 30;

  prefix ::/64
  {
    AdvOnLink on;
    AdvAutonomous on;
    AdvRouterAddr off;
    AdvValidLifetime 300;
    AdvPreferredLifetime 120;
  };
};
Then restart radvd:
# services radvd restart

Tuesday, May 05, 2015

Enable ipv6 on centos PPPoE unifi

ref: http://wandin.net/dotclear/index.php?post/2011/02/10/Native-IPv6-with-Internode-and-CentOS

Note: you will need new BTU from unifi technician that support ipv6. old btu does not support ipv6 at my place.

remember to put ipv6[space],


# vi /etc/ppp/options 
lock
ipv6 ,
May  5 15:24:46 backup pppd[15296]: PAP authentication succeeded
May  5 15:24:46 backup pppd[15296]: local  LL address fe80::78e0:xxxx:xxxx:xxxx
May  5 15:24:46 backup pppd[15296]: remote LL address fe80::2a6e::xxxx:xxxx:xxx
May  5 15:24:46 backup pppd[15296]: local  IP address 175.143.xx.xx
May  5 15:24:46 backup pppd[15296]: remote IP address 175.143.xx.xx

Wednesday, April 01, 2015

HWAWEI e373 centos 6 id

Bus 006 Device 013: ID 12d1:140c Huawei Technologies Co., Ltd. E180v

this is my working ID for E373. store for future reference.

Monday, January 26, 2015

automated telegram reply with centos

searching and i found this:
to send message:
http://stackoverflow.com/questions/24330922/sending-messages-with-telegram-apis-or-cli

to reply message:
http://stackoverflow.com/questions/27671801/pass-string-to-a-linux-cli-interactive-program-with-a-script
http://www.instructables.com/id/Raspberry-remote-control-with-Telegram/

First create a bash script for telegram called tg.sh:
#!/bin/bash
now=$(date)
to=$1
subject=$2
body=$3
tgpath=/home/youruser/tg
LOGFILE="/home/youruser/tg.log"
cd ${tgpath}
${tgpath}/telegram -k ${tgpath}/tg-server.pub -W <<EOF
msg $to $subject
safe_quit
EOF
echo "$now Recipient=$to Message=$subject" >> ${LOGFILE}
echo "Finished" >> ${LOGFILE}


To intercept a new incoming message we create a file action.lua
"Lua is a powerful, fast, lightweight, embeddable scripting language.
Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping."
sudo nano /home/pi/tg/action.lua
with this content
function on_msg_receive (msg)
    if msg.out then
        return
    end
    if (msg.text=='ping') then
        send_msg (msg.from.print_name, 'pong', ok_cb, false)
    end
end

function on_our_id (id)
end

function on_secret_chat_created (peer)
end

function on_user_update (user)
end

function on_chat_update (user)
end

function on_get_difference_end ()
end

function on_binlog_replay_end ()
end
Save and exit, when incoming text message is "ping", Telegram answers us with a text message containing "pong".
move in tg

cd /home/pi/tg
Then type
bin/telegram-cli -k tg-server.pub -W -s action.lua

Tuesday, January 20, 2015

sms gateway update (1)

link: http://nerazan.blogspot.com/2013/07/how-to-configure-gsm-modem-in-linux.html
(previously working but now not working. wondering why.

http://everyday-tech.com/nagiosfan-sms-alerts-via-smstools/

Download & Install CMake for CentOS-5

Install GCC

Install eject

Install comget

.
Configuring Your GSM Modem

1.)  Insert gsm modem in usb port
2.)  Run

3.)
 Check which modem Port it’s connected to

4.)
 Eject the Cd-rom sro & sr1 as per your setup

5.)
 Connect gsm modem to usb port ( USB0 in my case )

6.)
 When the modem is connected you will get a message with your service provider name
7.)  Create symbolic link to /dev/modem

TO TEST THAT THE USB MODEM IS ON USB0

.

Installing & Configuring SMSTools


1.)  Install SMS Tools
-or-

2.)  Make Sure you have the Following SMSTOOLS3 SERVER Files and Folders Installed
  • incoming = /var/spool/sms/incoming
  • outgoing = /var/spool/sms/outgoing
  • checked = /var/spool/sms/checked
  • failed = /var/spool/sms/failed
  • sent = /var/spool/sms/sent
  • logfile = /var/log/smsd.log
  • Configuration = /etc/smsd.conf

3.)  Make sure that SMSTools has the Right Configuration Setting for your modem in:  /etc/smsd.conf( GSM Modem is on USB0 in this example)
device = /dev/ttyUSB0

HOW TO START or STOP THE SMSTOOLS3 SERVER

To Setup SMS Tools to AutoStart on Server Boot….

To Test your SMSTools Install:
Related Posts Plugin for WordPress, Blogger...