跳转到内容

博客

Oracle 数据库基础

Oracle 数据库基础用法。

Create Table TABLE_NAME (sequenceno NUMBER(19) not null, \
time TIMESTAMP(6) not null,\
alarmseverity NUMBER(10), \
alarmfield NUMBER(10), \
text VARCHAR2(1000), \
alarmevent NUMBER(19), \
activetype NUMBER(10), \
eventid VARCHAR2(1000), \
primary key(sequenceno) )
  • NUMBER(19):整数类型。
  • VARCHAR2(1000):字符类型。
  • primary key(sequenceno):将 sequenceno 设置为主键。
Insert Into H_ASMEvents(SequenceNo,Description) \
Values(1234, DescriptionText,)
UPDATE H_ASMEvents SET Description = description_text \
WHERE SequenceNo = 1234
SELECT * FROM H_ASMEvents WHERE SequenceNo = 1234

Deploy KMS Activation Server with Vlmcsd On Docker

Vlmcsd Project: mydigitallife,Github

To install Vlmcsd Manually, refer toVlmcsd-on-Ubuntu-18.04 or Centos7-搭建KMS服务器以及windows产品秘钥

(1). Compile docker-compose.yaml, as below

Section titled “(1). Compile docker-compose.yaml, as below”
version: "3"
services:
kms-docker:
image: teddysun/kms
container_name: kms
restart: always
network_mode: "host"
ports:
- 1688:1688

(2). Run docker container with docker-compose

Section titled “(2). Run docker container with docker-compose”
docker-compose up -d
[KMS]
type = tcp
local_ip = 127.0.0.1
local_port = 1688
remote_port = 1688
protocol = kcp

Run CMD with Administrator, then run the following scripts:

slmgr.vbs -upk
slmgr.vbs -ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
slmgr.vbs -skms xxx.xxx.xxx.xxx:1688
slmgr.vbs -ato
slmgr.vbs -dlv

Run CMD with Administrator, then run the following scripts:

cd C:\Program Files\Microsoft Office\Office16
cscript ospp.vbs /unpkey:xxxxx
cscript ospp.vbs /inpkey:xxxxx
cscript ospp.vbs /sethst:x.x.x.x
cscript ospp.vbs /act

Scripts above refer to ospp.vbs激活office

Notes:KMS activication works for Office VOL version ONLY.

You can install VOL certificates with OfficeTools.

For more Activation Key, refer to Office-Products-Information.

Office-2021-Professional-Plus-English

Visio-2021-Professional-English

Office-2021-Professional-Plus-Chinese-Simplified

Visio-2021-Professional-Chinese-Simplified

[1]. http://forums.mydigitallife.info/threads/50234-Emulated-KMS-Servers-on-non-Windows-platforms

[2]. https://github.com/Wind4/vlmcsd

[3]. https://jalena.bcsytv.com/archives/1388/comment-page-1

[4]. https://blog.thirdechelon.org/2019/06/vlmcsd-on-ubuntu-18-04/

[5]. https://sxfblog.com/index.php/archives/137.html

[6]. Some-Operations-After-Installing-docker-and-podman

SELinux初探

关于SELinux安全上下文设置的一些操作命令

Section titled “关于SELinux安全上下文设置的一些操作命令”
  • 语法
    chcon [选项]... 环境 文件...
    chcon [选项]... [-u 用户] [-r 角色] [-l 范围] [-t 类型] 文件...
    chcon [选项]... --reference=参考文件 文件...
  • 选项
    -h, --no-dereference:影响符号连接而非引用的文件。
    --reference=参考文件:使用指定参考文件的安全环境,而非指定值。
    -R, --recursive:递归处理所有的文件及子目录。
    -v, --verbose:为处理的所有文件显示诊断信息。
    -u, --user=用户:设置指定用户的目标安全环境。
    -r, --role=角色:设置指定角色的目标安全环境。
    -t, --type=类型:设置指定类型的目标安全环境。
    -l, --range=范围:设置指定范围的目标安全环境。
  • 语法
    restorecon [-iFnrRv] [-e excludedir ] [-o filename ] [-f filename | pathname...]
  • 选项
    -i:忽略不存在的文件。
    -f:infilename 文件 infilename 中记录要处理的文件。
    -e:directory 排除目录。
    -R/-r:递归处理目录。
    -n:不改变文件标签。
    -o/outfilename:保存文件列表到 outfilename,在文件不正确情况下。
    -v:将过程显示到屏幕上。
    -F:强制恢复文件安全语境。
  • 将某个路径下的后续文件自动标记安全上下文的规则

    sudo semanage fcontext -a -t samba_share_t "/mnt/shared(/.*)?"
  • 删除某个路径下的后续文件自动标记安全上下文的规则

    sudo semanage fcontext - "/mnt/shared(/.*)?"
  • 查看SELinux的所有bool量开关

    getsebool -a
  • 修改bool值

    setsebool -P <boolean_name> on/off

    其中-P用于永久修改。

  • 需要注意的是,任何一个程序在SElinux下运行,均需要有对应的SElinux安全上下文支撑,否则运行必然造成权限不足。

[1].https://www.linuxprobe.com/restorecon.html

[2].https://www.linuxprobe.com/chcon.html

[3]. https://goto-linux.com/zh-cn/2020/6/13/%E5%A6%82%E4%BD%95%E5%9C%A8rhel-8-/-centos-8%E4%B8%8A%E5%AE%89%E8%A3%85%E5%92%8C%E9%85%8D%E7%BD%AEsamba/

[4]. Reverse-Proxy-with-Nginx-on-RHEL

[5]. Install-Samba-on-RHEL-CentOS-Fedora

[6]. Podman-Volumes-and-SELinux

OpenPGP 初探

gpg --expert --full-gen-key

  • --expert:专家模式。
  • --full-gen-key:生成 key。

gpg --gen-revoke -so revoke.gpg USERID

gpg --list-secret-keys 或简化命令 gpg -K

  • --keyid-format long:输出长 ID。
  • --fingerprint:输出指纹信息。

从文件导入:

gpg --import [file]

gpg -ao public-key.txt --export USERID

导出主私钥:

gpg -ao secret-key --export-secret-key 99F583599B7E31F1!

导出子密钥:

gpg -ao sign-subkey --export-secret-subkeys FDB960B857D397F6!

  • ! 表示仅导出该密钥。

删除私钥:

gpg --delete-secret-keys USERID

删除公钥:

gpg --delete-keys USERID

生成二进制签名文件:

gpg --sign input.txt

生成 ASCII 格式签名:

gpg --clearsign input.txt

签名和原文本分开:

gpg --armor --detach-sign input.txt

  • 增加 --output 参数,可以输出到文件。

验证签名文件:

gpg --verify demo.txt.asc demo.txt

gpg --recipient {keyid/uid} --output encrypt.txt --encrypt input.txt

gpg -se -o encrypt.txt -r {keyid/uid} input.txt

gpg --decrypt encrypt.txt --output decrypt.txt

gpg -d encrypt.txt

[1]. SSH-Authentication-with-GPG-Keys-on-Linux

[2]. GnuPG-Home-Configuration-on-Winodws

Build Git Server Using GitLab with Podman

  • Running GitLab Server on Linux with Podman
  • Linux Server with Podman

Config github.rb file with following options

external_url 'http://127.0.0.1:8929'
gitlab_rails['gitlab_ssh_host'] = 'gitlab.yourdomain.com'
gitlab_rails['gitlab_shell_ssh_port'] = 22
nginx['listen_addresses'] = ['*', '[::]']
nginx['listen_port'] = 8929

Change external_url starting with https:// to enable HTTPS, working on port 443.

podman pull docker.io/gitlab/gitlab-ce:latest
podman run --detach --privileged \
--name gitlab \
--hostname gitlab.yourdomain.com \
--user $(id -u):$(id -g) \
--network bridge \
--net pod-net \
--health-cmd="/opt/gitlab/bin/gitlab-healthcheck" \
--health-retries=5 \
--health-interval=5m \
--health-start-period=5m \
-p 127.0.0.1:10443:443 \
-v ./config:/etc/gitlab:z \
-v ./logs:/var/log/gitlab:z \
-v ./data:/var/opt/gitlab:z \
--shm-size 256m \
--group-add keep-groups \
docker.io/gitlab/gitlab-ce:latest
  • 10443:443->将本机10443端口映射到容器内的443

Backup Repository with following command

gitlab-rake gitlab:backup:create

[1]. https://zhuanlan.zhihu.com/p/531244799

[2]. Build-a-Git-Using-Gogs

[3]. Podman-Volumes-and-SELinux

[4]. Manage-Podman-Container-With-Systemd