jueves, octubre 29, 2020
Annydesk en raspberry pi Headdless (por ssh)
Actualizacion - Guia rapida PiVPN (https://www.pivpn.io/)
Instalar:
sudo apt update
sudo apt upgrade
Instalar PiVPN (como root):
curl -L https://install.pivpn.io | bash
Finalizada la instalacion para agregar un nuevo profile (usuario):
sudo pivpn add
Para desinstalar Pivpn:
sudo pivpn uninstall
domingo, octubre 25, 2020
Raspberry piRaspAP + pihole: adsblock,
Ya que me abristeis el camino con el tema bloqueo anuncios y de paso ya q el software libre es lo mío os cuento:
Uso orange, no puedo cambiar los dns en el router asi que la salida o chapucear poniendo las dns en cada equipo con ip fija o montar un apn junto con pi-hole... y asi conecto por el puerto de la lan la rasberry al router, en el que le asigne una ip fija por MAC, lo demás coser y cantar ....
se trata de tener raspap+openvpn+pihole:
- instalamos de 0 raspian
- desde el pc ponemos el fichero ssh en la unidad boot, no necesitamos configurar wifi
- en la raspi conectar el rj45 en el puerto de la lan y encendemos...
lo de ahora es lo guay:
apt update
apt upgrade
sudo rfkill unblock wlan
Instalar RaspAP
sudo curl -sL https://install.raspap.com | bash
Instalar Pi-Hole
sudo curl -sSL https://install.pi-hole.net | bash
Finalizamos afinando el entorno
sudo touch /var/lib/misc/dnsmasq.leases
sudo chown pihole:pihole /var/lib/misc/dnsmasq.leases
reboot
me ha sorprendido la potencia de RaspAP, te permite administrar openvpn y en si es también un adblocker, tremendamente potente con su web gui para administrar clientes etc...
https://raspap.com/
he realizado pruebas y estoy aterrizando un poco con el ,lo que si veo es que la publi de youtube no la quita..
Para agregar url y listas de dominos bloqueados ir a:
https://github.com/blocklistproject/Lists#using-with-pi-hole
Desde pi-hole-->Group Management -->Adlist
Podemos agregar una a una las urls a bloquear, una vez terminado actulizamos las listas:
sudo pihole -g
martes, octubre 20, 2020
Systemd – Configuración de servicios en RHEL7
Creamos el script del servicio que lanzará el servicio de jboss
vim /etc/systemd/system/jboss.service
Agregamos el siguiente contenido:
[Unit]
Description=servicio Jboss
After=network.target
[Service]
ExecStart=/bin/bash /opt/jboss/bin/jboss.sh start
ExecStop=/bin/bash /opt/opt/jboss/bin/jboss.sh stop
Type=forking
[Install]
WantedBy=multi-user.target
viernes, octubre 16, 2020
Acceder por 4G/3G/2G a tu smartphone Android por SSH proxy inverso con bitcoinshell
Para realizar el proceso usando la app userlanz corriendo un ubuntu debajo del android:
Instalar en shell smartphone android sshpass:
sudo apt install sshpass
Script a ejecutar en la shell del smartphone,:
#!/bin/bash
REMOTE_PORT=22
REMOTE_ADDRESS=usr_bitcoinshell@bitcoinshell.mooo.com
PASSWORD="password_de_usr_bitcoinshell"
sshpass -p "$PASSWORD" \
ssh -o ServerAliveInterval=60 \
-o ServerAliveCountMax=2 \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-o ConnectTimeout=15 \
-N -R 2222:localhost:22 $REMOTE_ADDRESS -p $REMOTE_PORT
Comando para acceder desde ssh desde bitcoinshell
ssh usr_shellAndroid@localhost -p 2222
NOTA, simplificando: en android usando la app termux, el servidor ssh corre en el puerto 8022, desde termux instalar sshpass (apt install sshpass)el script para usarlo con termux queda asi:
Tenemos que ver que usuario esta corriendo en termux ssh, usando whoami y aplicamos contraseña con passwd
#!/bin/bash
REMOTE_PORT=22
REMOTE_ADDRESS=usrbitcoinshell@bitcoinshell.mooo.com
PASSWORD="passusrbitcoinshell"
sshpass -p $PASSWORD \
ssh -o ServerAliveInterval=60 \
-o ServerAliveCountMax=2 \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-o ConnectTimeout=15 \
-N -R 2222:localhost:8022 $REMOTE_ADDRESS -p $REMOTE_PORT
viernes, octubre 09, 2020
Como incluir un equpo RedHAt/centroen 7.x en monitorizacion nagios con smnp rapidamente
Monitorización –
Nagios
Montar DVD como root:
Instalamos los paquetes necesarios desde /media/Packages
rpm -vih
net-snmp-agent-libs-5.7.2-28.el7.x86_64.rpm
rpm -vih
net-snmp-5.7.2-28.el7.x86_64.rpm
Hacemos backup del siguiente fichero:
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old
y lo editamos y pegamos el siguiente contenido:
nano
/etc/snmp/snmpd.conf
com2sec readonly 172.16.44.6 public
group MyROSystem v1
paranoid
group MyROSystem v2c
paranoid
group MyROSystem usm
paranoid
group MyROGroup v1
readonly
group MyROGroup v2c
readonly
group MyROGroup usm
readonly
group MyRWGroup v1
readwrite
group MyRWGroup v2c
readwrite
group MyRWGroup usm
readwrite
view all included .1 80
view system included
.iso.org.dod.internet.mgmt.mib-2.system
access MyROSystem ""
any noauth exact
system none none
access MyROGroup ""
any noauth exact
all none none
access MyRWGroup ""
any noauth exact
all all none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure
/etc/snmp/snmp.local.conf)
master agentx
Lanzamos el srvicio snmpd como root:
service snmpd start
Deshabilitamos el firewall:
systemctl disable firewalld
Comprobamos que ya llegan las
trazas snmp desde el servidor a monitorizar, desde el servidor vmonitor
lanzamos este comando:
snmpwalk -v 2c -c public jboss03des system
Tiene que dar una respuesta
como esta:
Alta de jboss03des
en Centreon:
Entramos en Centreon
Vamos a Configuration à hostà add
Dejar tal cual aparece en esta captura de pantalla y dar a botón save:
Ir a configuration à Nagios
Seleccionar las casillas “move Expor Files” y “Restart Nagios” y dar a boton Export
Entramos en Nagios y tras una búsqueda del host jboss03des vemos que ha empezado la monitorización:
Configurar samba smb en entronos RedHat / centos version 7.X 8.X ... 2020
What is Samba
To provide printer and file sharing, Microsoft Windows uses a facility known as SMB (Server Message Block). This same facility is sometimes known as NetBIOS or LanManager. Thanks to Andrew Tridgell and others, Linux systems provide support for SMB via a package known as Samba. Like SMB, Samba lets you:
- Share printers and files among Microsoft Windows, OS/2, Netware, and Unix systems
- Establish a simple nameserver for identifying systems on your local area network
- Backup PC files to a Linux system and restore them
- Administer users and passwords
Samba has proven its reliability and high performance in many organizations.Samba software suite on Enterprise Linux is a collection of programs that implements the Server Message Block (commonly abbreviated as SMB) protocol for UNIX systems.
Installing Samba
In Enterprise Linux system, install below packages to get started with Samba. You can download/install these packages from yum server using the “yum install” command.
samba #### basic Samba packages samba-client #### samba client
To install these packages :
# yum install samba # yum install samba-client
If you are using an active directory setup, install below packages as well.
# yum install samba-winbind # yum install samba-winbind-clients # yum install samba-winbind-krb5-locator
Below are the list of packages which will be installed once you have installed the above packages.
samba-libs samba-winbind-krb5-locator samba-winbind-modules samba-vfs-glusterfs samba-winbind samba-client samba-common samba-winbind-clients samba
Configuring a Samba share
Samba’s configuration usually resides in /etc/samba/smb.conf which contains all the configuration parameters related to samba. Follow the steps given below to configure a samba share.
1. For the share to be accessible to a particular user, we must first create a user (john) on the linux server where the share resides as well.
# useradd john
# passwd john Changing password for user john. New password: Retype new password: passwd: all authentication tokens updated successfully.
2. To add activate the Samba user and set the password, use the “smbpasswd” command with the -a option.
# smbpasswd -a john
3. Create the directory to share or you can use an existing directory. Also set full permissions on the directory.
# mkdir -p /path/to/share # chmod -R 777 /path/to/share
4. Next, set the SElinux contexts on the share. Verify if you can create a file in the share.
# chcon -R -t samba_share_t /path/to/share # cd /path/to/share # echo test > testfile.txt
5. Edit the /etc/samba/smb.conf file and add the share settings.
# vi /etc/samba/smb.conf [share_name] path = /path/to/share comment = samba share for john public = yes writable = yes create mask = 0777 browseable = yes
Restart samba service for the above settings to take effect.
# service smb restart
To enable the service so that it survives a reboot execute the following:
systemctl enable smb
Troubleshooting
To find out the issue with a samba share, you can try disabling the iptables service and turning off the SELinux. Make sure to enable them back after you resolve the confilct.
# service iptables stop # setenforce 0
Verify samba parameter using testparm
To verify that the parameters are correct in the smb.conf file or to debug configuration problems, use the testparm command.
logs
For debugging problems with Samba in general, the log files log.smbd and log.nmbd under the /var/log/samba directory are invaluable. The parameter log level in the global section of the smb.conf file determines the amount of detailed information Samba writes to the log files, with level 0 being the most general and 10 being the most detailed. Each logging level contains the messages from that level, in addition to the logging messages below it. For example, a logging level of 5 contains messages from level 5, plus those from levels 0 through 4.
# vi /etc/samba/smb.conf # this tells Samba to use a separate log file for each machine # that connects log file = /var/log/samba/%m.log debuglevel = 4
miércoles, octubre 07, 2020
Entrar a una shell ssh en nuestro terminal android usando la red de datos celular, 3G, 4G,5G
Si queremos conectar a nuestro smartphone por 4G, usando ssh:
-Instalamos Termius desde google play
-Instalamos userland desde google play:
*Instalar Ubuntu desde lista de S.O, una vez instalado no iniciar sesion vnc
*Agregar sesion ssh (segunda pesta a de userland)
*conectar por ssh a debian:
*sudo su
*apt update && apt upgrade
* apt install wget
-Dejamos el binario arm64 en http://bitcoinshell.mooo.com/users/usuario/ o hacemos wget al binario arm64 en downloads ngrok.com
-Descomprimimos ngrok:
$tar xpvfz ngrok_arm64xxxxx.tgz
-Hay que pedir el authtoken en ngrok.com y ejecutamos este comando en Termux, android,
Este comando salva el authtoken en un fichero ngrok.yml
$./ngrok authtoken ToKenQueNosHaDadoNgRoK
-Ya podemos ejecutar ngrok para usar el tunnel, por ejemplo para conexion ssh (tiene que ser el puerto 22 para que ngrok redireccione al puerto ssh de localhost):
$./ngrok tcp 22
-Ya podemos entrar con ssh, en windows por putty y en linux (user es el usuario con el que arrancamos ngrok en Ubuntu userland y Port es el puerto aleatorio que nos da ngrok):
ssh user@0.tcp.ngrok.io -p Port