@ -0,0 +1,71 @@ | |||||
<p> | |||||
<b>Multiple Switches can Slow a Network Down</b> | |||||
<p> | |||||
<b>1. Overview </b> | |||||
<p> | |||||
A question is, can multiple network switches, slow down either the network or the WAN. The answer is yes. Let's discuss a working example today. | |||||
<p> | |||||
<b>2. The Previous IT Guys </b> | |||||
<p> | |||||
Today I was working at an office. They had a firewall connected to a Verizon FIOS modem. They had a gigabit \footnote{Actually, all switches were gigabit, but it didn't make a difference.}switch immediately downstream, and then a network cable ran about 50-75 feet to their office. Here they had another Gigabit switch, and then the cables went off to either computers or other switches. Let's forget about what was downstream of that last switch except for the computers. | |||||
<p> | |||||
<p> | |||||
<b> 2.1. Internet Speeds </b> | |||||
<p> | |||||
The internet speed from the two computers in the office was about 10Mbps down and roughly the same upload. However, I tested the speed directly from the IT closet, and found 100Mbps down and 100Mbps up. At this point, it was a simple case of following the signal path and seeing where things slowed down. At least, I knew that they <em>should</em> be getting 100/100Mbps. | |||||
<p> | |||||
<p> | |||||
<b> 2.2. The Tests </b> | |||||
<p> | |||||
What I found is that as soon as I had two switches after the firewall \footnote{which has its own internal switch}the speed would drop to 10/10. It was not dependent upon any brand of switch. I tried swapping from one other model that was available. The slowdown appeared to be switch independent. So in summary: | |||||
<ul> <li> Firewall - computer - 100/100 <li> Firewall - switch - computer - 100/100 <li> Firewall - switch - 50 foot wire - computer - 100/100 <li> Firewall - switch - 50 foot wire - Switch A- computer - 10/10 <li> Firewall - switch - 50 foot wire - Switch B- computer - 10/10 | |||||
<p> | |||||
</ul> | |||||
What I did was remove the switch at the outside of the firewall. Now I had only <br/> | |||||
\vspace{0.2in} <br/> | |||||
Firewall - 50 foot wire - Switch - Computer - 100/100 | |||||
<p> | |||||
\includegraphics[scale=0.5]{../pics/drawing.png} \captionof{figure}{Here, removing the first switch after the firewall, resolved the low speed issues.} | |||||
<p> | |||||
<p> | |||||
<b>3. Additional Background </b> | |||||
<p> | |||||
I've heard an IT person mention that he didn't like multiple switches in network deployments, due to speed issues. On the other hand, I've setup Video Recording Networks with multiple switches all connecting serially to each other without issue. It seems that this is not a simple black and white issue. With the right hardware you may get away with it. Or if you avoid WAN access. In any case, the only way to know, is to test. | |||||
<p> | |||||
<p> | |||||
<b>4. Conclusion </b> | |||||
<p> | |||||
If you are going to put \textgreater 1 switches downstream of the firewall, make sure to double check the WAN speed tests from just after the firewall, to at the very last switch. | |||||
<p> |
@ -0,0 +1,712 @@ | |||||
""" | |||||
Copyright 2009 Luca Trevisan | |||||
Additional contributors: Radu Grigore | |||||
LaTeX2WP version 0.6.2 | |||||
This file is part of LaTeX2WP, a program that converts | |||||
a LaTeX document into a format that is ready to be | |||||
copied and pasted into WordPress. | |||||
You are free to redistribute and/or modify LaTeX2WP under the | |||||
terms of the GNU General Public License (GPL), version 3 | |||||
or (at your option) any later version. | |||||
I hope you will find LaTeX2WP useful, but be advised that | |||||
it comes WITHOUT ANY WARRANTY; without even the implied warranty | |||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GPL for more details. | |||||
You should have received a copy of the GNU General Public | |||||
License along with LaTeX2WP. If you can't find it, | |||||
see <http://www.gnu.org/licenses/>. | |||||
""" | |||||
import re | |||||
from sys import argv | |||||
from latex2wpstyle import * | |||||
# prepare variables computed from the info in latex2wpstyle | |||||
count = dict() | |||||
for thm in ThmEnvs: | |||||
count[T[thm]] = 0 | |||||
count["section"] = count["subsection"] = count["equation"] = 0 | |||||
ref={} | |||||
endlatex = "&fg="+textcolor | |||||
if HTML : endproof = "<img src=\"http://l.wordpress.com/latex.php?latex=\Box&fg=000000\">" | |||||
inthm = "" | |||||
""" | |||||
At the beginning, the commands \$, \% and \& are temporarily | |||||
replaced by placeholders (the second entry in each 4-tuple). | |||||
At the end, The placeholders in text mode are replaced by | |||||
the third entry, and the placeholders in math mode are | |||||
replaced by the fourth entry. | |||||
""" | |||||
esc = [["\\$","_dollar_","$","\\$"], | |||||
["\\%","_percent_","%","\\%"], | |||||
["\\&","_amp_","&","\\&"], | |||||
[">","_greater_",">",">"], | |||||
["<","_lesser_","<","<"]] | |||||
M = M + [ ["\\more","<!--more-->"], | |||||
["\\newblock","\\\\"], | |||||
["\\sloppy",""], | |||||
["\\S","§"]] | |||||
Mnomath =[["\\\\","<br/>\n"], | |||||
["\\ "," "], | |||||
["\\`a","à"], | |||||
["\\'a","á"], | |||||
["\\\"a","ä"], | |||||
["\\aa ","å"], | |||||
["{\\aa}","å"], | |||||
["\\`e","è"], | |||||
["\\'e","é"], | |||||
["\\\"e","ë"], | |||||
["\\`i","ì"], | |||||
["\\'i","í"], | |||||
["\\\"i","ï"], | |||||
["\\`o","ò"], | |||||
["\\'o","ó"], | |||||
["\\\"o","ö"], | |||||
["\\`o","ò"], | |||||
["\\'o","ó"], | |||||
["\\\"o","ö"], | |||||
["\\H o","ö"], | |||||
["\\`u","ù"], | |||||
["\\'u","ú"], | |||||
["\\\"u","ü"], | |||||
["\\`u","ù"], | |||||
["\\'u","ú"], | |||||
["\\\"u","ü"], | |||||
["\\v{C}","Č"]] | |||||
cb = re.compile("\\{|}") | |||||
def extractbody(m) : | |||||
begin = re.compile("\\\\begin\s*") | |||||
m= begin.sub("\\\\begin",m) | |||||
end = re.compile("\\\\end\s*") | |||||
m = end.sub("\\\\end",m) | |||||
beginenddoc = re.compile("\\\\begin\\{document}" | |||||
"|\\\\end\\{document}") | |||||
parse = beginenddoc.split(m) | |||||
if len(parse)== 1 : | |||||
m = parse[0] | |||||
else : | |||||
m = parse[1] | |||||
""" | |||||
removes comments, replaces double returns with <p> and | |||||
other returns and multiple spaces by a single space. | |||||
""" | |||||
for e in esc : | |||||
m = m.replace(e[0],e[1]) | |||||
comments = re.compile("%.*?\n") | |||||
m=comments.sub(" ",m) | |||||
multiplereturns = re.compile("\n\n+") | |||||
m= multiplereturns.sub ("<p>",m) | |||||
spaces=re.compile("(\n|[ ])+") | |||||
m=spaces.sub(" ",m) | |||||
""" | |||||
removes text between \iffalse ... \fi and | |||||
between \iftex ... \fi keeps text between | |||||
\ifblog ... \fi | |||||
""" | |||||
ifcommands = re.compile("\\\\iffalse|\\\\ifblog|\\\\iftex|\\\\fi") | |||||
L=ifcommands.split(m) | |||||
I=ifcommands.findall(m) | |||||
m= L[0] | |||||
for i in range(1,(len(L)+1)/2) : | |||||
if (I[2*i-2]=="\\ifblog") : | |||||
m=m+L[2*i-1] | |||||
m=m+L[2*i] | |||||
""" | |||||
changes $$ ... $$ into \[ ... \] and reformats | |||||
eqnarray* environments as regular array environments | |||||
""" | |||||
doubledollar = re.compile("\\$\\$") | |||||
L=doubledollar.split(m) | |||||
m=L[0] | |||||
for i in range(1,(len(L)+1)/2) : | |||||
m = m+ "\\[" + L[2*i-1] + "\\]" + L[2*i] | |||||
m=m.replace("\\begin{eqnarray*}","\\[ \\begin{array}{rcl} ") | |||||
m=m.replace("\\end{eqnarray*}","\\end{array} \\]") | |||||
return m | |||||
def convertsqb(m) : | |||||
r = re.compile("\\\\item\\s*\\[.*?\\]") | |||||
Litems = r.findall(m) | |||||
Lrest = r.split(m) | |||||
m = Lrest[0] | |||||
for i in range(0,len(Litems)) : | |||||
s= Litems[i] | |||||
s=s.replace("\\item","\\nitem") | |||||
s=s.replace("[","{") | |||||
s=s.replace("]","}") | |||||
m=m+s+Lrest[i+1] | |||||
r = re.compile("\\\\begin\\s*\\{\\w+}\\s*\\[.*?\\]") | |||||
Lthms = r.findall(m) | |||||
Lrest = r.split(m) | |||||
m = Lrest[0] | |||||
for i in range(0,len(Lthms)) : | |||||
s= Lthms[i] | |||||
s=s.replace("\\begin","\\nbegin") | |||||
s=s.replace("[","{") | |||||
s=s.replace("]","}") | |||||
m=m+s+Lrest[i+1] | |||||
return m | |||||
def converttables(m) : | |||||
retable = re.compile("\\\\begin\s*\\{tabular}.*?\\\\end\s*\\{tabular}" | |||||
"|\\\\begin\s*\\{btabular}.*?\\\\end\s*\\{btabular}") | |||||
tables = retable.findall(m) | |||||
rest = retable.split(m) | |||||
m = rest[0] | |||||
for i in range(len(tables)) : | |||||
if tables[i].find("{btabular}") != -1 : | |||||
m = m + convertonetable(tables[i],True) | |||||
else : | |||||
m = m + convertonetable(tables[i],False) | |||||
m = m + rest[i+1] | |||||
return m | |||||
def convertmacros(m) : | |||||
comm = re.compile("\\\\[a-zA-Z]*") | |||||
commands = comm.findall(m) | |||||
rest = comm.split(m) | |||||
r= rest[0] | |||||
for i in range( len (commands) ) : | |||||
for s1,s2 in M : | |||||
if s1==commands[i] : | |||||
commands[i] = s2 | |||||
r=r+commands[i]+rest[i+1] | |||||
return(r) | |||||
def convertonetable(m,border) : | |||||
tokens = re.compile("\\\\begin\\{tabular}\s*\\{.*?}" | |||||
"|\\\\end\\{tabular}" | |||||
"|\\\\begin\\{btabular}\s*\\{.*?}" | |||||
"|\\\\end\\{btabular}" | |||||
"|&|\\\\\\\\") | |||||
align = { "c" : "center", "l" : "left" , "r" : "right" } | |||||
T = tokens.findall(m) | |||||
C = tokens.split(m) | |||||
L = cb.split(T[0]) | |||||
format = L[3] | |||||
columns = len(format) | |||||
if border : | |||||
m = "<table border=\"1\" align=center>" | |||||
else : | |||||
m="<table align = center><tr>" | |||||
p=1 | |||||
i=0 | |||||
while T[p-1] != "\\end{tabular}" and T[p-1] != "\\end{btabular}": | |||||
m = m + "<td align="+align[format[i]]+">" + C[p] + "</td>" | |||||
p=p+1 | |||||
i=i+1 | |||||
if T[p-1]=="\\\\" : | |||||
for i in range (p,columns) : | |||||
m=m+"<td></td>" | |||||
m=m+"</tr><tr>" | |||||
i=0 | |||||
m = m+ "</tr></table>" | |||||
return (m) | |||||
def separatemath(m) : | |||||
mathre = re.compile("\\$.*?\\$" | |||||
"|\\\\begin\\{equation}.*?\\\\end\\{equation}" | |||||
"|\\\\\\[.*?\\\\\\]") | |||||
math = mathre.findall(m) | |||||
text = mathre.split(m) | |||||
return(math,text) | |||||
def processmath( M ) : | |||||
R = [] | |||||
counteq=0 | |||||
global ref | |||||
mathdelim = re.compile("\\$" | |||||
"|\\\\begin\\{equation}" | |||||
"|\\\\end\\{equation}" | |||||
"|\\\\\\[|\\\\\\]") | |||||
label = re.compile("\\\\label\\{.*?}") | |||||
for m in M : | |||||
md = mathdelim.findall(m) | |||||
mb = mathdelim.split(m) | |||||
""" | |||||
In what follows, md[0] contains the initial delimiter, | |||||
which is either \begin{equation}, or $, or \[, and | |||||
mb[1] contains the actual mathematical equation | |||||
""" | |||||
if md[0] == "$" : | |||||
if HTML : | |||||
m=m.replace("$","") | |||||
m=m.replace("+","%2B") | |||||
m=m.replace(" ","+") | |||||
m=m.replace("'","'") | |||||
m="<img src=\"http://l.wordpress.com/latex.php?latex=%7B"+m+"%7D"+endlatex+"\">" | |||||
else : | |||||
m="$latex {"+mb[1]+"}"+endlatex+"$" | |||||
else : | |||||
if md[0].find("\\begin") != -1 : | |||||
count["equation"] += 1 | |||||
mb[1] = mb[1] + "\\ \\ \\ \\ \\ ("+str(count["equation"])+")" | |||||
if HTML : | |||||
mb[1]=mb[1].replace("+","%2B") | |||||
mb[1]=mb[1].replace("&","%26") | |||||
mb[1]=mb[1].replace(" ","+") | |||||
mb[1]=mb[1].replace("'","'") | |||||
m = "<p align=center><img src=\"http://l.wordpress.com/latex.php?latex=\displaystyle " + mb[1] +endlatex+"\"></p>\n" | |||||
else : | |||||
m = "<p align=center>$latex \displaystyle " + mb[1] +endlatex+"$</p>\n" | |||||
if m.find("\\label") != -1 : | |||||
mnolab = label.split(m) | |||||
mlab = label.findall(m) | |||||
""" | |||||
Now the mathematical equation, which has already | |||||
been formatted for WordPress, is the union of | |||||
the strings mnolab[0] and mnolab[1]. The content | |||||
of the \label{...} command is in mlab[0] | |||||
""" | |||||
lab = mlab[0] | |||||
lab=cb.split(lab)[1] | |||||
lab=lab.replace(":","") | |||||
ref[lab]=count["equation"] | |||||
m="<a name=\""+lab+"\">"+mnolab[0]+mnolab[1]+"</a>" | |||||
R= R + [m] | |||||
return R | |||||
def convertcolors(m,c) : | |||||
if m.find("begin") != -1 : | |||||
return("<span style=\"color:#"+colors[c]+";\">") | |||||
else : | |||||
return("</span>") | |||||
def convertitm(m) : | |||||
if m.find("begin") != -1 : | |||||
return ("\n\n<ul>") | |||||
else : | |||||
return ("\n</ul>\n\n") | |||||
def convertenum(m) : | |||||
if m.find("begin") != -1 : | |||||
return ("\n\n<ol>") | |||||
else : | |||||
return ("\n</ol>\n\n") | |||||
def convertbeginnamedthm(thname,thm) : | |||||
global inthm | |||||
count[T[thm]] +=1 | |||||
inthm = thm | |||||
t = beginnamedthm.replace("_ThmType_",thm.capitalize()) | |||||
t = t.replace("_ThmNumb_",str(count[T[thm]])) | |||||
t = t.replace("_ThmName_",thname) | |||||
return(t) | |||||
def convertbeginthm(thm) : | |||||
global inthm | |||||
count[T[thm]] +=1 | |||||
inthm = thm | |||||
t = beginthm.replace("_ThmType_",thm.capitalize()) | |||||
t = t.replace("_ThmNumb_",str(count[T[thm]])) | |||||
return(t) | |||||
def convertendthm(thm) : | |||||
global inthm | |||||
inthm = "" | |||||
return(endthm) | |||||
def convertlab(m) : | |||||
global inthm | |||||
global ref | |||||
m=cb.split(m)[1] | |||||
m=m.replace(":","") | |||||
if inthm != "" : | |||||
ref[m]=count[T[inthm]] | |||||
else : | |||||
ref[m]=count["section"] | |||||
return("<a name=\""+m+"\"></a>") | |||||
def convertproof(m) : | |||||
if m.find("begin") != -1 : | |||||
return(beginproof) | |||||
else : | |||||
return(endproof) | |||||
def convertsection (m) : | |||||
L=cb.split(m) | |||||
""" | |||||
L[0] contains the \\section or \\section* command, and | |||||
L[1] contains the section name | |||||
""" | |||||
if L[0].find("*") == -1 : | |||||
t=section | |||||
count["section"] += 1 | |||||
count["subsection"]=0 | |||||
else : | |||||
t=sectionstar | |||||
t=t.replace("_SecNumb_",str(count["section"]) ) | |||||
t=t.replace("_SecName_",L[1]) | |||||
return(t) | |||||
def convertsubsection (m) : | |||||
L=cb.split(m) | |||||
if L[0].find("*") == -1 : | |||||
t=subsection | |||||
else : | |||||
t=subsectionstar | |||||
count["subsection"] += 1 | |||||
t=t.replace("_SecNumb_",str(count["section"]) ) | |||||
t=t.replace("_SubSecNumb_",str(count["subsection"]) ) | |||||
t=t.replace("_SecName_",L[1]) | |||||
return(t) | |||||
def converturl (m) : | |||||
L = cb.split(m) | |||||
return ("<a href=\""+L[1]+"\">"+L[3]+"</a>") | |||||
def converturlnosnap (m) : | |||||
L = cb.split(m) | |||||
return ("<a class=\"snap_noshots\" href=\""+L[1]+"\">"+L[3]+"</a>") | |||||
def convertimage (m) : | |||||
L = cb.split (m) | |||||
return ("<p align=center><img "+L[1] + " src=\""+L[3] | |||||
+"\"></p>") | |||||
def convertstrike (m) : | |||||
L=cb.split(m) | |||||
return("<s>"+L[1]+"</s>") | |||||
def processtext ( t ) : | |||||
p = re.compile("\\\\begin\\{\\w+}" | |||||
"|\\\\nbegin\\{\\w+}\\s*\\{.*?}" | |||||
"|\\\\end\\{\\w+}" | |||||
"|\\\\item" | |||||
"|\\\\nitem\\s*\\{.*?}" | |||||
"|\\\\label\\s*\\{.*?}" | |||||
"|\\\\section\\s*\\{.*?}" | |||||
"|\\\\section\\*\\s*\\{.*?}" | |||||
"|\\\\subsection\\s*\\{.*?}" | |||||
"|\\\\subsection\\*\\s*\\{.*?}" | |||||
"|\\\\href\\s*\\{.*?}\\s*\\{.*?}" | |||||
"|\\\\hrefnosnap\\s*\\{.*?}\\s*\\{.*?}" | |||||
"|\\\\image\\s*\\{.*?}\\s*\\{.*?}\\s*\\{.*?}" | |||||
"|\\\\sout\\s*\\{.*?}") | |||||
for s1, s2 in Mnomath : | |||||
t=t.replace(s1,s2) | |||||
ttext = p.split(t) | |||||
tcontrol = p.findall(t) | |||||
w = ttext[0] | |||||
i=0 | |||||
while i < len(tcontrol) : | |||||
if tcontrol[i].find("{itemize}") != -1 : | |||||
w=w+convertitm(tcontrol[i]) | |||||
elif tcontrol[i].find("{enumerate}") != -1 : | |||||
w= w+convertenum(tcontrol[i]) | |||||
elif tcontrol[i][0:5]=="\\item" : | |||||
w=w+"<li>" | |||||
elif tcontrol[i][0:6]=="\\nitem" : | |||||
lb = tcontrol[i][7:].replace("{","") | |||||
lb = lb.replace("}","") | |||||
w=w+"<li>"+lb | |||||
elif tcontrol[i].find("\\hrefnosnap") != -1 : | |||||
w = w+converturlnosnap(tcontrol[i]) | |||||
elif tcontrol[i].find("\\href") != -1 : | |||||
w = w+converturl(tcontrol[i]) | |||||
elif tcontrol[i].find("{proof}") != -1 : | |||||
w = w+convertproof(tcontrol[i]) | |||||
elif tcontrol[i].find("\\subsection") != -1 : | |||||
w = w+convertsubsection(tcontrol[i]) | |||||
elif tcontrol[i].find("\\section") != -1 : | |||||
w = w+convertsection(tcontrol[i]) | |||||
elif tcontrol[i].find("\\label") != -1 : | |||||
w=w+convertlab(tcontrol[i]) | |||||
elif tcontrol[i].find("\\image") != -1 : | |||||
w = w+convertimage(tcontrol[i]) | |||||
elif tcontrol[i].find("\\sout") != -1 : | |||||
w = w+convertstrike(tcontrol[i]) | |||||
elif tcontrol[i].find("\\begin") !=-1 and tcontrol[i].find("{center}")!= -1 : | |||||
w = w+"<p align=center>" | |||||
elif tcontrol[i].find("\\end")!= -1 and tcontrol[i].find("{center}") != -1 : | |||||
w = w+"</p>" | |||||
else : | |||||
for clr in colorchoice : | |||||
if tcontrol[i].find("{"+clr+"}") != -1: | |||||
w=w + convertcolors(tcontrol[i],clr) | |||||
for thm in ThmEnvs : | |||||
if tcontrol[i]=="\\end{"+thm+"}" : | |||||
w=w+convertendthm(thm) | |||||
elif tcontrol[i]=="\\begin{"+thm+"}": | |||||
w=w+convertbeginthm(thm) | |||||
elif tcontrol[i].find("\\nbegin{"+thm+"}") != -1: | |||||
L=cb.split(tcontrol[i]) | |||||
thname=L[3] | |||||
w=w+convertbeginnamedthm(thname,thm) | |||||
w += ttext[i+1] | |||||
i += 1 | |||||
return processfontstyle(w) | |||||
def processfontstyle(w) : | |||||
close = dict() | |||||
ww = "" | |||||
level = i = 0 | |||||
while i < len(w): | |||||
special = False | |||||
for k, v in fontstyle.items(): | |||||
l = len(k) | |||||
if w[i:i+l] == k: | |||||
level += 1 | |||||
ww += '<' + v + '>' | |||||
close[level] = '</' + v + '>' | |||||
i += l | |||||
special = True | |||||
if not special: | |||||
if w[i] == '{': | |||||
ww += '{' | |||||
level += 1 | |||||
close[level] = '}' | |||||
elif w[i] == '}' and level > 0: | |||||
ww += close[level] | |||||
level -= 1 | |||||
else: | |||||
ww += w[i] | |||||
i += 1 | |||||
return ww | |||||
def convertref(m) : | |||||
global ref | |||||
p=re.compile("\\\\ref\s*\\{.*?}|\\\\eqref\s*\\{.*?}") | |||||
T=p.split(m) | |||||
M=p.findall(m) | |||||
w = T[0] | |||||
for i in range(len(M)) : | |||||
t=M[i] | |||||
lab=cb.split(t)[1] | |||||
lab=lab.replace(":","") | |||||
if t.find("\\eqref") != -1 : | |||||
w=w+"<a href=\"#"+lab+"\">("+str(ref[lab])+")</a>" | |||||
else : | |||||
w=w+"<a href=\"#"+lab+"\">"+str(ref[lab])+"</a>" | |||||
w=w+T[i+1] | |||||
return w | |||||
""" | |||||
The program makes several passes through the input. | |||||
In a first clean-up, all text before \begin{document} | |||||
and after \end{document}, if present, is removed, | |||||
all double-returns are converted | |||||
to <p>, and all remaining returns are converted to | |||||
spaces. | |||||
The second step implements a few simple macros. The user can | |||||
add support for more macros if desired by editing the | |||||
convertmacros() procedure. | |||||
Then the program separates the mathematical | |||||
from the text parts. (It assumes that the document does | |||||
not start with a mathematical expression.) | |||||
It makes one pass through the text part, translating | |||||
environments such as theorem, lemma, proof, enumerate, itemize, | |||||
\em, and \bf. Along the way, it keeps counters for the current | |||||
section and subsection and for the current numbered theorem-like | |||||
environment, as well as a flag that tells whether one is | |||||
inside a theorem-like environment or not. Every time a \label{xx} | |||||
command is encountered, we give ref[xx] the value of the section | |||||
in which the command appears, or the number of the theorem-like | |||||
environment in which it appears (if applicable). Each appearence | |||||
of \label is replace by an html "name" tag, so that later we can | |||||
replace \ref commands by clickable html links. | |||||
The next step is to make a pass through the mathematical environments. | |||||
Displayed equations are numbered and centered, and when a \label{xx} | |||||
command is encountered we give ref[xx] the number of the current | |||||
equation. | |||||
A final pass replaces \ref{xx} commands by the number in ref[xx], | |||||
and a clickable link to the referenced location. | |||||
""" | |||||
inputfile = "wpress.tex" | |||||
outputfile = "wpress.html" | |||||
if len(argv) > 1 : | |||||
inputfile = argv[1] | |||||
if len(argv) > 2 : | |||||
outputfile = argv[2] | |||||
else : | |||||
outputfile = inputfile.replace(".tex",".html") | |||||
f=open(inputfile) | |||||
s=f.read() | |||||
f.close() | |||||
""" | |||||
extractbody() takes the text between a \begin{document} | |||||
and \end{document}, if present, (otherwise it keeps the | |||||
whole document), normalizes the spacing, and removes comments | |||||
""" | |||||
s=extractbody(s) | |||||
# formats tables | |||||
s=converttables(s) | |||||
# reformats optional parameters passed in square brackets | |||||
s=convertsqb(s) | |||||
#implement simple macros | |||||
s=convertmacros(s) | |||||
# extracts the math parts, and replaces the with placeholders | |||||
# processes math and text separately, then puts the processed | |||||
# math equations in place of the placeholders | |||||
(math,text) = separatemath(s) | |||||
s=text[0] | |||||
for i in range(len(math)) : | |||||
s=s+"__math"+str(i)+"__"+text[i+1] | |||||
s = processtext ( s ) | |||||
math = processmath ( math ) | |||||
# converts escape sequences such as \$ to HTML codes | |||||
# This must be done after formatting the tables or the '&' in | |||||
# the HTML codes will create problems | |||||
for e in esc : | |||||
s=s.replace(e[1],e[2]) | |||||
for i in range ( len ( math ) ) : | |||||
math[i] = math[i].replace(e[1],e[3]) | |||||
# puts the math equations back into the text | |||||
for i in range(len(math)) : | |||||
s=s.replace("__math"+str(i)+"__",math[i]) | |||||
# translating the \ref{} commands | |||||
s=convertref(s) | |||||
if HTML : | |||||
s="<head><style>body{max-width:55em;}a:link{color:#4444aa;}a:visited{color:#4444aa;}a:hover{background-color:#aaaaFF;}</style></head><body>"+s+"</body></html>" | |||||
s = s.replace("<p>","\n<p>\n") | |||||
f=open(outputfile,"w") | |||||
f.write(s) | |||||
f.close() |
@ -0,0 +1,108 @@ | |||||
""" | |||||
Copyright 2009 Luca Trevisan | |||||
Additional contributors: Radu Grigore | |||||
LaTeX2WP version 0.6.2 | |||||
This file is part of LaTeX2WP, a program that converts | |||||
a LaTeX document into a format that is ready to be | |||||
copied and pasted into WordPress. | |||||
You are free to redistribute and/or modify LaTeX2WP under the | |||||
terms of the GNU General Public License (GPL), version 3 | |||||
or (at your option) any later version. | |||||
I hope you will find LaTeX2WP useful, but be advised that | |||||
it comes WITHOUT ANY WARRANTY; without even the implied warranty | |||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GPL for more details. | |||||
You should have received a copy of the GNU General Public | |||||
License along with LaTeX2WP. If you can't find it, | |||||
see <http://www.gnu.org/licenses/>. | |||||
""" | |||||
# Lines starting with #, like this one, are comments | |||||
# change to HTML = True to produce standard HTML | |||||
HTML = False | |||||
# color of LaTeX formulas | |||||
textcolor = "000000" | |||||
# colors that can be used in the text | |||||
colors = { "red" : "ff0000" , "green" : "00ff00" , "blue" : "0000ff" } | |||||
# list of colors defined above | |||||
colorchoice = ["red","green","blue"] | |||||
# counters for theorem-like environments | |||||
# assign any counter to any environment. Make sure that | |||||
# maxcounter is an upper bound to the any counter being used | |||||
T = { "theorem" : 0 , "lemma" : 0 , "proposition" : 0, "definition" : 0, | |||||
"corollary" : 0, "remark" : 3 , "example" : 1, "claim" : 4, | |||||
"exercise" : 2 } | |||||
# list of theorem-like environments | |||||
ThmEnvs = ["theorem","definition","lemma","proposition","corollary","claim", | |||||
"remark","example","exercise"] | |||||
# the way \begin{theorem}, \begin{lemma} etc are translated in HTML | |||||
# the string _ThmType_ stands for the type of theorem | |||||
# the string _ThmNumb_ is the theorem number | |||||
beginthm = "\n<blockquote><b>_ThmType_ _ThmNumb_</b> <em>" | |||||
# translation of \begin{theorem}[...]. The string | |||||
# _ThmName_ stands for the content betwee the | |||||
# square brackets | |||||
beginnamedthm = "\n<blockquote><b>_ThmType_ _ThmNumb_ (_ThmName_)</b> <em>" | |||||
#translation of \end{theorem}, \end{lemma}, etc. | |||||
endthm = "</em></blockquote>\n<p>\n" | |||||
beginproof = "<em>Proof:</em> " | |||||
endproof = "$latex \Box&fg=000000$\n\n" | |||||
section = "\n<p>\n<b>_SecNumb_. _SecName_ </b>\n<p>\n" | |||||
sectionstar = "\n<p>\n<b> _SecName_ </b>\n<p>\n" | |||||
subsection = "\n<p>\n<b> _SecNumb_._SubSecNumb_. _SecName_ </b>\n<p>\n" | |||||
subsectionstar = "\n<p>\n<b> _SecName_ </b>\n<p>\n" | |||||
# Font styles. Feel free to add others. The key *must* contain | |||||
# an open curly bracket. The value is the namem of a HTML tag. | |||||
fontstyle = { | |||||
r'{\em ' : 'em', | |||||
r'{\bf ' : 'b', | |||||
r'{\it ' : 'i', | |||||
r'{\sl ' : 'i', | |||||
r'\textit{' : 'i', | |||||
r'\textsl{' : 'i', | |||||
r'\emph{' : 'em', | |||||
r'\textbf{' : 'b', | |||||
} | |||||
# Macro definitions | |||||
# It is a sequence of pairs [string1,string2], and | |||||
# latex2wp will replace each occurrence of string1 with an | |||||
# occurrence of string2. The substitutions are performed | |||||
# in the same order as the pairs appear below. | |||||
# Feel free to add your own. | |||||
# Note that you have to write \\ instead of \ | |||||
# and \" instead of " | |||||
M = [ ["\\to","\\rightarrow"] , | |||||
["\\B","\\{ 0,1 \\}" ], | |||||
["\\E","\mathop{\\mathbb E}"], | |||||
["\\P","\mathop{\\mathbb P}"], | |||||
["\\N","{\\mathbb N}"], | |||||
["\\Z","{\\mathbb Z}"], | |||||
["\\C","{\\mathbb C}"], | |||||
["\\R","{\\mathbb R}"], | |||||
["\\Q","{\\mathbb Q}"], | |||||
["\\xor","\\oplus"], | |||||
["\\eps","\\epsilon"] | |||||
] | |||||
@ -0,0 +1,3 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Details}{1}} |
@ -0,0 +1,177 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 1 AUG 2019 01:29 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_G | |||||
nulinux_Mdadm_Reference/docs/1.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_Gn | |||||
ulinux_Mdadm_Reference/docs/1.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./1.aux) | |||||
\openout1 = `1.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./1.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2509 strings out of 495020 | |||||
40097 string characters out of 6181323 | |||||
92808 words of memory out of 5000000 | |||||
5736 multiletter control sequences out of 15000+600000 | |||||
4853 words of font info for 18 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,4n,38p,479b,109s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/tex | |||||
live/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/texlive/t | |||||
exmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texlive/texmf-d | |||||
ist/fonts/type1/public/amsfonts/cm/cmr10.pfb> | |||||
Output written on 1.pdf (1 page, 41285 bytes). | |||||
PDF statistics: | |||||
20 PDF objects out of 1000 (max. 8388607) | |||||
13 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,21 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{RAID on GnuLinux - Mdadm}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{07/31/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{RAID on GnuLinux - Mdadm} | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
There are a few options for RAID on Gnu Linux. Among them is BtrFS, ZFS, however today I will focus on the software RAID solution using mdadm. This is historically the oldest software raid, therefore should be better vetted, although its performance may be slightly less of that of the first two mentioned. For simple servers, mdadm might be the most stable choice. | |||||
\section{Details} | |||||
I've worked with this in setting up some Core 2 Duo PCs, with 2 to 4 Sata HDDs. Let's begin. | |||||
\end{document} |
@ -0,0 +1,28 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Router Fail - Network Down!}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Router Fail - Network Down} | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
A company had the internet go down. The way their system was built, they had a 2nd firewall behind a cable company router. I was able to access the network before the firewall, which meant that their firewall might've failed. | |||||
\section{Diagnosis} | |||||
The internal firewall had no LED power light or activity. So, no internet. | |||||
First, their network was a 192.168.0.0/24 subnet. I first put them behind a second wireless router which was upstream of the cable modem and not offline. However the network of that internet router was 192.168.1.0/24. This means a few things. 1) All computers (Windows unfortunately), must be set to DHCP (in this case they were all static), and leases must be renewed. So, at least you need a reboot of computers in this situation. 2) They had server software in the LAN that depended upon the 192.168.0.0/24 subnet to work. I didn't find this out until later. | |||||
Originally, I started with the default wireless network of 192.168.1.0/24 but I found that the server software wasn't working. In this case, the most efficient way to rebuild the network, with all the statics intact, was to set the new (temporary) replacement router to be the same subnet. I didn't have the password for the wireless router, so a simple factory reset enabled me access (although lucky for me, the default subnet was in fact 192.168.0.0/24). | |||||
\section{Conclusion} | |||||
When replacing a failed router in a situation like this, the new router should ideally have the same subnet. You might be able to get away without this in smaller offices, but if there is any server software, or if the computers have static IPs \footnote{Or if any other device hsa a static ip, e.g. CCTV camera} you will run into a few more minutes of work. | |||||
There are no rules; this is not set in stone, however, it's the easiest path. As this was only a temporary router replacement, it was not important to have the network 1:1 with the original. In my setups, (this network was not mine) I prefer to have redundant hardware, so you can replace a broken firewall, with a similarly configured duplicate. | |||||
\end{document} |
@ -0,0 +1,8 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Details}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Creation of RAID:}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Details of RAID:}{2}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Add Drive to RAID:}{3}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.4}Email Notifications on mdadm}{5}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {3}References}{6}} |
@ -0,0 +1,314 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 1 AUG 2019 01:44 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_G | |||||
nulinux_Mdadm_Reference/docs/2.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_Gn | |||||
ulinux_Mdadm_Reference/docs/2.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./2.aux) | |||||
\openout1 = `2.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 16--19 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 16--19 | |||||
[] | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <10.95> on input line 29. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <8> on input line 29. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <6> on input line 29. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <9> on input line 29. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <5> on input line 29. | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 103--103 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 103--103 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 105--108 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 105--108 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 109--124 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 109--124 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 109--124 | |||||
[] | |||||
Overfull \hbox (6.79498pt too wide) in paragraph at lines 109--124 | |||||
\OT1/cmr/m/n/10.95 https://unix.stackexchange.com/questions/12986/how-to-copy-t | |||||
he-partition- | |||||
[] | |||||
Overfull \hbox (36.65945pt too wide) in paragraph at lines 142--142 | |||||
[]\OT1/cmtt/m/n/10.95 sgdisk --backup=/partitions-backup-$(basename $source).sg | |||||
disk $source[] | |||||
[] | |||||
Overfull \hbox (13.6647pt too wide) in paragraph at lines 142--142 | |||||
[]\OT1/cmtt/m/n/10.95 sgdisk --backup=/partitions-backup-$(basename $dest).sgdi | |||||
sk $dest[] | |||||
[] | |||||
[3] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 179--179 | |||||
[] \OT1/cmtt/m/n/10.95 3 8 1 0 spare rebuilding | |||||
/dev/sda1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 179--179 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 179--179 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
[4] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 192--192 | |||||
[] \OT1/cmtt/m/n/10.95 3 8 1 0 spare rebuilding | |||||
/dev/sda1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 192--192 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 192--192 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Overfull \hbox (128.63846pt too wide) in paragraph at lines 210--210 | |||||
[]\OT1/cmtt/m/n/10.95 Personalities : [raid1] [linear] [multipath] [raid0] [rai | |||||
d6] [raid5] [raid4] [raid10][] | |||||
[] | |||||
Overfull \hbox (203.3714pt too wide) in paragraph at lines 210--210 | |||||
[] \OT1/cmtt/m/n/10.95 [==>..................] recovery = 11.2% (6471936/ | |||||
57638912) finish=13.2min speed=64324K/sec[] | |||||
[] | |||||
Overfull \hbox (36.65945pt too wide) in paragraph at lines 241--241 | |||||
[]\OT1/cmtt/m/n/10.95 https://help.ubuntu.com/lts/serverguide/advanced-installa | |||||
tion.html.en[] | |||||
[] | |||||
[5] | |||||
Overfull \hbox (13.6647pt too wide) in paragraph at lines 241--241 | |||||
[]\OT1/cmtt/m/n/10.95 https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Roo | |||||
t-on-ZFS[] | |||||
[] | |||||
[6] (./2.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2539 strings out of 495020 | |||||
40443 string characters out of 6181323 | |||||
96808 words of memory out of 5000000 | |||||
5756 multiletter control sequences out of 15000+600000 | |||||
8977 words of font info for 32 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,8n,38p,479b,241s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||||
bx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.p | |||||
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></us | |||||
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/ | |||||
texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/ | |||||
texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-di | |||||
st/fonts/type1/public/amsfonts/cm/cmtt10.pfb> | |||||
Output written on 2.pdf (6 pages, 103394 bytes). | |||||
PDF statistics: | |||||
51 PDF objects out of 1000 (max. 8388607) | |||||
35 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,242 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{RAID on GnuLinux - Mdadm}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{07/31/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{RAID on GnuLinux - Mdadm} | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
There are a few options for RAID on Gnu Linux. Among them is BtrFS, ZFS, however today I will focus on the software RAID solution using mdadm. This is historically the oldest software raid, therefore should be better vetted, although its performance may be slightly less of that of the first two mentioned. For simple servers, mdadm might be the most stable choice. | |||||
\section{Details} | |||||
I've worked with this in setting up some Core 2 Duo PCs, with 2 to 4 Sata HDDs. Let's begin. | |||||
\\ | |||||
\\ | |||||
\subsection{Creation of RAID:} | |||||
I'll need to have partitions be the same if adding a replacement or new disk. | |||||
I'm going to make a boot partition of 10GB, | |||||
a swap of 2GB | |||||
and the 50GB home / data partition | |||||
First let's clear partition tables, with sgdisk again. | |||||
\footnote{Ref: https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS} | |||||
\begin{verbatim} | |||||
sgdisk --zap-all /dev/sda | |||||
sgdisk --zap-all /dev/sdb | |||||
sgdisk --zap-all /dev/sdc | |||||
*needs gdisk | |||||
fdisk /dev/sda | |||||
First put the 55GB Root in. | |||||
n | |||||
-return | |||||
-return | |||||
-return | |||||
+55G | |||||
Then swap | |||||
n | |||||
-return | |||||
-return | |||||
-return | |||||
+8G | |||||
t | |||||
-return | |||||
82 | |||||
\end{verbatim} | |||||
This is for swap | |||||
The setup will be root of 55G, then swap. | |||||
We will be generous with swap, even though it's probably not necessary to go | |||||
over 4GB | |||||
Do this for all HDD in the raid. | |||||
EDIT: you can clone hdds partitions tables. See further down this doc. | |||||
\subsection{Details of RAID:} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 2 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:40:44 2019 | |||||
State : clean, degraded | |||||
Active Devices : 2 | |||||
Working Devices : 2 | |||||
Failed Devices : 0 | |||||
Spare Devices : 0 | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 82 | |||||
Number Major Minor RaidDevice State | |||||
- 0 0 0 removed | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev#-- | |||||
\end{verbatim} | |||||
so you can see, one was removed (it auto removes, when unplugged) | |||||
\\ | |||||
\\ | |||||
\subsection{Add Drive to RAID:} | |||||
sudo mdadm --add /dev/md127 /dev/sda1 | |||||
\\ | |||||
\\ | |||||
NOTE2: If you setup 2 hdds, in a raid, and want to add a third, if you just --add, it will show up as a spare... | |||||
if you do mdadm --grow /dev/md127 -raid-devices=3 then the third might be active sync (what we want) | |||||
note that the --grow, seems to allow for parameter changes after you have already created the raid. you can also specify | |||||
the exact same command, raid-devices=3 in the setup of the raid (see install doc) | |||||
\\ | |||||
\\ | |||||
NOTE: don't worry about mkfs.ext4 on the raid members, they are their own file system type | |||||
\\ | |||||
\\ | |||||
NOTE: if you have a new drive and need to copy the hdd partition tables: | |||||
https://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools | |||||
or aka | |||||
\begin{verbatim} | |||||
(FOR MBR ONLY) | |||||
Save: | |||||
sfdisk -d /dev/sda > part_table | |||||
Restore: | |||||
sfdisk /dev/NEWHDD < part_table | |||||
(FOR GPT:) | |||||
# Save MBR disks | |||||
sgdisk --backup=/partitions-backup-$(basename $source).sgdisk $source | |||||
sgdisk --backup=/partitions-backup-$(basename $dest).sgdisk $dest | |||||
# Copy $source layout to $dest and regenerate GUIDs | |||||
sgdisk --replicate=$dest $source | |||||
sgdisk -G $dest | |||||
\end{verbatim} | |||||
NOTE: don't worry about mkfs.ext4 on the raid members, they are their own file system type | |||||
No need for ext4 here. | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# mdadm --add /dev/md127 /dev/sda1 | |||||
mdadm: added /dev/sda1 | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 3 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:41:43 2019 | |||||
State : clean, degraded, recovering | |||||
Active Devices : 2 | |||||
Working Devices : 3 | |||||
Failed Devices : 0 | |||||
Spare Devices : 1 | |||||
Rebuild Status : 0% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 92 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev# | |||||
\end{verbatim} | |||||
Looks good. | |||||
\begin{verbatim} | |||||
Rebuild Status : 6% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 103 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
\end{verbatim} | |||||
as it progresses, you see the RAID rebuilding. | |||||
\begin{verbatim} | |||||
watch -n1 cat /proc/mdstat | |||||
Every 1.0s: cat /proc/mdstat | |||||
advacoONE: Fri Feb 1 02:43:24 2019 | |||||
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] | |||||
md127 : active raid1 sda1[3] sdb1[1] sdc1[2] | |||||
57638912 blocks super 1.2 [3/2] [_UU] | |||||
[==>..................] recovery = 11.2% (6471936/57638912) finish=13.2min speed=64324K/sec | |||||
unused devices: <none> | |||||
\end{verbatim} | |||||
\textbf{WARNING:} Reinstall grub on the drive again as well afterwards. | |||||
\subsection{Email Notifications on mdadm} | |||||
Test emails on mdadm.. first configure email however you prefer (i currently use ssmtp, see this link: wiki.zoneminder.com/SMS\_Notifications) | |||||
then edit /etc/mdadm/mdadm.conf to have your email in mailaddr | |||||
then | |||||
\begin{verbatim} | |||||
sudo mdadm --monitor --scan --test --oneshot | |||||
\end{verbatim} | |||||
should send an email | |||||
https://ubuntuforums.org/showthread.php?t=1185134 | |||||
for more details on email sending | |||||
\section{References} | |||||
\begin{verbatim} | |||||
The section about degraded disks | |||||
https://help.ubuntu.com/lts/serverguide/advanced-installation.html.en | |||||
General partition tips. | |||||
https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS | |||||
SSMTP email setup: | |||||
wiki.zoneminder.com/SMS\_Notifications | |||||
\end{verbatim} | |||||
\end{document} |
@ -0,0 +1,21 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{RAID on GnuLinux - Mdadm}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{07/31/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{RAID on GnuLinux - Mdadm} | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
There are a few options for RAID on Gnu Linux. Among them is BtrFS, ZFS, however today I will focus on the software RAID solution using mdadm. This is historically the oldest software raid, therefore should be better vetted, although its performance may be slightly less of that of the first two mentioned. For simple servers, mdadm might be the most stable choice. | |||||
\section{Details} | |||||
I've worked with this in setting up some Core 2 Duo PCs, with 2 to 4 Sata HDDs. Let's begin. | |||||
\end{document} |
@ -0,0 +1,8 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Details}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Creation of RAID:}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Details of RAID:}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Add Drive to RAID:}{2}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.4}Email Notifications on mdadm}{4}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {3}References}{5}} |
@ -0,0 +1,313 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 1 AUG 2019 01:51 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_G | |||||
nulinux_Mdadm_Reference/docs/3.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_Gn | |||||
ulinux_Mdadm_Reference/docs/3.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./3.aux) | |||||
\openout1 = `3.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 16--19 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 16--19 | |||||
[] | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 52--52 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 52--52 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 54--57 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 54--57 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 58--73 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 58--73 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 58--73 | |||||
[] | |||||
Overfull \hbox (6.79498pt too wide) in paragraph at lines 58--73 | |||||
\OT1/cmr/m/n/10.95 https://unix.stackexchange.com/questions/12986/how-to-copy-t | |||||
he-partition- | |||||
[] | |||||
[2] | |||||
Overfull \hbox (36.65945pt too wide) in paragraph at lines 91--91 | |||||
[]\OT1/cmtt/m/n/10.95 sgdisk --backup=/partitions-backup-$(basename $source).sg | |||||
disk $source[] | |||||
[] | |||||
Overfull \hbox (13.6647pt too wide) in paragraph at lines 91--91 | |||||
[]\OT1/cmtt/m/n/10.95 sgdisk --backup=/partitions-backup-$(basename $dest).sgdi | |||||
sk $dest[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 126--126 | |||||
[] \OT1/cmtt/m/n/10.95 3 8 1 0 spare rebuilding | |||||
/dev/sda1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 126--126 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
[3] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 126--126 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 139--139 | |||||
[] \OT1/cmtt/m/n/10.95 3 8 1 0 spare rebuilding | |||||
/dev/sda1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 139--139 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 139--139 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Overfull \hbox (128.63846pt too wide) in paragraph at lines 157--157 | |||||
[]\OT1/cmtt/m/n/10.95 Personalities : [raid1] [linear] [multipath] [raid0] [rai | |||||
d6] [raid5] [raid4] [raid10][] | |||||
[] | |||||
Overfull \hbox (203.3714pt too wide) in paragraph at lines 157--157 | |||||
[] \OT1/cmtt/m/n/10.95 [==>..................] recovery = 11.2% (6471936/ | |||||
57638912) finish=13.2min speed=64324K/sec[] | |||||
[] | |||||
Overfull \hbox (110.07799pt too wide) in paragraph at lines 163--165 | |||||
\OT1/cmr/m/n/10.95 use ssmtp, see this link: https://wiki.zoneminder.com/How[]t | |||||
o[]get[]ssmtp[]working[]with[]Zoneminder | |||||
[] | |||||
[4] | |||||
Overfull \hbox (36.65945pt too wide) in paragraph at lines 191--191 | |||||
[]\OT1/cmtt/m/n/10.95 https://help.ubuntu.com/lts/serverguide/advanced-installa | |||||
tion.html.en[] | |||||
[] | |||||
Overfull \hbox (13.6647pt too wide) in paragraph at lines 191--191 | |||||
[]\OT1/cmtt/m/n/10.95 https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Roo | |||||
t-on-ZFS[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 191--191 | |||||
[]\OT1/cmtt/m/n/10.95 https://wiki.zoneminder.com/How_to_get_ssmtp_working_with | |||||
_Zoneminder[] | |||||
[] | |||||
[5] (./3.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2514 strings out of 495020 | |||||
40168 string characters out of 6181323 | |||||
96818 words of memory out of 5000000 | |||||
5740 multiletter control sequences out of 15000+600000 | |||||
5626 words of font info for 21 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,4n,38p,456b,243s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||||
bx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.p | |||||
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></us | |||||
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb> | |||||
Output written on 3.pdf (5 pages, 74754 bytes). | |||||
PDF statistics: | |||||
36 PDF objects out of 1000 (max. 8388607) | |||||
24 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,192 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{RAID on GnuLinux - Mdadm Reference}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{07/31/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{RAID on GnuLinux - Mdadm Reference} | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
There are a few options for software RAID on Gnu Linux. Among them is BtrFS and ZFS, however today I will focus on using mdadm. This is historically the oldest software raid, therefore should be better vetted, although its performance may be less of that of the first two mentioned - for simple servers, mdadm might be the most stable choice. | |||||
\section{Details} | |||||
I've worked with this in setting up some Core 2 Duo PCs, with 2 to 4 Sata HDDs. This will be a reference. Let's begin. | |||||
\\ | |||||
\\ | |||||
\subsection{Creation of RAID:} | |||||
Will not be covered here (yet). You must create the partition tables. Create the raid with mdadm. mkfs.ext4 on the raid partition. Add mdadm to grub config. Reinstall grub. Details may be provided later. | |||||
\subsection{Details of RAID:} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 2 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:40:44 2019 | |||||
State : clean, degraded | |||||
Active Devices : 2 | |||||
Working Devices : 2 | |||||
Failed Devices : 0 | |||||
Spare Devices : 0 | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 82 | |||||
Number Major Minor RaidDevice State | |||||
- 0 0 0 removed | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev#-- | |||||
\end{verbatim} | |||||
so you can see, one was removed (it auto removes, when unplugged) | |||||
\\ | |||||
\\ | |||||
\subsection{Add Drive to RAID:} | |||||
sudo mdadm --add /dev/md127 /dev/sda1 | |||||
\\ | |||||
\\ | |||||
NOTE2: If you setup 2 hdds, in a raid, and want to add a third, if you just --add, it will show up as a spare... | |||||
if you do mdadm --grow /dev/md127 -raid-devices=3 then the third might be active sync (what we want) | |||||
note that the --grow, seems to allow for parameter changes after you have already created the raid. you can also specify | |||||
the exact same command, raid-devices=3 in the setup of the raid (see install doc). Note that if you lose a drive, you can simply add it. | |||||
\\ | |||||
\\ | |||||
NOTE: don't worry about mkfs.ext4 on the raid members, after initial setup. The RAID will manage that. | |||||
\\ | |||||
\\ | |||||
NOTE: if you have a new drive and need to copy the hdd partition tables: | |||||
https://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools | |||||
or aka | |||||
\begin{verbatim} | |||||
(FOR MBR ONLY) | |||||
Save: | |||||
sfdisk -d /dev/sda > part_table | |||||
Restore: | |||||
sfdisk /dev/NEWHDD < part_table | |||||
(FOR GPT:) | |||||
# Save MBR disks | |||||
sgdisk --backup=/partitions-backup-$(basename $source).sgdisk $source | |||||
sgdisk --backup=/partitions-backup-$(basename $dest).sgdisk $dest | |||||
# Copy $source layout to $dest and regenerate GUIDs | |||||
sgdisk --replicate=$dest $source | |||||
sgdisk -G $dest | |||||
\end{verbatim} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# mdadm --add /dev/md127 /dev/sda1 | |||||
mdadm: added /dev/sda1 | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 3 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:41:43 2019 | |||||
State : clean, degraded, recovering | |||||
Active Devices : 2 | |||||
Working Devices : 3 | |||||
Failed Devices : 0 | |||||
Spare Devices : 1 | |||||
Rebuild Status : 0% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 92 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev# | |||||
\end{verbatim} | |||||
Looks good. | |||||
\begin{verbatim} | |||||
Rebuild Status : 6% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 103 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
\end{verbatim} | |||||
as it progresses, you see the RAID rebuilding. | |||||
\begin{verbatim} | |||||
watch -n1 cat /proc/mdstat | |||||
Every 1.0s: cat /proc/mdstat | |||||
advacoONE: Fri Feb 1 02:43:24 2019 | |||||
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] | |||||
md127 : active raid1 sda1[3] sdb1[1] sdc1[2] | |||||
57638912 blocks super 1.2 [3/2] [_UU] | |||||
[==>..................] recovery = 11.2% (6471936/57638912) finish=13.2min speed=64324K/sec | |||||
unused devices: <none> | |||||
\end{verbatim} | |||||
\textbf{WARNING:} Reinstall grub on the new drive again as well afterwards. | |||||
\subsection{Email Notifications on mdadm} | |||||
Test emails on mdadm.. first configure email however you prefer (i currently use ssmtp, see this link: | |||||
https://wiki.zoneminder.com/How\_to\_get\_ssmtp\_working\_with\_Zoneminder | |||||
then edit /etc/mdadm/mdadm.conf to have your email in mailaddr | |||||
then | |||||
\begin{verbatim} | |||||
sudo mdadm --monitor --scan --test --oneshot | |||||
\end{verbatim} | |||||
should send an email | |||||
https://ubuntuforums.org/showthread.php?t=1185134 | |||||
for more details on email sending | |||||
\section{References} | |||||
\begin{verbatim} | |||||
The section about degraded disks | |||||
https://help.ubuntu.com/lts/serverguide/advanced-installation.html.en | |||||
General partition tips. | |||||
https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS | |||||
SSMTP email setup: | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
wiki.zoneminder.com/SMS_Notifications | |||||
\end{verbatim} | |||||
\end{document} |
@ -0,0 +1,242 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{RAID on GnuLinux - Mdadm}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{07/31/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{RAID on GnuLinux - Mdadm} | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
There are a few options for RAID on Gnu Linux. Among them is BtrFS, ZFS, however today I will focus on the software RAID solution using mdadm. This is historically the oldest software raid, therefore should be better vetted, although its performance may be slightly less of that of the first two mentioned. For simple servers, mdadm might be the most stable choice. | |||||
\section{Details} | |||||
I've worked with this in setting up some Core 2 Duo PCs, with 2 to 4 Sata HDDs. Let's begin. | |||||
\\ | |||||
\\ | |||||
\subsection{Creation of RAID:} | |||||
I'll need to have partitions be the same if adding a replacement or new disk. | |||||
I'm going to make a boot partition of 10GB, | |||||
a swap of 2GB | |||||
and the 50GB home / data partition | |||||
First let's clear partition tables, with sgdisk again. | |||||
\footnote{Ref: https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS} | |||||
\begin{verbatim} | |||||
sgdisk --zap-all /dev/sda | |||||
sgdisk --zap-all /dev/sdb | |||||
sgdisk --zap-all /dev/sdc | |||||
*needs gdisk | |||||
fdisk /dev/sda | |||||
First put the 55GB Root in. | |||||
n | |||||
-return | |||||
-return | |||||
-return | |||||
+55G | |||||
Then swap | |||||
n | |||||
-return | |||||
-return | |||||
-return | |||||
+8G | |||||
t | |||||
-return | |||||
82 | |||||
\end{verbatim} | |||||
This is for swap | |||||
The setup will be root of 55G, then swap. | |||||
We will be generous with swap, even though it's probably not necessary to go | |||||
over 4GB | |||||
Do this for all HDD in the raid. | |||||
EDIT: you can clone hdds partitions tables. See further down this doc. | |||||
\subsection{Details of RAID:} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 2 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:40:44 2019 | |||||
State : clean, degraded | |||||
Active Devices : 2 | |||||
Working Devices : 2 | |||||
Failed Devices : 0 | |||||
Spare Devices : 0 | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 82 | |||||
Number Major Minor RaidDevice State | |||||
- 0 0 0 removed | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev#-- | |||||
\end{verbatim} | |||||
so you can see, one was removed (it auto removes, when unplugged) | |||||
\\ | |||||
\\ | |||||
\subsection{Add Drive to RAID:} | |||||
sudo mdadm --add /dev/md127 /dev/sda1 | |||||
\\ | |||||
\\ | |||||
NOTE2: If you setup 2 hdds, in a raid, and want to add a third, if you just --add, it will show up as a spare... | |||||
if you do mdadm --grow /dev/md127 -raid-devices=3 then the third might be active sync (what we want) | |||||
note that the --grow, seems to allow for parameter changes after you have already created the raid. you can also specify | |||||
the exact same command, raid-devices=3 in the setup of the raid (see install doc) | |||||
\\ | |||||
\\ | |||||
NOTE: don't worry about mkfs.ext4 on the raid members, they are their own file system type | |||||
\\ | |||||
\\ | |||||
NOTE: if you have a new drive and need to copy the hdd partition tables: | |||||
https://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools | |||||
or aka | |||||
\begin{verbatim} | |||||
(FOR MBR ONLY) | |||||
Save: | |||||
sfdisk -d /dev/sda > part_table | |||||
Restore: | |||||
sfdisk /dev/NEWHDD < part_table | |||||
(FOR GPT:) | |||||
# Save MBR disks | |||||
sgdisk --backup=/partitions-backup-$(basename $source).sgdisk $source | |||||
sgdisk --backup=/partitions-backup-$(basename $dest).sgdisk $dest | |||||
# Copy $source layout to $dest and regenerate GUIDs | |||||
sgdisk --replicate=$dest $source | |||||
sgdisk -G $dest | |||||
\end{verbatim} | |||||
NOTE: don't worry about mkfs.ext4 on the raid members, they are their own file system type | |||||
No need for ext4 here. | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# mdadm --add /dev/md127 /dev/sda1 | |||||
mdadm: added /dev/sda1 | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 3 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:41:43 2019 | |||||
State : clean, degraded, recovering | |||||
Active Devices : 2 | |||||
Working Devices : 3 | |||||
Failed Devices : 0 | |||||
Spare Devices : 1 | |||||
Rebuild Status : 0% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 92 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev# | |||||
\end{verbatim} | |||||
Looks good. | |||||
\begin{verbatim} | |||||
Rebuild Status : 6% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 103 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
\end{verbatim} | |||||
as it progresses, you see the RAID rebuilding. | |||||
\begin{verbatim} | |||||
watch -n1 cat /proc/mdstat | |||||
Every 1.0s: cat /proc/mdstat | |||||
advacoONE: Fri Feb 1 02:43:24 2019 | |||||
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] | |||||
md127 : active raid1 sda1[3] sdb1[1] sdc1[2] | |||||
57638912 blocks super 1.2 [3/2] [_UU] | |||||
[==>..................] recovery = 11.2% (6471936/57638912) finish=13.2min speed=64324K/sec | |||||
unused devices: <none> | |||||
\end{verbatim} | |||||
\textbf{WARNING:} Reinstall grub on the drive again as well afterwards. | |||||
\subsection{Email Notifications on mdadm} | |||||
Test emails on mdadm.. first configure email however you prefer (i currently use ssmtp, see this link: wiki.zoneminder.com/SMS\_Notifications) | |||||
then edit /etc/mdadm/mdadm.conf to have your email in mailaddr | |||||
then | |||||
\begin{verbatim} | |||||
sudo mdadm --monitor --scan --test --oneshot | |||||
\end{verbatim} | |||||
should send an email | |||||
https://ubuntuforums.org/showthread.php?t=1185134 | |||||
for more details on email sending | |||||
\section{References} | |||||
\begin{verbatim} | |||||
The section about degraded disks | |||||
https://help.ubuntu.com/lts/serverguide/advanced-installation.html.en | |||||
General partition tips. | |||||
https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS | |||||
SSMTP email setup: | |||||
wiki.zoneminder.com/SMS\_Notifications | |||||
\end{verbatim} | |||||
\end{document} |
@ -0,0 +1,8 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Details}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Creation of RAID:}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Details of RAID:}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Add Drive to RAID:}{2}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.4}Email Notifications on mdadm}{4}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {3}References}{5}} |
@ -0,0 +1,313 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 1 AUG 2019 01:52 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_G | |||||
nulinux_Mdadm_Reference/docs/4.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_Gn | |||||
ulinux_Mdadm_Reference/docs/4.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./4.aux) | |||||
\openout1 = `4.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 16--19 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 16--19 | |||||
[] | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 52--52 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 52--52 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 54--57 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 54--57 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 58--73 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 58--73 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 58--73 | |||||
[] | |||||
Overfull \hbox (6.79498pt too wide) in paragraph at lines 58--73 | |||||
\OT1/cmr/m/n/10.95 https://unix.stackexchange.com/questions/12986/how-to-copy-t | |||||
he-partition- | |||||
[] | |||||
[2] | |||||
Overfull \hbox (36.65945pt too wide) in paragraph at lines 91--91 | |||||
[]\OT1/cmtt/m/n/10.95 sgdisk --backup=/partitions-backup-$(basename $source).sg | |||||
disk $source[] | |||||
[] | |||||
Overfull \hbox (13.6647pt too wide) in paragraph at lines 91--91 | |||||
[]\OT1/cmtt/m/n/10.95 sgdisk --backup=/partitions-backup-$(basename $dest).sgdi | |||||
sk $dest[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 126--126 | |||||
[] \OT1/cmtt/m/n/10.95 3 8 1 0 spare rebuilding | |||||
/dev/sda1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 126--126 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
[3] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 126--126 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 139--139 | |||||
[] \OT1/cmtt/m/n/10.95 3 8 1 0 spare rebuilding | |||||
/dev/sda1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 139--139 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 139--139 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Overfull \hbox (128.63846pt too wide) in paragraph at lines 157--157 | |||||
[]\OT1/cmtt/m/n/10.95 Personalities : [raid1] [linear] [multipath] [raid0] [rai | |||||
d6] [raid5] [raid4] [raid10][] | |||||
[] | |||||
Overfull \hbox (203.3714pt too wide) in paragraph at lines 157--157 | |||||
[] \OT1/cmtt/m/n/10.95 [==>..................] recovery = 11.2% (6471936/ | |||||
57638912) finish=13.2min speed=64324K/sec[] | |||||
[] | |||||
Overfull \hbox (110.07799pt too wide) in paragraph at lines 163--166 | |||||
\OT1/cmr/m/n/10.95 use ssmtp, see this link: https://wiki.zoneminder.com/How[]t | |||||
o[]get[]ssmtp[]working[]with[]Zoneminder | |||||
[] | |||||
[4] | |||||
Overfull \hbox (36.65945pt too wide) in paragraph at lines 192--192 | |||||
[]\OT1/cmtt/m/n/10.95 https://help.ubuntu.com/lts/serverguide/advanced-installa | |||||
tion.html.en[] | |||||
[] | |||||
Overfull \hbox (13.6647pt too wide) in paragraph at lines 192--192 | |||||
[]\OT1/cmtt/m/n/10.95 https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Roo | |||||
t-on-ZFS[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 192--192 | |||||
[]\OT1/cmtt/m/n/10.95 https://wiki.zoneminder.com/How_to_get_ssmtp_working_with | |||||
_Zoneminder[] | |||||
[] | |||||
[5] (./4.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2514 strings out of 495020 | |||||
40168 string characters out of 6181323 | |||||
96818 words of memory out of 5000000 | |||||
5740 multiletter control sequences out of 15000+600000 | |||||
5626 words of font info for 21 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,4n,38p,456b,242s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||||
bx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.p | |||||
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></us | |||||
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb> | |||||
Output written on 4.pdf (5 pages, 74780 bytes). | |||||
PDF statistics: | |||||
36 PDF objects out of 1000 (max. 8388607) | |||||
24 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,193 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{RAID on GnuLinux - Mdadm Reference}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{07/31/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{RAID on GnuLinux - Mdadm Reference} | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
There are a few options for software RAID on Gnu Linux. Among them is BtrFS and ZFS, however today I will focus on using mdadm. This is historically the oldest software raid, therefore should be better vetted, although its performance may be less of that of the first two mentioned - for simple servers, mdadm might be the most stable choice. | |||||
\section{Details} | |||||
I've worked with this in setting up some Core 2 Duo PCs, with 2 to 4 Sata HDDs. This will be a reference. Let's begin. | |||||
\\ | |||||
\\ | |||||
\subsection{Creation of RAID:} | |||||
Will not be covered here (yet). You must create the partition tables. Create the raid with mdadm. mkfs.ext4 on the raid partition. Add mdadm to grub config. Reinstall grub. Details may be provided later. | |||||
\subsection{Details of RAID:} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 2 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:40:44 2019 | |||||
State : clean, degraded | |||||
Active Devices : 2 | |||||
Working Devices : 2 | |||||
Failed Devices : 0 | |||||
Spare Devices : 0 | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 82 | |||||
Number Major Minor RaidDevice State | |||||
- 0 0 0 removed | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev#-- | |||||
\end{verbatim} | |||||
so you can see, one was removed (it auto removes, when unplugged) | |||||
\\ | |||||
\\ | |||||
\subsection{Add Drive to RAID:} | |||||
sudo mdadm --add /dev/md127 /dev/sda1 | |||||
\\ | |||||
\\ | |||||
NOTE2: If you setup 2 hdds, in a raid, and want to add a third, if you just --add, it will show up as a spare... | |||||
if you do mdadm --grow /dev/md127 -raid-devices=3 then the third might be active sync (what we want) | |||||
note that the --grow, seems to allow for parameter changes after you have already created the raid. you can also specify | |||||
the exact same command, raid-devices=3 in the setup of the raid (see install doc). Note that if you lose a drive, you can simply add it. | |||||
\\ | |||||
\\ | |||||
NOTE: don't worry about mkfs.ext4 on the raid members, after initial setup. The RAID will manage that. | |||||
\\ | |||||
\\ | |||||
NOTE: if you have a new drive and need to copy the hdd partition tables: | |||||
https://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools | |||||
or aka | |||||
\begin{verbatim} | |||||
(FOR MBR ONLY) | |||||
Save: | |||||
sfdisk -d /dev/sda > part_table | |||||
Restore: | |||||
sfdisk /dev/NEWHDD < part_table | |||||
(FOR GPT:) | |||||
# Save MBR disks | |||||
sgdisk --backup=/partitions-backup-$(basename $source).sgdisk $source | |||||
sgdisk --backup=/partitions-backup-$(basename $dest).sgdisk $dest | |||||
# Copy $source layout to $dest and regenerate GUIDs | |||||
sgdisk --replicate=$dest $source | |||||
sgdisk -G $dest | |||||
\end{verbatim} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# mdadm --add /dev/md127 /dev/sda1 | |||||
mdadm: added /dev/sda1 | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 3 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:41:43 2019 | |||||
State : clean, degraded, recovering | |||||
Active Devices : 2 | |||||
Working Devices : 3 | |||||
Failed Devices : 0 | |||||
Spare Devices : 1 | |||||
Rebuild Status : 0% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 92 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev# | |||||
\end{verbatim} | |||||
Looks good. | |||||
\begin{verbatim} | |||||
Rebuild Status : 6% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 103 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
\end{verbatim} | |||||
as it progresses, you see the RAID rebuilding. | |||||
\begin{verbatim} | |||||
watch -n1 cat /proc/mdstat | |||||
Every 1.0s: cat /proc/mdstat | |||||
advacoONE: Fri Feb 1 02:43:24 2019 | |||||
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] | |||||
md127 : active raid1 sda1[3] sdb1[1] sdc1[2] | |||||
57638912 blocks super 1.2 [3/2] [_UU] | |||||
[==>..................] recovery = 11.2% (6471936/57638912) finish=13.2min speed=64324K/sec | |||||
unused devices: <none> | |||||
\end{verbatim} | |||||
\textbf{WARNING:} Reinstall grub on the new drive again as well afterwards. | |||||
\subsection{Email Notifications on mdadm} | |||||
Test emails on mdadm.. first configure email however you prefer (i currently use ssmtp, see this link: | |||||
https://wiki.zoneminder.com/How\_to\_get\_ssmtp\_working\_with\_Zoneminder | |||||
-- | |||||
then edit /etc/mdadm/mdadm.conf to have your email in mailaddr | |||||
then | |||||
\begin{verbatim} | |||||
sudo mdadm --monitor --scan --test --oneshot | |||||
\end{verbatim} | |||||
should send an email | |||||
https://ubuntuforums.org/showthread.php?t=1185134 | |||||
for more details on email sending | |||||
\section{References} | |||||
\begin{verbatim} | |||||
The section about degraded disks | |||||
https://help.ubuntu.com/lts/serverguide/advanced-installation.html.en | |||||
General partition tips. | |||||
https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS | |||||
SSMTP email setup: | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
wiki.zoneminder.com/SMS_Notifications | |||||
\end{verbatim} | |||||
\end{document} |
@ -0,0 +1,193 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{RAID on GnuLinux - Mdadm Reference}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{07/31/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{RAID on GnuLinux - Mdadm Reference} | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
There are a few options for software RAID on Gnu Linux. Among them is BtrFS and ZFS, however today I will focus on using mdadm. This is historically the oldest software raid, therefore should be better vetted, although its performance may be less of that of the first two mentioned - for simple servers, mdadm might be the most stable choice. | |||||
\section{Details} | |||||
I've worked with this in setting up some Core 2 Duo PCs, with 2 to 4 Sata HDDs. This will be a reference. Let's begin. | |||||
\\ | |||||
\\ | |||||
\subsection{Creation of RAID:} | |||||
Will not be covered here (yet). You must create the partition tables. Create the raid with mdadm. mkfs.ext4 on the raid partition. Add mdadm to grub config. Reinstall grub. Details may be provided later. | |||||
\subsection{Details of RAID:} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 2 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:40:44 2019 | |||||
State : clean, degraded | |||||
Active Devices : 2 | |||||
Working Devices : 2 | |||||
Failed Devices : 0 | |||||
Spare Devices : 0 | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 82 | |||||
Number Major Minor RaidDevice State | |||||
- 0 0 0 removed | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev#-- | |||||
\end{verbatim} | |||||
so you can see, one was removed (it auto removes, when unplugged) | |||||
\\ | |||||
\\ | |||||
\subsection{Add Drive to RAID:} | |||||
sudo mdadm --add /dev/md127 /dev/sda1 | |||||
\\ | |||||
\\ | |||||
NOTE2: If you setup 2 hdds, in a raid, and want to add a third, if you just --add, it will show up as a spare... | |||||
if you do mdadm --grow /dev/md127 -raid-devices=3 then the third might be active sync (what we want) | |||||
note that the --grow, seems to allow for parameter changes after you have already created the raid. you can also specify | |||||
the exact same command, raid-devices=3 in the setup of the raid (see install doc). Note that if you lose a drive, you can simply add it. | |||||
\\ | |||||
\\ | |||||
NOTE: don't worry about mkfs.ext4 on the raid members, after initial setup. The RAID will manage that. | |||||
\\ | |||||
\\ | |||||
NOTE: if you have a new drive and need to copy the hdd partition tables: | |||||
https://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools | |||||
or aka | |||||
\begin{verbatim} | |||||
(FOR MBR ONLY) | |||||
Save: | |||||
sfdisk -d /dev/sda > part_table | |||||
Restore: | |||||
sfdisk /dev/NEWHDD < part_table | |||||
(FOR GPT:) | |||||
# Save MBR disks | |||||
sgdisk --backup=/partitions-backup-$(basename $source).sgdisk $source | |||||
sgdisk --backup=/partitions-backup-$(basename $dest).sgdisk $dest | |||||
# Copy $source layout to $dest and regenerate GUIDs | |||||
sgdisk --replicate=$dest $source | |||||
sgdisk -G $dest | |||||
\end{verbatim} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# mdadm --add /dev/md127 /dev/sda1 | |||||
mdadm: added /dev/sda1 | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 3 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:41:43 2019 | |||||
State : clean, degraded, recovering | |||||
Active Devices : 2 | |||||
Working Devices : 3 | |||||
Failed Devices : 0 | |||||
Spare Devices : 1 | |||||
Rebuild Status : 0% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 92 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev# | |||||
\end{verbatim} | |||||
Looks good. | |||||
\begin{verbatim} | |||||
Rebuild Status : 6% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 103 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
\end{verbatim} | |||||
as it progresses, you see the RAID rebuilding. | |||||
\begin{verbatim} | |||||
watch -n1 cat /proc/mdstat | |||||
Every 1.0s: cat /proc/mdstat | |||||
advacoONE: Fri Feb 1 02:43:24 2019 | |||||
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] | |||||
md127 : active raid1 sda1[3] sdb1[1] sdc1[2] | |||||
57638912 blocks super 1.2 [3/2] [_UU] | |||||
[==>..................] recovery = 11.2% (6471936/57638912) finish=13.2min speed=64324K/sec | |||||
unused devices: <none> | |||||
\end{verbatim} | |||||
\textbf{WARNING:} Reinstall grub on the new drive again as well afterwards. | |||||
\subsection{Email Notifications on mdadm} | |||||
Test emails on mdadm.. first configure email however you prefer (i currently use ssmtp, see this link: | |||||
https://wiki.zoneminder.com/How\_to\_get\_ssmtp\_working\_with\_Zoneminder | |||||
then edit /etc/mdadm/mdadm.conf to have your email in mailaddr | |||||
then | |||||
\begin{verbatim} | |||||
sudo mdadm --monitor --scan --test --oneshot | |||||
\end{verbatim} | |||||
should send an email | |||||
https://ubuntuforums.org/showthread.php?t=1185134 | |||||
for more details on email sending | |||||
\section{References} | |||||
\begin{verbatim} | |||||
The section about degraded disks | |||||
https://help.ubuntu.com/lts/serverguide/advanced-installation.html.en | |||||
General partition tips. | |||||
https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS | |||||
SSMTP email setup: | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
wiki.zoneminder.com/SMS_Notifications | |||||
\end{verbatim} | |||||
\end{document} |
@ -0,0 +1,8 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Details}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Creation of RAID:}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Details of RAID:}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Add Drive to RAID:}{2}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.4}Email Notifications on mdadm}{4}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {3}References}{5}} |
@ -0,0 +1,313 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 1 AUG 2019 01:52 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_G | |||||
nulinux_Mdadm_Reference/docs/5.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/RAID_On_Gn | |||||
ulinux_Mdadm_Reference/docs/5.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./5.aux) | |||||
\openout1 = `5.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 17--20 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 17--20 | |||||
[] | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 53--53 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 53--53 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 55--58 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 55--58 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 59--74 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 59--74 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 59--74 | |||||
[] | |||||
Overfull \hbox (6.79498pt too wide) in paragraph at lines 59--74 | |||||
\OT1/cmr/m/n/10.95 https://unix.stackexchange.com/questions/12986/how-to-copy-t | |||||
he-partition- | |||||
[] | |||||
[2] | |||||
Overfull \hbox (36.65945pt too wide) in paragraph at lines 92--92 | |||||
[]\OT1/cmtt/m/n/10.95 sgdisk --backup=/partitions-backup-$(basename $source).sg | |||||
disk $source[] | |||||
[] | |||||
Overfull \hbox (13.6647pt too wide) in paragraph at lines 92--92 | |||||
[]\OT1/cmtt/m/n/10.95 sgdisk --backup=/partitions-backup-$(basename $dest).sgdi | |||||
sk $dest[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 127--127 | |||||
[] \OT1/cmtt/m/n/10.95 3 8 1 0 spare rebuilding | |||||
/dev/sda1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 127--127 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
[3] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 127--127 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 140--140 | |||||
[] \OT1/cmtt/m/n/10.95 3 8 1 0 spare rebuilding | |||||
/dev/sda1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 140--140 | |||||
[] \OT1/cmtt/m/n/10.95 1 8 17 1 active sync /de | |||||
v/sdb1[] | |||||
[] | |||||
Overfull \hbox (2.16733pt too wide) in paragraph at lines 140--140 | |||||
[] \OT1/cmtt/m/n/10.95 2 8 33 2 active sync /de | |||||
v/sdc1[] | |||||
[] | |||||
Overfull \hbox (128.63846pt too wide) in paragraph at lines 158--158 | |||||
[]\OT1/cmtt/m/n/10.95 Personalities : [raid1] [linear] [multipath] [raid0] [rai | |||||
d6] [raid5] [raid4] [raid10][] | |||||
[] | |||||
Overfull \hbox (203.3714pt too wide) in paragraph at lines 158--158 | |||||
[] \OT1/cmtt/m/n/10.95 [==>..................] recovery = 11.2% (6471936/ | |||||
57638912) finish=13.2min speed=64324K/sec[] | |||||
[] | |||||
Overfull \hbox (110.07799pt too wide) in paragraph at lines 164--167 | |||||
\OT1/cmr/m/n/10.95 use ssmtp, see this link: https://wiki.zoneminder.com/How[]t | |||||
o[]get[]ssmtp[]working[]with[]Zoneminder | |||||
[] | |||||
[4] | |||||
Overfull \hbox (36.65945pt too wide) in paragraph at lines 193--193 | |||||
[]\OT1/cmtt/m/n/10.95 https://help.ubuntu.com/lts/serverguide/advanced-installa | |||||
tion.html.en[] | |||||
[] | |||||
Overfull \hbox (13.6647pt too wide) in paragraph at lines 193--193 | |||||
[]\OT1/cmtt/m/n/10.95 https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Roo | |||||
t-on-ZFS[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 193--193 | |||||
[]\OT1/cmtt/m/n/10.95 https://wiki.zoneminder.com/How_to_get_ssmtp_working_with | |||||
_Zoneminder[] | |||||
[] | |||||
[5] (./5.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2514 strings out of 495020 | |||||
40168 string characters out of 6181323 | |||||
96818 words of memory out of 5000000 | |||||
5740 multiletter control sequences out of 15000+600000 | |||||
5626 words of font info for 21 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,4n,38p,456b,242s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||||
bx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.p | |||||
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></us | |||||
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb> | |||||
Output written on 5.pdf (5 pages, 74780 bytes). | |||||
PDF statistics: | |||||
36 PDF objects out of 1000 (max. 8388607) | |||||
24 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,194 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{RAID on GnuLinux - Mdadm Reference}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{07/31/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{RAID on GnuLinux - Mdadm Reference} | |||||
%\textbf{Todo} | |||||
%\tableofcontents | |||||
\section{Overview} | |||||
There are a few options for software RAID on Gnu Linux. Among them is BtrFS and ZFS, however today I will focus on using mdadm. This is historically the oldest software raid, therefore should be better vetted, although its performance may be less of that of the first two mentioned - for simple servers, mdadm might be the most stable choice. | |||||
\section{Details} | |||||
I've worked with this in setting up some Core 2 Duo PCs, with 2 to 4 Sata HDDs. This will be a reference. Let's begin. | |||||
\\ | |||||
\\ | |||||
\subsection{Creation of RAID:} | |||||
Will not be covered here (yet). You must create the partition tables. Create the raid with mdadm. mkfs.ext4 on the raid partition. Add mdadm to grub config. Reinstall grub. Details may be provided later. | |||||
\subsection{Details of RAID:} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 2 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:40:44 2019 | |||||
State : clean, degraded | |||||
Active Devices : 2 | |||||
Working Devices : 2 | |||||
Failed Devices : 0 | |||||
Spare Devices : 0 | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 82 | |||||
Number Major Minor RaidDevice State | |||||
- 0 0 0 removed | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev#-- | |||||
\end{verbatim} | |||||
so you can see, one was removed (it auto removes, when unplugged) | |||||
\\ | |||||
\\ | |||||
\subsection{Add Drive to RAID:} | |||||
sudo mdadm --add /dev/md127 /dev/sda1 | |||||
\\ | |||||
\\ | |||||
NOTE2: If you setup 2 hdds, in a raid, and want to add a third, if you just --add, it will show up as a spare... | |||||
if you do mdadm --grow /dev/md127 -raid-devices=3 then the third might be active sync (what we want) | |||||
note that the --grow, seems to allow for parameter changes after you have already created the raid. you can also specify | |||||
the exact same command, raid-devices=3 in the setup of the raid (see install doc). Note that if you lose a drive, you can simply add it. | |||||
\\ | |||||
\\ | |||||
NOTE: don't worry about mkfs.ext4 on the raid members, after initial setup. The RAID will manage that. | |||||
\\ | |||||
\\ | |||||
NOTE: if you have a new drive and need to copy the hdd partition tables: | |||||
https://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools | |||||
or aka | |||||
\begin{verbatim} | |||||
(FOR MBR ONLY) | |||||
Save: | |||||
sfdisk -d /dev/sda > part_table | |||||
Restore: | |||||
sfdisk /dev/NEWHDD < part_table | |||||
(FOR GPT:) | |||||
# Save MBR disks | |||||
sgdisk --backup=/partitions-backup-$(basename $source).sgdisk $source | |||||
sgdisk --backup=/partitions-backup-$(basename $dest).sgdisk $dest | |||||
# Copy $source layout to $dest and regenerate GUIDs | |||||
sgdisk --replicate=$dest $source | |||||
sgdisk -G $dest | |||||
\end{verbatim} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# mdadm --add /dev/md127 /dev/sda1 | |||||
mdadm: added /dev/sda1 | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 3 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:41:43 2019 | |||||
State : clean, degraded, recovering | |||||
Active Devices : 2 | |||||
Working Devices : 3 | |||||
Failed Devices : 0 | |||||
Spare Devices : 1 | |||||
Rebuild Status : 0% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 92 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev# | |||||
\end{verbatim} | |||||
Looks good. | |||||
\begin{verbatim} | |||||
Rebuild Status : 6% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 103 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
\end{verbatim} | |||||
as it progresses, you see the RAID rebuilding. | |||||
\begin{verbatim} | |||||
watch -n1 cat /proc/mdstat | |||||
Every 1.0s: cat /proc/mdstat | |||||
advacoONE: Fri Feb 1 02:43:24 2019 | |||||
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] | |||||
md127 : active raid1 sda1[3] sdb1[1] sdc1[2] | |||||
57638912 blocks super 1.2 [3/2] [_UU] | |||||
[==>..................] recovery = 11.2% (6471936/57638912) finish=13.2min speed=64324K/sec | |||||
unused devices: <none> | |||||
\end{verbatim} | |||||
\textbf{WARNING:} Reinstall grub on the new drive again as well afterwards. | |||||
\subsection{Email Notifications on mdadm} | |||||
Test emails on mdadm.. first configure email however you prefer (i currently use ssmtp, see this link: | |||||
https://wiki.zoneminder.com/How\_to\_get\_ssmtp\_working\_with\_Zoneminder | |||||
-- | |||||
then edit /etc/mdadm/mdadm.conf to have your email in mailaddr | |||||
then | |||||
\begin{verbatim} | |||||
sudo mdadm --monitor --scan --test --oneshot | |||||
\end{verbatim} | |||||
should send an email | |||||
https://ubuntuforums.org/showthread.php?t=1185134 | |||||
for more details on email sending | |||||
\section{References} | |||||
\begin{verbatim} | |||||
The section about degraded disks | |||||
https://help.ubuntu.com/lts/serverguide/advanced-installation.html.en | |||||
General partition tips. | |||||
https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS | |||||
SSMTP email setup: | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
wiki.zoneminder.com/SMS_Notifications | |||||
\end{verbatim} | |||||
\end{document} |
@ -0,0 +1,193 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{RAID on GnuLinux - Mdadm Reference}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{07/31/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{RAID on GnuLinux - Mdadm Reference} | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
There are a few options for software RAID on Gnu Linux. Among them is BtrFS and ZFS, however today I will focus on using mdadm. This is historically the oldest software raid, therefore should be better vetted, although its performance may be less of that of the first two mentioned - for simple servers, mdadm might be the most stable choice. | |||||
\section{Details} | |||||
I've worked with this in setting up some Core 2 Duo PCs, with 2 to 4 Sata HDDs. This will be a reference. Let's begin. | |||||
\\ | |||||
\\ | |||||
\subsection{Creation of RAID:} | |||||
Will not be covered here (yet). You must create the partition tables. Create the raid with mdadm. mkfs.ext4 on the raid partition. Add mdadm to grub config. Reinstall grub. Details may be provided later. | |||||
\subsection{Details of RAID:} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 2 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:40:44 2019 | |||||
State : clean, degraded | |||||
Active Devices : 2 | |||||
Working Devices : 2 | |||||
Failed Devices : 0 | |||||
Spare Devices : 0 | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 82 | |||||
Number Major Minor RaidDevice State | |||||
- 0 0 0 removed | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev#-- | |||||
\end{verbatim} | |||||
so you can see, one was removed (it auto removes, when unplugged) | |||||
\\ | |||||
\\ | |||||
\subsection{Add Drive to RAID:} | |||||
sudo mdadm --add /dev/md127 /dev/sda1 | |||||
\\ | |||||
\\ | |||||
NOTE2: If you setup 2 hdds, in a raid, and want to add a third, if you just --add, it will show up as a spare... | |||||
if you do mdadm --grow /dev/md127 -raid-devices=3 then the third might be active sync (what we want) | |||||
note that the --grow, seems to allow for parameter changes after you have already created the raid. you can also specify | |||||
the exact same command, raid-devices=3 in the setup of the raid (see install doc). Note that if you lose a drive, you can simply add it. | |||||
\\ | |||||
\\ | |||||
NOTE: don't worry about mkfs.ext4 on the raid members, after initial setup. The RAID will manage that. | |||||
\\ | |||||
\\ | |||||
NOTE: if you have a new drive and need to copy the hdd partition tables: | |||||
https://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools | |||||
or aka | |||||
\begin{verbatim} | |||||
(FOR MBR ONLY) | |||||
Save: | |||||
sfdisk -d /dev/sda > part_table | |||||
Restore: | |||||
sfdisk /dev/NEWHDD < part_table | |||||
(FOR GPT:) | |||||
# Save MBR disks | |||||
sgdisk --backup=/partitions-backup-$(basename $source).sgdisk $source | |||||
sgdisk --backup=/partitions-backup-$(basename $dest).sgdisk $dest | |||||
# Copy $source layout to $dest and regenerate GUIDs | |||||
sgdisk --replicate=$dest $source | |||||
sgdisk -G $dest | |||||
\end{verbatim} | |||||
\begin{verbatim} | |||||
root@advacoONE:/dev# mdadm --add /dev/md127 /dev/sda1 | |||||
mdadm: added /dev/sda1 | |||||
root@advacoONE:/dev# sudo mdadm -D /dev/md127 | |||||
/dev/md127: | |||||
Version : 1.2 | |||||
Creation Time : Fri Feb 1 01:00:25 2019 | |||||
Raid Level : raid1 | |||||
Array Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Used Dev Size : 57638912 (54.97 GiB 59.02 GB) | |||||
Raid Devices : 3 | |||||
Total Devices : 3 | |||||
Persistence : Superblock is persistent | |||||
Update Time : Fri Feb 1 02:41:43 2019 | |||||
State : clean, degraded, recovering | |||||
Active Devices : 2 | |||||
Working Devices : 3 | |||||
Failed Devices : 0 | |||||
Spare Devices : 1 | |||||
Rebuild Status : 0% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 92 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
root@advacoONE:/dev# | |||||
\end{verbatim} | |||||
Looks good. | |||||
\begin{verbatim} | |||||
Rebuild Status : 6% complete | |||||
Name : devuan:root | |||||
UUID : 83a8dc03:802a4129:26322116:c2cfe1d4 | |||||
Events : 103 | |||||
Number Major Minor RaidDevice State | |||||
3 8 1 0 spare rebuilding /dev/sda1 | |||||
1 8 17 1 active sync /dev/sdb1 | |||||
2 8 33 2 active sync /dev/sdc1 | |||||
\end{verbatim} | |||||
as it progresses, you see the RAID rebuilding. | |||||
\begin{verbatim} | |||||
watch -n1 cat /proc/mdstat | |||||
Every 1.0s: cat /proc/mdstat | |||||
advacoONE: Fri Feb 1 02:43:24 2019 | |||||
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] | |||||
md127 : active raid1 sda1[3] sdb1[1] sdc1[2] | |||||
57638912 blocks super 1.2 [3/2] [_UU] | |||||
[==>..................] recovery = 11.2% (6471936/57638912) finish=13.2min speed=64324K/sec | |||||
unused devices: <none> | |||||
\end{verbatim} | |||||
\textbf{WARNING:} Reinstall grub on the new drive again as well afterwards. | |||||
\subsection{Email Notifications on mdadm} | |||||
Test emails on mdadm.. first configure email however you prefer (i currently use ssmtp, see this link: | |||||
https://wiki.zoneminder.com/How\_to\_get\_ssmtp\_working\_with\_Zoneminder | |||||
-- | |||||
then edit /etc/mdadm/mdadm.conf to have your email in mailaddr | |||||
then | |||||
\begin{verbatim} | |||||
sudo mdadm --monitor --scan --test --oneshot | |||||
\end{verbatim} | |||||
should send an email | |||||
https://ubuntuforums.org/showthread.php?t=1185134 | |||||
for more details on email sending | |||||
\section{References} | |||||
\begin{verbatim} | |||||
The section about degraded disks | |||||
https://help.ubuntu.com/lts/serverguide/advanced-installation.html.en | |||||
General partition tips. | |||||
https://github.com/zfsonlinux/zfs/wiki/Debian-Stretch-Root-on-ZFS | |||||
SSMTP email setup: | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
wiki.zoneminder.com/SMS_Notifications | |||||
\end{verbatim} | |||||
\end{document} |
@ -0,0 +1,7 @@ | |||||
\contentsline {section}{\numberline {1}Overview}{1} | |||||
\contentsline {section}{\numberline {2}Details}{1} | |||||
\contentsline {subsection}{\numberline {2.1}Creation of RAID:}{1} | |||||
\contentsline {subsection}{\numberline {2.2}Details of RAID:}{1} | |||||
\contentsline {subsection}{\numberline {2.3}Add Drive to RAID:}{2} | |||||
\contentsline {subsection}{\numberline {2.4}Email Notifications on mdadm}{4} | |||||
\contentsline {section}{\numberline {3}References}{5} |
@ -0,0 +1,6 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Steps}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Configuring Tripwire}{1}} | |||||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.1}Devuan/Debian}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Configuring SSMTP}{2}} |
@ -0,0 +1,207 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 15 JUL 2019 23:23 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_ | |||||
And_ssmtp_for_Email_Alerting/docs/1.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_A | |||||
nd_ssmtp_for_Email_Alerting/docs/1.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./1.aux) | |||||
\openout1 = `1.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <10.95> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <8> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <6> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <9> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <5> on input line 28. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 28--28 | |||||
[][]\OT1/cmr/m/n/9 For a full walk-through of this pro-cess see this | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 28--28 | |||||
\OT1/cmr/m/n/9 URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detec | |||||
t-modified-files- | |||||
[] | |||||
Overfull \hbox (99.89502pt too wide) in paragraph at lines 65--65 | |||||
[]\OT1/cmtt/m/n/10.95 when whitelisting, this is what needs to be commented out | |||||
in devuan jessie/ascii[] | |||||
[] | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] (./1.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2538 strings out of 495020 | |||||
40440 string characters out of 6181323 | |||||
94813 words of memory out of 5000000 | |||||
5755 multiletter control sequences out of 15000+600000 | |||||
8977 words of font info for 32 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,8n,38p,392b,239s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share | |||||
/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/texli | |||||
ve/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texlive/tex | |||||
mf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist | |||||
/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/texlive/texmf-dist/fonts/t | |||||
ype1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/texmf-dist/fonts/type1/pub | |||||
lic/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsf | |||||
onts/cm/cmtt10.pfb> | |||||
Output written on 1.pdf (2 pages, 91478 bytes). | |||||
PDF statistics: | |||||
39 PDF objects out of 1000 (max. 8388607) | |||||
27 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,72 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Setting up Tripwire with SSMTP}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Setting up Tripwire with SSMTP} | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
Tripwire is intrusion detection software for GNU Linux \& BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. | |||||
\section{Steps} | |||||
\subsection{Configuring Tripwire} | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. | |||||
\begin{verbatim} | |||||
apt-get install tripwire mailutils ssmtp | |||||
OR | |||||
emerge -av tripwire mailutils ssmtp | |||||
\end{verbatim} | |||||
\subsubsection{Devuan/Debian} | |||||
Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. | |||||
\footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} | |||||
I use the same password for both. | |||||
\textbf{After install} | |||||
Now, there's a trick we will use here. Normally, the guides will tell you to init, and then init again after the errors. However, we will try to skip that, if possible, to save time. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. | |||||
\begin{verbatim} | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii | |||||
Filename: /etc/rc.boot | |||||
Filename: /root/mail | |||||
Filename: /root/Mail | |||||
Filename: /root/.xsession-errors | |||||
Filename: /root/.xauth | |||||
Filename: /root/.tcshrc | |||||
Filename: /root/.sawfish | |||||
Filename: /root/.pinerc | |||||
Filename: /root/.mc | |||||
Filename: /root/.gnome_private | |||||
Filename: /root/.gnome-desktop | |||||
Filename: /root/.gnome | |||||
Filename: /root/.esd_auth | |||||
Filename: /root/.elm | |||||
Filename: /root/.cshrc | |||||
Filename: /root/.bash_profile | |||||
Filename: /root/.bash_logout | |||||
Filename: /root/.amandahosts | |||||
Filename: /root/.addressbook.lu | |||||
Filename: /root/.addressbook | |||||
Filename: /root/.Xresources | |||||
Filename: /root/.Xauthority | |||||
Filename: /root/.ICEauthority | |||||
Filename: /proc/6136/fd/3 | |||||
Filename: /proc/6136/fdinfo/3 | |||||
Filename: /proc/6136/task/6136/fd/3 | |||||
Filename: /proc/6136/task/6136/fdinfo/3 | |||||
\end{verbatim} | |||||
For proc, you simply whitelist the whole directory. | |||||
\subsection{Configuring SSMTP} | |||||
\end{document} |
@ -0,0 +1,110 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{AutoSSH - a Reverse Proxy Alternative}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{AutoSSH - a Reverse Proxy Alternative} | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
I recently added another apache server to an existing infrastructure, and I wanted it to be accessible under a similar IP as another server. Due to the complexity of the website, it was not possible to simply do a reverse proxy without knowing the correct settings (e.g. X-Forwarded for). Instead, AutoSSH was used. | |||||
\section{Work Log} | |||||
Ok, I'm going to get right to the configs that I used. You want the tool, you don't need to know all the details. | |||||
\subsection{Crontab} | |||||
Here is the crontab script I used. I put this in /etc/crontab, so it has root after the times. I only use /etc/crontab, as it's easier to manage. | |||||
\begin{verbatim} | |||||
* * * * * root pgrep autossh > /dev/null || \ | |||||
/usr/local/bin/autosshzm/autosshzm.sh | |||||
\end{verbatim} | |||||
A few notes about this. Pgrep will search for autossh. If it doesn't find it, then it will try the next command. (|| is an OR). Put the bash script wherever you want. | |||||
\subsection{Bash Script} | |||||
This script is obviously what the crontab calls. | |||||
\begin{verbatim} | |||||
#!/bin/bash | |||||
logger " /usr/local/bin/autosshzm script started." | |||||
#source $HOME/.bash_profile #not needed. | |||||
source $HOME/.keychain/$HOSTNAME-sh | |||||
logger " /usr/local/bin/autosshzm sourced." | |||||
autossh -L 0.0.0.0:2:localhost:80 -f user@ipaddress sleep 31536000 | |||||
&> /var/log/autosshzm/autosshzm.log | |||||
#autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" | |||||
-L 0.0.0.0:2:localhost:80 user@ipaddress &> | |||||
/var/log/autosshzm/autosshzm.log | |||||
logger "auto ssh ran" | |||||
\end{verbatim} | |||||
Note that the second autossh does not work, as it's missing the sleep and the -f command. \footnote{Figuring this kind of stuff out can take about an hour.} In order for this to work, you'll also need the following commands: | |||||
\begin{verbatim} | |||||
apt-get install keychain autossh | |||||
\end{verbatim} | |||||
There were some more setup steps required for keychain... | |||||
From stackexchange: | |||||
\begin{verbatim} | |||||
25 | |||||
keychain | |||||
solves this in a painless way. It's in the repos for Debian/Ubuntu: | |||||
sudo apt-get install keychain | |||||
and perhaps for many other distros (it looks like it originated | |||||
from Gentoo). | |||||
This program will start an ssh-agent if none is running, and | |||||
provide shell scripts that can be sourced and connect the current | |||||
shell to this particular ssh-agent. | |||||
For bash, with a private key named id_rsa, add the following to | |||||
your .profile: | |||||
keychain --nogui id_rsa | |||||
This will start an ssh-agent and add the id_rsa key on the first | |||||
login after reboot. If the key is passphrase-protected, it will | |||||
also ask for the passphrase. No need to use unprotected keys | |||||
anymore! For subsequent logins, it will recognize the agent | |||||
and not ask for a passphrase again. | |||||
Also, add the following as a last line of your .bashrc: | |||||
. ~/.keychain/$HOSTNAME-sh | |||||
This will let the shell know where to reach the SSH agent managed | |||||
by keychain. Make sure that .bashrc is sourced from .profile. | |||||
However, it seems that cron jobs still don't see this. As a | |||||
remedy, include the line above in the crontab, just before | |||||
your actual command: | |||||
* * * * * . ~/.keychain/$HOSTNAME-sh; your-actual-command | |||||
\end{verbatim} | |||||
The only thing that I needed to do here was | |||||
keychain --nogui id\_rsa | |||||
The rest of it (notes about crontab) was not required. | |||||
\section{What Did NOT Work} | |||||
Here's some things I tried that did not work. | |||||
\begin{itemize} | |||||
\item https://github.com/obfusk/autossh-init - This init script, didn't do much for me. Remember, I'm stuck with systemd in Ubuntu 19.04...\footnote{The scourge of deleting software history. Keep backwards compatibility at ALL COSTS, developers.} | |||||
\item Reverse proxy with Apache - As I said, my website \footnote{Some people might call it a web application. I will not.} was too complex, and I didn't want to go down that rabbit hole. | |||||
\item Starting AutoSSH in rc.local. Didn't work. | |||||
\end{itemize} | |||||
\end{document} |
@ -0,0 +1,6 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Steps}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Configuring Tripwire}{1}} | |||||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.1}Devuan/Debian}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Configuring SSMTP}{2}} |
@ -0,0 +1,207 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 14 JUL 2019 21:36 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_ | |||||
And_ssmtp_for_Email_Alerting/docs/2.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_A | |||||
nd_ssmtp_for_Email_Alerting/docs/2.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./2.aux) | |||||
\openout1 = `2.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <10.95> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <8> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <6> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <9> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <5> on input line 28. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 28--28 | |||||
[][]\OT1/cmr/m/n/9 For a full walk-through of this pro-cess see this | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 28--28 | |||||
\OT1/cmr/m/n/9 URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detec | |||||
t-modified-files- | |||||
[] | |||||
Overfull \hbox (260.85828pt too wide) in paragraph at lines 65--65 | |||||
[]\OT1/cmtt/m/n/10.95 when whitelisting, this is what needs to be commented out | |||||
in devuan jessie/ascii for /etc/tripwire/twpol.txt[] | |||||
[] | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] (./2.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2538 strings out of 495020 | |||||
40440 string characters out of 6181323 | |||||
95813 words of memory out of 5000000 | |||||
5755 multiletter control sequences out of 15000+600000 | |||||
8977 words of font info for 32 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,8n,38p,443b,239s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share | |||||
/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/texli | |||||
ve/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texlive/tex | |||||
mf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist | |||||
/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/texlive/texmf-dist/fonts/t | |||||
ype1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/texmf-dist/fonts/type1/pub | |||||
lic/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsf | |||||
onts/cm/cmtt10.pfb> | |||||
Output written on 2.pdf (2 pages, 94378 bytes). | |||||
PDF statistics: | |||||
39 PDF objects out of 1000 (max. 8388607) | |||||
27 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,84 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Setting up Tripwire with SSMTP}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Setting up Tripwire with SSMTP} | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
Tripwire is intrusion detection software for GNU Linux \& BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. | |||||
\section{Steps} | |||||
\subsection{Configuring Tripwire} | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. | |||||
\begin{verbatim} | |||||
apt-get install tripwire mailutils ssmtp | |||||
OR | |||||
emerge -av tripwire mailutils ssmtp | |||||
\end{verbatim} | |||||
\subsubsection{Devuan/Debian} | |||||
Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. | |||||
\footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} | |||||
I use the same password for both. | |||||
\textbf{After install} | |||||
Now, there's a trick we will use here. Normally, the guides will tell you to init, and then init again after the errors. However, we will try to skip that, if possible, to save time. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. Let's first edit the configs before doing an init. | |||||
\begin{verbatim} | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii for /etc/tripwire/twpol.txt | |||||
Filename: /etc/rc.boot | |||||
Filename: /root/mail | |||||
Filename: /root/Mail | |||||
Filename: /root/.xsession-errors | |||||
Filename: /root/.xauth | |||||
Filename: /root/.tcshrc | |||||
Filename: /root/.sawfish | |||||
Filename: /root/.pinerc | |||||
Filename: /root/.mc | |||||
Filename: /root/.gnome_private | |||||
Filename: /root/.gnome-desktop | |||||
Filename: /root/.gnome | |||||
Filename: /root/.esd_auth | |||||
Filename: /root/.elm | |||||
Filename: /root/.cshrc | |||||
Filename: /root/.bash_profile | |||||
Filename: /root/.bash_logout | |||||
Filename: /root/.amandahosts | |||||
Filename: /root/.addressbook.lu | |||||
Filename: /root/.addressbook | |||||
Filename: /root/.Xresources | |||||
Filename: /root/.Xauthority | |||||
Filename: /root/.ICEauthority | |||||
Filename: /proc/6136/fd/3 | |||||
Filename: /proc/6136/fdinfo/3 | |||||
Filename: /proc/6136/task/6136/fd/3 | |||||
Filename: /proc/6136/task/6136/fdinfo/3 | |||||
\end{verbatim} | |||||
For proc, you simply whitelist the whole directory. After twpol, we are not done. We also need to edit the email settings. | |||||
In /etc/tripwire/twcfg.txt we will change the following: | |||||
\begin{verbatim} | |||||
MAILMETHOD =SENDMAIL | |||||
MAILPROGRAM =/root/script.sh | |||||
\end{verbatim} | |||||
root.sh is just a script: | |||||
\begin{verbatim} | |||||
#!/bin/bash | |||||
/usr/sbin/sendmail -s youremail@domain.com | |||||
\end{verbatim} | |||||
\subsection{Configuring SSMTP} | |||||
\end{document} |
@ -0,0 +1,6 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Steps}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Configuring Tripwire}{1}} | |||||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.1}Devuan/Debian}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Configuring SSMTP}{3}} |
@ -0,0 +1,244 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 14 JUL 2019 22:05 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_ | |||||
And_ssmtp_for_Email_Alerting/docs/3.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_A | |||||
nd_ssmtp_for_Email_Alerting/docs/3.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./3.aux) | |||||
\openout1 = `3.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <10.95> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <8> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <6> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <9> on input line 28. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <5> on input line 28. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 28--28 | |||||
[][]\OT1/cmr/m/n/9 For a full walk-through of this pro-cess see this | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 28--28 | |||||
\OT1/cmr/m/n/9 URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detec | |||||
t-modified-files- | |||||
[] | |||||
Overfull \hbox (260.85828pt too wide) in paragraph at lines 63--63 | |||||
[]\OT1/cmtt/m/n/10.95 when whitelisting, this is what needs to be commented out | |||||
in devuan jessie/ascii for /etc/tripwire/twpol.txt[] | |||||
[] | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] | |||||
Overfull \hbox (13.36531pt too wide) in paragraph at lines 100--104 | |||||
\OT1/cmr/bx/n/10.95 /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwir | |||||
e/twcfg.txt | |||||
[] | |||||
Overfull \hbox (117.14108pt too wide) in paragraph at lines 112--112 | |||||
[]\OT1/cmtt/m/n/10.95 root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.k | |||||
ey /etc/tripwire/twcfg.txt[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 121--121 | |||||
[]\OT1/cmtt/m/n/10.95 https://wiki.zoneminder.com/How_to_get_ssmtp_working_with | |||||
_Zoneminder[] | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 122--129 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 122--129 | |||||
[] | |||||
[3] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 130--137 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 130--137 | |||||
[] | |||||
[4] (./3.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2538 strings out of 495020 | |||||
40440 string characters out of 6181323 | |||||
95813 words of memory out of 5000000 | |||||
5755 multiletter control sequences out of 15000+600000 | |||||
8977 words of font info for 32 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,8n,38p,411b,239s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||||
bx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.p | |||||
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></us | |||||
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/ | |||||
texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/ | |||||
texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-di | |||||
st/fonts/type1/public/amsfonts/cm/cmtt10.pfb> | |||||
Output written on 3.pdf (4 pages, 104704 bytes). | |||||
PDF statistics: | |||||
45 PDF objects out of 1000 (max. 8388607) | |||||
31 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,139 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Setting up Tripwire with SSMTP}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Setting up Tripwire with SSMTP} | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
Tripwire is intrusion detection software for GNU Linux \& BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. | |||||
\section{Steps} | |||||
\subsection{Configuring Tripwire} | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. | |||||
\begin{verbatim} | |||||
apt-get install tripwire mailutils ssmtp | |||||
OR | |||||
emerge -av tripwire mailutils ssmtp | |||||
\end{verbatim} | |||||
\subsubsection{Devuan/Debian} | |||||
Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. | |||||
\footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} | |||||
I use the same password for both. | |||||
\textbf{After install:}The goal when setting this up is to init, as little as possible. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. Let's first edit the configs as much as possible. | |||||
\begin{verbatim} | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii for /etc/tripwire/twpol.txt | |||||
Filename: /etc/rc.boot | |||||
Filename: /root/mail | |||||
Filename: /root/Mail | |||||
Filename: /root/.xsession-errors | |||||
Filename: /root/.xauth | |||||
Filename: /root/.tcshrc | |||||
Filename: /root/.sawfish | |||||
Filename: /root/.pinerc | |||||
Filename: /root/.mc | |||||
Filename: /root/.gnome_private | |||||
Filename: /root/.gnome-desktop | |||||
Filename: /root/.gnome | |||||
Filename: /root/.esd_auth | |||||
Filename: /root/.elm | |||||
Filename: /root/.cshrc | |||||
Filename: /root/.bash_profile | |||||
Filename: /root/.bash_logout | |||||
Filename: /root/.amandahosts | |||||
Filename: /root/.addressbook.lu | |||||
Filename: /root/.addressbook | |||||
Filename: /root/.Xresources | |||||
Filename: /root/.Xauthority | |||||
Filename: /root/.ICEauthority | |||||
Filename: /proc/6136/fd/3 | |||||
Filename: /proc/6136/fdinfo/3 | |||||
Filename: /proc/6136/task/6136/fd/3 | |||||
Filename: /proc/6136/task/6136/fdinfo/3 | |||||
\end{verbatim} | |||||
For proc, you simply comment out the whole directory. (you'll see an entry in the file for /proc, put a \# before that). After twpol, we are not done. We also need to edit the email settings. | |||||
In /etc/tripwire/twcfg.txt we will change the following: | |||||
\begin{verbatim} | |||||
MAILMETHOD =SENDMAIL | |||||
MAILPROGRAM =/root/script.sh | |||||
\end{verbatim} | |||||
script.sh is just a script: (make sure it is executable with chmod +x\footnote{This script appears to be required in this setup.}) | |||||
\begin{verbatim} | |||||
#!/bin/bash | |||||
/usr/sbin/sendmail -s youremail@domain.com | |||||
\end{verbatim} | |||||
Finally, the last change we might make, will be for any special directories we want to watch. I put websites in the root at /sites/ so I will append the following to /etc/tripwire/twpol.txt | |||||
\begin{verbatim} | |||||
# Ruleset for Website | |||||
( | |||||
rulename = "Website Ruleset", | |||||
severity= $(SIG_HI) | |||||
) | |||||
{ | |||||
/sites/ -> $(SEC_CRIT); | |||||
} | |||||
\end{verbatim} | |||||
Now we will init, type | |||||
\begin{verbatim} | |||||
sudo tripwire --init | |||||
sudo twadmin -m P /etc/tripwire/twpol.txt | |||||
sudo tripwire --init | |||||
\end{verbatim} | |||||
to reconfigure twcfg.txt | |||||
run | |||||
\\ | |||||
\textbf{/usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt} | |||||
if you get: | |||||
\begin{verbatim} | |||||
root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt | |||||
# Error: File could not be opened. | |||||
# Filename: /root/site.key | |||||
# No such file or directory | |||||
# Exiting... | |||||
\end{verbatim} | |||||
You must cd to /etc/tripwire directory. | |||||
\subsection{Configuring SSMTP} | |||||
SSMTP is a program you configure once, and can reuse the configuration everywhere\footnote{This is a strength of FOSS and let it remain that way.}. For starters, I'd recommend you install SSMTP according to this guide here: | |||||
\begin{verbatim} | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
\end{verbatim} | |||||
This is a thorough guide that explains debugging. Some steps are superfluous (given that the instructions pertain to different software) but the general directions are sound. And afterwards sending an email is as easy as | |||||
\\ | |||||
\\ | |||||
\textbf{echo "Hello, World" | mail -s "My email check" user@email.com} | |||||
\\ | |||||
\\ | |||||
This guide assumes you have configured SSMTP according to this guide correctly, tested it, and are able to mail from the command line. Once you've setup SSMTP once, you can reproduce this setup on other computers, simply by copying over the revaliases and ssmtp.conf of a valid configuration. | |||||
So let's do that. Copy over revaliases, and ssmtp.conf. test the configuration from the command line using the above echo and mail. Once that works, test out tripwire. | |||||
\\ | |||||
\\ | |||||
\textbf{tripwire --test --email user@email.com} | |||||
\\ | |||||
\\ | |||||
Done. | |||||
\end{document} |
@ -0,0 +1,84 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Setting up Tripwire with SSMTP}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Setting up Tripwire with SSMTP} | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
Tripwire is intrusion detection software for GNU Linux \& BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. | |||||
\section{Steps} | |||||
\subsection{Configuring Tripwire} | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. | |||||
\begin{verbatim} | |||||
apt-get install tripwire mailutils ssmtp | |||||
OR | |||||
emerge -av tripwire mailutils ssmtp | |||||
\end{verbatim} | |||||
\subsubsection{Devuan/Debian} | |||||
Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. | |||||
\footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} | |||||
I use the same password for both. | |||||
\textbf{After install} | |||||
Now, there's a trick we will use here. Normally, the guides will tell you to init, and then init again after the errors. However, we will try to skip that, if possible, to save time. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. Let's first edit the configs before doing an init. | |||||
\begin{verbatim} | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii for /etc/tripwire/twpol.txt | |||||
Filename: /etc/rc.boot | |||||
Filename: /root/mail | |||||
Filename: /root/Mail | |||||
Filename: /root/.xsession-errors | |||||
Filename: /root/.xauth | |||||
Filename: /root/.tcshrc | |||||
Filename: /root/.sawfish | |||||
Filename: /root/.pinerc | |||||
Filename: /root/.mc | |||||
Filename: /root/.gnome_private | |||||
Filename: /root/.gnome-desktop | |||||
Filename: /root/.gnome | |||||
Filename: /root/.esd_auth | |||||
Filename: /root/.elm | |||||
Filename: /root/.cshrc | |||||
Filename: /root/.bash_profile | |||||
Filename: /root/.bash_logout | |||||
Filename: /root/.amandahosts | |||||
Filename: /root/.addressbook.lu | |||||
Filename: /root/.addressbook | |||||
Filename: /root/.Xresources | |||||
Filename: /root/.Xauthority | |||||
Filename: /root/.ICEauthority | |||||
Filename: /proc/6136/fd/3 | |||||
Filename: /proc/6136/fdinfo/3 | |||||
Filename: /proc/6136/task/6136/fd/3 | |||||
Filename: /proc/6136/task/6136/fdinfo/3 | |||||
\end{verbatim} | |||||
For proc, you simply whitelist the whole directory. After twpol, we are not done. We also need to edit the email settings. | |||||
In /etc/tripwire/twcfg.txt we will change the following: | |||||
\begin{verbatim} | |||||
MAILMETHOD =SENDMAIL | |||||
MAILPROGRAM =/root/script.sh | |||||
\end{verbatim} | |||||
root.sh is just a script: | |||||
\begin{verbatim} | |||||
#!/bin/bash | |||||
/usr/sbin/sendmail -s youremail@domain.com | |||||
\end{verbatim} | |||||
\subsection{Configuring SSMTP} | |||||
\end{document} |
@ -0,0 +1,6 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Steps}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Configuring Tripwire}{1}} | |||||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.1}Devuan/Debian}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Configuring SSMTP}{3}} |
@ -0,0 +1,249 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 14 JUL 2019 22:07 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_ | |||||
And_ssmtp_for_Email_Alerting/docs/4.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_A | |||||
nd_ssmtp_for_Email_Alerting/docs/4.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./4.aux) | |||||
\openout1 = `4.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
No file 4.toc. | |||||
\tf@toc=\write3 | |||||
\openout3 = `4.toc'. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <10.95> on input line 30. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <8> on input line 30. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <6> on input line 30. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <9> on input line 30. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <5> on input line 30. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 30--30 | |||||
[][]\OT1/cmr/m/n/9 For a full walk-through of this pro-cess see this | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 30--30 | |||||
\OT1/cmr/m/n/9 URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detec | |||||
t-modified-files- | |||||
[] | |||||
Overfull \hbox (260.85828pt too wide) in paragraph at lines 65--65 | |||||
[]\OT1/cmtt/m/n/10.95 when whitelisting, this is what needs to be commented out | |||||
in devuan jessie/ascii for /etc/tripwire/twpol.txt[] | |||||
[] | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] | |||||
Overfull \hbox (13.36531pt too wide) in paragraph at lines 102--106 | |||||
\OT1/cmr/bx/n/10.95 /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwir | |||||
e/twcfg.txt | |||||
[] | |||||
Overfull \hbox (117.14108pt too wide) in paragraph at lines 114--114 | |||||
[]\OT1/cmtt/m/n/10.95 root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.k | |||||
ey /etc/tripwire/twcfg.txt[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 123--123 | |||||
[]\OT1/cmtt/m/n/10.95 https://wiki.zoneminder.com/How_to_get_ssmtp_working_with | |||||
_Zoneminder[] | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 124--131 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 124--131 | |||||
[] | |||||
[3] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 132--139 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 132--139 | |||||
[] | |||||
[4] (./4.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2539 strings out of 495020 | |||||
40444 string characters out of 6181323 | |||||
95813 words of memory out of 5000000 | |||||
5755 multiletter control sequences out of 15000+600000 | |||||
8977 words of font info for 32 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,8n,38p,416b,239s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||||
bx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.p | |||||
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></us | |||||
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/ | |||||
texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/ | |||||
texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-di | |||||
st/fonts/type1/public/amsfonts/cm/cmtt10.pfb> | |||||
Output written on 4.pdf (4 pages, 105106 bytes). | |||||
PDF statistics: | |||||
45 PDF objects out of 1000 (max. 8388607) | |||||
31 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,141 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Setting up Tripwire with SSMTP}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Setting up Tripwire with SSMTP} | |||||
\tableofcontents | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
Tripwire is intrusion detection software for GNU Linux \& BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. Tripwire isn't too hard to setup, but I had to jump through a hoop for email notifications. Here I cover install, and how to get SSMTP working. | |||||
\section{Steps} | |||||
\subsection{Configuring Tripwire} | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. | |||||
\begin{verbatim} | |||||
apt-get install tripwire mailutils ssmtp | |||||
OR | |||||
emerge -av tripwire mailutils ssmtp | |||||
\end{verbatim} | |||||
\subsubsection{Devuan/Debian} | |||||
Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. | |||||
\footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} | |||||
I use the same password for both. | |||||
\textbf{After install:}The goal when setting this up is to init, as little as possible. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. Let's first edit the configs as much as possible. | |||||
\begin{verbatim} | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii for /etc/tripwire/twpol.txt | |||||
Filename: /etc/rc.boot | |||||
Filename: /root/mail | |||||
Filename: /root/Mail | |||||
Filename: /root/.xsession-errors | |||||
Filename: /root/.xauth | |||||
Filename: /root/.tcshrc | |||||
Filename: /root/.sawfish | |||||
Filename: /root/.pinerc | |||||
Filename: /root/.mc | |||||
Filename: /root/.gnome_private | |||||
Filename: /root/.gnome-desktop | |||||
Filename: /root/.gnome | |||||
Filename: /root/.esd_auth | |||||
Filename: /root/.elm | |||||
Filename: /root/.cshrc | |||||
Filename: /root/.bash_profile | |||||
Filename: /root/.bash_logout | |||||
Filename: /root/.amandahosts | |||||
Filename: /root/.addressbook.lu | |||||
Filename: /root/.addressbook | |||||
Filename: /root/.Xresources | |||||
Filename: /root/.Xauthority | |||||
Filename: /root/.ICEauthority | |||||
Filename: /proc/6136/fd/3 | |||||
Filename: /proc/6136/fdinfo/3 | |||||
Filename: /proc/6136/task/6136/fd/3 | |||||
Filename: /proc/6136/task/6136/fdinfo/3 | |||||
\end{verbatim} | |||||
For proc, you simply comment out the whole directory. (you'll see an entry in the file for /proc, put a \# before that). After twpol, we are not done. We also need to edit the email settings. | |||||
In /etc/tripwire/twcfg.txt we will change the following: | |||||
\begin{verbatim} | |||||
MAILMETHOD =SENDMAIL | |||||
MAILPROGRAM =/root/script.sh | |||||
\end{verbatim} | |||||
script.sh is just a script: (make sure it is executable with chmod +x\footnote{This script appears to be required in this setup.}) | |||||
\begin{verbatim} | |||||
#!/bin/bash | |||||
/usr/sbin/sendmail -s youremail@domain.com | |||||
\end{verbatim} | |||||
Finally, the last change we might make, will be for any special directories we want to watch. I put websites in the root at /sites/ so I will append the following to /etc/tripwire/twpol.txt | |||||
\begin{verbatim} | |||||
# Ruleset for Website | |||||
( | |||||
rulename = "Website Ruleset", | |||||
severity= $(SIG_HI) | |||||
) | |||||
{ | |||||
/sites/ -> $(SEC_CRIT); | |||||
} | |||||
\end{verbatim} | |||||
Now we will init, type | |||||
\begin{verbatim} | |||||
sudo tripwire --init | |||||
sudo twadmin -m P /etc/tripwire/twpol.txt | |||||
sudo tripwire --init | |||||
\end{verbatim} | |||||
to reconfigure twcfg.txt | |||||
run | |||||
\\ | |||||
\textbf{/usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt} | |||||
if you get: | |||||
\begin{verbatim} | |||||
root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt | |||||
# Error: File could not be opened. | |||||
# Filename: /root/site.key | |||||
# No such file or directory | |||||
# Exiting... | |||||
\end{verbatim} | |||||
You must cd to /etc/tripwire directory. | |||||
\subsection{Configuring SSMTP} | |||||
SSMTP is a program you configure once, and can reuse the configuration everywhere\footnote{This is a strength of FOSS and let it remain that way.}. For starters, I'd recommend you install SSMTP according to this guide here: | |||||
\begin{verbatim} | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
\end{verbatim} | |||||
This is a thorough guide that explains debugging. Some steps are superfluous (given that the instructions pertain to different software) but the general directions are sound. And afterwards sending an email is as easy as | |||||
\\ | |||||
\\ | |||||
\textbf{echo "Hello, World" | mail -s "My email check" user@email.com} | |||||
\\ | |||||
\\ | |||||
This guide assumes you have configured SSMTP according to this guide correctly, tested it, and are able to mail from the command line. Once you've setup SSMTP once, you can reproduce this setup on other computers, simply by copying over the revaliases and ssmtp.conf of a valid configuration. | |||||
So let's do that. Copy over revaliases, and ssmtp.conf. test the configuration from the command line using the above echo and mail. Once that works, test out tripwire. | |||||
\\ | |||||
\\ | |||||
\textbf{tripwire --test --email user@email.com} | |||||
\\ | |||||
\\ | |||||
Done. | |||||
\end{document} |
@ -0,0 +1,139 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Setting up Tripwire with SSMTP}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Setting up Tripwire with SSMTP} | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
Tripwire is intrusion detection software for GNU Linux \& BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. | |||||
\section{Steps} | |||||
\subsection{Configuring Tripwire} | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. | |||||
\begin{verbatim} | |||||
apt-get install tripwire mailutils ssmtp | |||||
OR | |||||
emerge -av tripwire mailutils ssmtp | |||||
\end{verbatim} | |||||
\subsubsection{Devuan/Debian} | |||||
Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. | |||||
\footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} | |||||
I use the same password for both. | |||||
\textbf{After install:}The goal when setting this up is to init, as little as possible. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. Let's first edit the configs as much as possible. | |||||
\begin{verbatim} | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii for /etc/tripwire/twpol.txt | |||||
Filename: /etc/rc.boot | |||||
Filename: /root/mail | |||||
Filename: /root/Mail | |||||
Filename: /root/.xsession-errors | |||||
Filename: /root/.xauth | |||||
Filename: /root/.tcshrc | |||||
Filename: /root/.sawfish | |||||
Filename: /root/.pinerc | |||||
Filename: /root/.mc | |||||
Filename: /root/.gnome_private | |||||
Filename: /root/.gnome-desktop | |||||
Filename: /root/.gnome | |||||
Filename: /root/.esd_auth | |||||
Filename: /root/.elm | |||||
Filename: /root/.cshrc | |||||
Filename: /root/.bash_profile | |||||
Filename: /root/.bash_logout | |||||
Filename: /root/.amandahosts | |||||
Filename: /root/.addressbook.lu | |||||
Filename: /root/.addressbook | |||||
Filename: /root/.Xresources | |||||
Filename: /root/.Xauthority | |||||
Filename: /root/.ICEauthority | |||||
Filename: /proc/6136/fd/3 | |||||
Filename: /proc/6136/fdinfo/3 | |||||
Filename: /proc/6136/task/6136/fd/3 | |||||
Filename: /proc/6136/task/6136/fdinfo/3 | |||||
\end{verbatim} | |||||
For proc, you simply comment out the whole directory. (you'll see an entry in the file for /proc, put a \# before that). After twpol, we are not done. We also need to edit the email settings. | |||||
In /etc/tripwire/twcfg.txt we will change the following: | |||||
\begin{verbatim} | |||||
MAILMETHOD =SENDMAIL | |||||
MAILPROGRAM =/root/script.sh | |||||
\end{verbatim} | |||||
script.sh is just a script: (make sure it is executable with chmod +x\footnote{This script appears to be required in this setup.}) | |||||
\begin{verbatim} | |||||
#!/bin/bash | |||||
/usr/sbin/sendmail -s youremail@domain.com | |||||
\end{verbatim} | |||||
Finally, the last change we might make, will be for any special directories we want to watch. I put websites in the root at /sites/ so I will append the following to /etc/tripwire/twpol.txt | |||||
\begin{verbatim} | |||||
# Ruleset for Website | |||||
( | |||||
rulename = "Website Ruleset", | |||||
severity= $(SIG_HI) | |||||
) | |||||
{ | |||||
/sites/ -> $(SEC_CRIT); | |||||
} | |||||
\end{verbatim} | |||||
Now we will init, type | |||||
\begin{verbatim} | |||||
sudo tripwire --init | |||||
sudo twadmin -m P /etc/tripwire/twpol.txt | |||||
sudo tripwire --init | |||||
\end{verbatim} | |||||
to reconfigure twcfg.txt | |||||
run | |||||
\\ | |||||
\textbf{/usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt} | |||||
if you get: | |||||
\begin{verbatim} | |||||
root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt | |||||
# Error: File could not be opened. | |||||
# Filename: /root/site.key | |||||
# No such file or directory | |||||
# Exiting... | |||||
\end{verbatim} | |||||
You must cd to /etc/tripwire directory. | |||||
\subsection{Configuring SSMTP} | |||||
SSMTP is a program you configure once, and can reuse the configuration everywhere\footnote{This is a strength of FOSS and let it remain that way.}. For starters, I'd recommend you install SSMTP according to this guide here: | |||||
\begin{verbatim} | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
\end{verbatim} | |||||
This is a thorough guide that explains debugging. Some steps are superfluous (given that the instructions pertain to different software) but the general directions are sound. And afterwards sending an email is as easy as | |||||
\\ | |||||
\\ | |||||
\textbf{echo "Hello, World" | mail -s "My email check" user@email.com} | |||||
\\ | |||||
\\ | |||||
This guide assumes you have configured SSMTP according to this guide correctly, tested it, and are able to mail from the command line. Once you've setup SSMTP once, you can reproduce this setup on other computers, simply by copying over the revaliases and ssmtp.conf of a valid configuration. | |||||
So let's do that. Copy over revaliases, and ssmtp.conf. test the configuration from the command line using the above echo and mail. Once that works, test out tripwire. | |||||
\\ | |||||
\\ | |||||
\textbf{tripwire --test --email user@email.com} | |||||
\\ | |||||
\\ | |||||
Done. | |||||
\end{document} |
@ -0,0 +1,5 @@ | |||||
\contentsline {section}{\numberline {1}Overview}{1} | |||||
\contentsline {section}{\numberline {2}Steps}{1} | |||||
\contentsline {subsection}{\numberline {2.1}Configuring Tripwire}{1} | |||||
\contentsline {subsubsection}{\numberline {2.1.1}Devuan/Debian}{1} | |||||
\contentsline {subsection}{\numberline {2.2}Configuring SSMTP}{3} |
@ -0,0 +1,6 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Steps}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Configuring Tripwire}{1}} | |||||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.1}Devuan/Debian}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Configuring SSMTP}{4}} |
@ -0,0 +1,259 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 14 JUL 2019 22:09 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_ | |||||
And_ssmtp_for_Email_Alerting/docs/5.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_A | |||||
nd_ssmtp_for_Email_Alerting/docs/5.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./5.aux) | |||||
\openout1 = `5.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
(./5.toc | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <10.95> on input line 3. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <8> on input line 3. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <6> on input line 3. | |||||
) | |||||
\tf@toc=\write3 | |||||
\openout3 = `5.toc'. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <9> on input line 30. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <5> on input line 30. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 30--30 | |||||
[][]\OT1/cmr/m/n/9 For a full walk-through of this pro-cess see this | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 30--30 | |||||
\OT1/cmr/m/n/9 URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detec | |||||
t-modified-files- | |||||
[] | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] | |||||
Overfull \hbox (260.85828pt too wide) in paragraph at lines 65--65 | |||||
[]\OT1/cmtt/m/n/10.95 when whitelisting, this is what needs to be commented out | |||||
in devuan jessie/ascii for /etc/tripwire/twpol.txt[] | |||||
[] | |||||
[2] | |||||
Overfull \hbox (13.36531pt too wide) in paragraph at lines 102--106 | |||||
\OT1/cmr/bx/n/10.95 /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwir | |||||
e/twcfg.txt | |||||
[] | |||||
Overfull \hbox (117.14108pt too wide) in paragraph at lines 114--114 | |||||
[]\OT1/cmtt/m/n/10.95 root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.k | |||||
ey /etc/tripwire/twcfg.txt[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 123--123 | |||||
[]\OT1/cmtt/m/n/10.95 https://wiki.zoneminder.com/How_to_get_ssmtp_working_with | |||||
_Zoneminder[] | |||||
[] | |||||
[3] | |||||
LaTeX Font Info: Try loading font information for OMS+cmr on input line 127. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd | |||||
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions | |||||
) | |||||
LaTeX Font Info: Font shape `OMS/cmr/bx/n' in size <10.95> not available | |||||
(Font) Font shape `OMS/cmsy/b/n' tried instead on input line 127. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 124--131 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 124--131 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 132--139 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 132--139 | |||||
[] | |||||
[4] (./5.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2560 strings out of 495020 | |||||
40774 string characters out of 6181323 | |||||
95813 words of memory out of 5000000 | |||||
5770 multiletter control sequences out of 15000+600000 | |||||
9232 words of font info for 33 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,8n,38p,416b,241s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||||
bsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10. | |||||
pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></ | |||||
usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/sha | |||||
re/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/texli | |||||
ve/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/texmf | |||||
-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-dist/fo | |||||
nts/type1/public/amsfonts/cm/cmtt10.pfb> | |||||
Output written on 5.pdf (4 pages, 112443 bytes). | |||||
PDF statistics: | |||||
49 PDF objects out of 1000 (max. 8388607) | |||||
34 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,141 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Setting up Tripwire with SSMTP}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Setting up Tripwire with SSMTP} | |||||
\tableofcontents | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
Tripwire is intrusion detection software for GNU Linux \& BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. Tripwire isn't too hard to setup, but I had to jump through a hoop for email notifications. Here I cover install, and how to get SSMTP working. | |||||
\section{Steps} | |||||
\subsection{Configuring Tripwire} | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. | |||||
\begin{verbatim} | |||||
apt-get install tripwire mailutils ssmtp | |||||
OR | |||||
emerge -av tripwire mailutils ssmtp | |||||
\end{verbatim} | |||||
\subsubsection{Devuan/Debian} | |||||
Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. | |||||
\footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} | |||||
I use the same password for both. | |||||
\textbf{After install:}The goal when setting this up is to init, as little as possible. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. Let's first edit the configs as much as possible. | |||||
\begin{verbatim} | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii for /etc/tripwire/twpol.txt | |||||
Filename: /etc/rc.boot | |||||
Filename: /root/mail | |||||
Filename: /root/Mail | |||||
Filename: /root/.xsession-errors | |||||
Filename: /root/.xauth | |||||
Filename: /root/.tcshrc | |||||
Filename: /root/.sawfish | |||||
Filename: /root/.pinerc | |||||
Filename: /root/.mc | |||||
Filename: /root/.gnome_private | |||||
Filename: /root/.gnome-desktop | |||||
Filename: /root/.gnome | |||||
Filename: /root/.esd_auth | |||||
Filename: /root/.elm | |||||
Filename: /root/.cshrc | |||||
Filename: /root/.bash_profile | |||||
Filename: /root/.bash_logout | |||||
Filename: /root/.amandahosts | |||||
Filename: /root/.addressbook.lu | |||||
Filename: /root/.addressbook | |||||
Filename: /root/.Xresources | |||||
Filename: /root/.Xauthority | |||||
Filename: /root/.ICEauthority | |||||
Filename: /proc/6136/fd/3 | |||||
Filename: /proc/6136/fdinfo/3 | |||||
Filename: /proc/6136/task/6136/fd/3 | |||||
Filename: /proc/6136/task/6136/fdinfo/3 | |||||
\end{verbatim} | |||||
For proc, you simply comment out the whole directory. (you'll see an entry in the file for /proc, put a \# before that). After twpol, we are not done. We also need to edit the email settings. | |||||
In /etc/tripwire/twcfg.txt we will change the following: | |||||
\begin{verbatim} | |||||
MAILMETHOD =SENDMAIL | |||||
MAILPROGRAM =/root/script.sh | |||||
\end{verbatim} | |||||
script.sh is just a script: (make sure it is executable with chmod +x\footnote{This script appears to be required in this setup.}) | |||||
\begin{verbatim} | |||||
#!/bin/bash | |||||
/usr/sbin/sendmail -s youremail@domain.com | |||||
\end{verbatim} | |||||
Finally, the last change we might make, will be for any special directories we want to watch. I put websites in the root at /sites/ so I will append the following to /etc/tripwire/twpol.txt | |||||
\begin{verbatim} | |||||
# Ruleset for Website | |||||
( | |||||
rulename = "Website Ruleset", | |||||
severity= $(SIG_HI) | |||||
) | |||||
{ | |||||
/sites/ -> $(SEC_CRIT); | |||||
} | |||||
\end{verbatim} | |||||
Now we will init, type | |||||
\begin{verbatim} | |||||
sudo tripwire --init | |||||
sudo twadmin -m P /etc/tripwire/twpol.txt | |||||
sudo tripwire --init | |||||
\end{verbatim} | |||||
to reconfigure twcfg.txt | |||||
run | |||||
\\ | |||||
\textbf{/usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt} | |||||
if you get: | |||||
\begin{verbatim} | |||||
root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt | |||||
# Error: File could not be opened. | |||||
# Filename: /root/site.key | |||||
# No such file or directory | |||||
# Exiting... | |||||
\end{verbatim} | |||||
You must cd to /etc/tripwire directory. | |||||
\subsection{Configuring SSMTP} | |||||
SSMTP is a program you configure once, and can reuse the configuration everywhere\footnote{This is a strength of FOSS and let it remain that way.}. For starters, I'd recommend you install SSMTP according to this guide here: | |||||
\begin{verbatim} | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
\end{verbatim} | |||||
This is a thorough guide that explains debugging. Some steps are superfluous (given that the instructions pertain to different software) but the general directions are sound. And afterwards sending an email is as easy as | |||||
\\ | |||||
\\ | |||||
\textbf{echo "Hello, World" \textbar mail -s "My email check" user@email.com} | |||||
\\ | |||||
\\ | |||||
This guide assumes you have configured SSMTP according to this guide correctly, tested it, and are able to mail from the command line. Once you've setup SSMTP once, you can reproduce this setup on other computers, simply by copying over the revaliases and ssmtp.conf of a valid configuration. | |||||
So let's do that. Copy over revaliases, and ssmtp.conf. test the configuration from the command line using the above echo and mail. Once that works, test out tripwire. | |||||
\\ | |||||
\\ | |||||
\textbf{tripwire --test --email user@email.com} | |||||
\\ | |||||
\\ | |||||
Done. | |||||
\end{document} |
@ -0,0 +1,141 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Setting up Tripwire with SSMTP}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Setting up Tripwire with SSMTP} | |||||
\tableofcontents | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
Tripwire is intrusion detection software for GNU Linux \& BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. Tripwire isn't too hard to setup, but I had to jump through a hoop for email notifications. Here I cover install, and how to get SSMTP working. | |||||
\section{Steps} | |||||
\subsection{Configuring Tripwire} | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. | |||||
\begin{verbatim} | |||||
apt-get install tripwire mailutils ssmtp | |||||
OR | |||||
emerge -av tripwire mailutils ssmtp | |||||
\end{verbatim} | |||||
\subsubsection{Devuan/Debian} | |||||
Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. | |||||
\footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} | |||||
I use the same password for both. | |||||
\textbf{After install:}The goal when setting this up is to init, as little as possible. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. Let's first edit the configs as much as possible. | |||||
\begin{verbatim} | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii for /etc/tripwire/twpol.txt | |||||
Filename: /etc/rc.boot | |||||
Filename: /root/mail | |||||
Filename: /root/Mail | |||||
Filename: /root/.xsession-errors | |||||
Filename: /root/.xauth | |||||
Filename: /root/.tcshrc | |||||
Filename: /root/.sawfish | |||||
Filename: /root/.pinerc | |||||
Filename: /root/.mc | |||||
Filename: /root/.gnome_private | |||||
Filename: /root/.gnome-desktop | |||||
Filename: /root/.gnome | |||||
Filename: /root/.esd_auth | |||||
Filename: /root/.elm | |||||
Filename: /root/.cshrc | |||||
Filename: /root/.bash_profile | |||||
Filename: /root/.bash_logout | |||||
Filename: /root/.amandahosts | |||||
Filename: /root/.addressbook.lu | |||||
Filename: /root/.addressbook | |||||
Filename: /root/.Xresources | |||||
Filename: /root/.Xauthority | |||||
Filename: /root/.ICEauthority | |||||
Filename: /proc/6136/fd/3 | |||||
Filename: /proc/6136/fdinfo/3 | |||||
Filename: /proc/6136/task/6136/fd/3 | |||||
Filename: /proc/6136/task/6136/fdinfo/3 | |||||
\end{verbatim} | |||||
For proc, you simply comment out the whole directory. (you'll see an entry in the file for /proc, put a \# before that). After twpol, we are not done. We also need to edit the email settings. | |||||
In /etc/tripwire/twcfg.txt we will change the following: | |||||
\begin{verbatim} | |||||
MAILMETHOD =SENDMAIL | |||||
MAILPROGRAM =/root/script.sh | |||||
\end{verbatim} | |||||
script.sh is just a script: (make sure it is executable with chmod +x\footnote{This script appears to be required in this setup.}) | |||||
\begin{verbatim} | |||||
#!/bin/bash | |||||
/usr/sbin/sendmail -s youremail@domain.com | |||||
\end{verbatim} | |||||
Finally, the last change we might make, will be for any special directories we want to watch. I put websites in the root at /sites/ so I will append the following to /etc/tripwire/twpol.txt | |||||
\begin{verbatim} | |||||
# Ruleset for Website | |||||
( | |||||
rulename = "Website Ruleset", | |||||
severity= $(SIG_HI) | |||||
) | |||||
{ | |||||
/sites/ -> $(SEC_CRIT); | |||||
} | |||||
\end{verbatim} | |||||
Now we will init, type | |||||
\begin{verbatim} | |||||
sudo tripwire --init | |||||
sudo twadmin -m P /etc/tripwire/twpol.txt | |||||
sudo tripwire --init | |||||
\end{verbatim} | |||||
to reconfigure twcfg.txt | |||||
run | |||||
\\ | |||||
\textbf{/usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt} | |||||
if you get: | |||||
\begin{verbatim} | |||||
root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt | |||||
# Error: File could not be opened. | |||||
# Filename: /root/site.key | |||||
# No such file or directory | |||||
# Exiting... | |||||
\end{verbatim} | |||||
You must cd to /etc/tripwire directory. | |||||
\subsection{Configuring SSMTP} | |||||
SSMTP is a program you configure once, and can reuse the configuration everywhere\footnote{This is a strength of FOSS and let it remain that way.}. For starters, I'd recommend you install SSMTP according to this guide here: | |||||
\begin{verbatim} | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
\end{verbatim} | |||||
This is a thorough guide that explains debugging. Some steps are superfluous (given that the instructions pertain to different software) but the general directions are sound. And afterwards sending an email is as easy as | |||||
\\ | |||||
\\ | |||||
\textbf{echo "Hello, World" | mail -s "My email check" user@email.com} | |||||
\\ | |||||
\\ | |||||
This guide assumes you have configured SSMTP according to this guide correctly, tested it, and are able to mail from the command line. Once you've setup SSMTP once, you can reproduce this setup on other computers, simply by copying over the revaliases and ssmtp.conf of a valid configuration. | |||||
So let's do that. Copy over revaliases, and ssmtp.conf. test the configuration from the command line using the above echo and mail. Once that works, test out tripwire. | |||||
\\ | |||||
\\ | |||||
\textbf{tripwire --test --email user@email.com} | |||||
\\ | |||||
\\ | |||||
Done. | |||||
\end{document} |
@ -0,0 +1,5 @@ | |||||
\contentsline {section}{\numberline {1}Overview}{1} | |||||
\contentsline {section}{\numberline {2}Steps}{1} | |||||
\contentsline {subsection}{\numberline {2.1}Configuring Tripwire}{1} | |||||
\contentsline {subsubsection}{\numberline {2.1.1}Devuan/Debian}{1} | |||||
\contentsline {subsection}{\numberline {2.2}Configuring SSMTP}{4} |
@ -0,0 +1,6 @@ | |||||
\relax | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Steps}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Configuring Tripwire}{1}} | |||||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.1}Devuan/Debian}{1}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Configuring SSMTP}{4}} |
@ -0,0 +1,71 @@ | |||||
<p> | |||||
<b>Setting up Tripwire with SSMTP</b> | |||||
<p> | |||||
\tableofcontents | |||||
<p> | |||||
\vspace{0.2in} This document is best read printed out on paper. | |||||
<p> | |||||
<b>1. Overview </b> | |||||
<p> | |||||
Tripwire is intrusion detection software for GNU Linux & BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. Tripwire isn't too hard to setup, but I had to jump through a hoop for email notifications. Here I cover install, and how to get SSMTP working. | |||||
<p> | |||||
<b>2. Steps </b> | |||||
<p> | |||||
<p> | |||||
<b> 2.1. Configuring Tripwire </b> | |||||
<p> | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. apt-get install tripwire mailutils ssmtp OR emerge -av tripwire mailutils ssmtp \subsubsection{Devuan/Debian} Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. \footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} I use the same password for both. | |||||
<p> | |||||
<b>After install:</b>The goal when setting this up is to init, as little as possible. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. Let's first edit the configs as much as possible. | |||||
<p> | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii for /etc/tripwire/twpol.txt | |||||
<p> | |||||
Filename: /etc/rc.boot Filename: /root/mail Filename: /root/Mail Filename: /root/.xsession-errors Filename: /root/.xauth Filename: /root/.tcshrc Filename: /root/.sawfish Filename: /root/.pinerc Filename: /root/.mc Filename: /root/.gnome_private Filename: /root/.gnome-desktop Filename: /root/.gnome Filename: /root/.esd_auth Filename: /root/.elm Filename: /root/.cshrc Filename: /root/.bash_profile Filename: /root/.bash_logout Filename: /root/.amandahosts Filename: /root/.addressbook.lu Filename: /root/.addressbook Filename: /root/.Xresources Filename: /root/.Xauthority Filename: /root/.ICEauthority Filename: /proc/6136/fd/3 Filename: /proc/6136/fdinfo/3 Filename: /proc/6136/task/6136/fd/3 Filename: /proc/6136/task/6136/fdinfo/3 For proc, you simply comment out the whole directory. (you'll see an entry in the file for /proc, put a \# before that). After twpol, we are not done. We also need to edit the email settings. | |||||
<p> | |||||
In /etc/tripwire/twcfg.txt we will change the following: MAILMETHOD =SENDMAIL MAILPROGRAM =/root/script.sh script.sh is just a script: (make sure it is executable with chmod +x\footnote{This script appears to be required in this setup.}) #!/bin/bash /usr/sbin/sendmail -s youremail@domain.com | |||||
<p> | |||||
Finally, the last change we might make, will be for any special directories we want to watch. I put websites in the root at /sites/ so I will append the following to /etc/tripwire/twpol.txt # Ruleset for Website ( rulename = "Website Ruleset", severity= $latex {(SIG_HI) ) { /sites/ -> }&fg=000000$(SEC_CRIT); } | |||||
<p> | |||||
Now we will init, type sudo tripwire --init sudo twadmin -m P /etc/tripwire/twpol.txt sudo tripwire --init | |||||
<p> | |||||
to reconfigure twcfg.txt run <br/> | |||||
<b>/usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt</b> | |||||
<p> | |||||
if you get: root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt # Error: File could not be opened. # Filename: /root/site.key # No such file or directory # Exiting... You must cd to /etc/tripwire directory. | |||||
<p> | |||||
<p> | |||||
<b> 2.2. Configuring SSMTP </b> | |||||
<p> | |||||
<p> | |||||
SSMTP is a program you configure once, and can reuse the configuration everywhere\footnote{This is a strength of FOSS and let it remain that way.}. For starters, I'd recommend you install SSMTP according to this guide here: https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder This is a thorough guide that explains debugging. Some steps are superfluous (given that the instructions pertain to different software) but the general directions are sound. And afterwards sending an email is as easy as <br/> | |||||
<br/> | |||||
<b>echo "Hello, World" \textbar mail -s "My email check" user@email.com</b> <br/> | |||||
<br/> | |||||
This guide assumes you have configured SSMTP according to this guide correctly, tested it, and are able to mail from the command line. Once you've setup SSMTP once, you can reproduce this setup on other computers, simply by copying over the revaliases and ssmtp.conf of a valid configuration. | |||||
<p> | |||||
So let's do that. Copy over revaliases, and ssmtp.conf. test the configuration from the command line using the above echo and mail. Once that works, test out tripwire. <br/> | |||||
<br/> | |||||
<b>tripwire --test --email user@email.com</b> <br/> | |||||
<br/> | |||||
Done. | |||||
<p> |
@ -0,0 +1,259 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 15 JUL 2019 23:23 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_ | |||||
And_ssmtp_for_Email_Alerting/docs/6.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/IT_Articles/2019/Tripwire_A | |||||
nd_ssmtp_for_Email_Alerting/docs/6.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo | |||||
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
) | |||||
\Gread@gobject=\count87 | |||||
)) | |||||
\Gin@req@height=\dimen103 | |||||
\Gin@req@width=\dimen104 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty | |||||
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty | |||||
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR) | |||||
Package caption3 Info: TeX engine: e-TeX on input line 57. | |||||
\captionmargin=\dimen105 | |||||
\captionmargin@=\dimen106 | |||||
\captionwidth=\dimen107 | |||||
\caption@tempdima=\dimen108 | |||||
\caption@indent=\dimen109 | |||||
\caption@parindent=\dimen110 | |||||
\caption@hangindent=\dimen111 | |||||
) | |||||
\c@ContinuedFloat=\count88 | |||||
) (./6.aux) | |||||
\openout1 = `6.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. | |||||
LaTeX Font Info: ... okay on input line 8. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count89 | |||||
\scratchdimen=\dimen112 | |||||
\scratchbox=\box26 | |||||
\nofMPsegments=\count90 | |||||
\nofMParguments=\count91 | |||||
\everyMPshowfont=\toks15 | |||||
\MPscratchCnt=\count92 | |||||
\MPscratchDim=\dimen113 | |||||
\MPnumerator=\count93 | |||||
\makeMPintoPDFobject=\count94 | |||||
\everyMPtoPDFconversion=\toks16 | |||||
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
))) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
Package caption Info: Begin \AtBeginDocument code. | |||||
Package caption Info: End \AtBeginDocument code. | |||||
(./6.toc | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <10.95> on input line 3. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <8> on input line 3. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <6> on input line 3. | |||||
) | |||||
\tf@toc=\write3 | |||||
\openout3 = `6.toc'. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <9> on input line 30. | |||||
LaTeX Font Info: External font `cmex10' loaded for size | |||||
(Font) <5> on input line 30. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 30--30 | |||||
[][]\OT1/cmr/m/n/9 For a full walk-through of this pro-cess see this | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 30--30 | |||||
\OT1/cmr/m/n/9 URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detec | |||||
t-modified-files- | |||||
[] | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] | |||||
Overfull \hbox (260.85828pt too wide) in paragraph at lines 65--65 | |||||
[]\OT1/cmtt/m/n/10.95 when whitelisting, this is what needs to be commented out | |||||
in devuan jessie/ascii for /etc/tripwire/twpol.txt[] | |||||
[] | |||||
[2] | |||||
Overfull \hbox (13.36531pt too wide) in paragraph at lines 102--106 | |||||
\OT1/cmr/bx/n/10.95 /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwir | |||||
e/twcfg.txt | |||||
[] | |||||
Overfull \hbox (117.14108pt too wide) in paragraph at lines 114--114 | |||||
[]\OT1/cmtt/m/n/10.95 root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.k | |||||
ey /etc/tripwire/twcfg.txt[] | |||||
[] | |||||
Overfull \hbox (30.91077pt too wide) in paragraph at lines 123--123 | |||||
[]\OT1/cmtt/m/n/10.95 https://wiki.zoneminder.com/How_to_get_ssmtp_working_with | |||||
_Zoneminder[] | |||||
[] | |||||
[3] | |||||
LaTeX Font Info: Try loading font information for OMS+cmr on input line 127. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd | |||||
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions | |||||
) | |||||
LaTeX Font Info: Font shape `OMS/cmr/bx/n' in size <10.95> not available | |||||
(Font) Font shape `OMS/cmsy/b/n' tried instead on input line 127. | |||||
Underfull \hbox (badness 10000) in paragraph at lines 124--131 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 124--131 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 132--139 | |||||
[] | |||||
Underfull \hbox (badness 10000) in paragraph at lines 132--139 | |||||
[] | |||||
[4] (./6.aux) ) | |||||
Here is how much of TeX's memory you used: | |||||
2560 strings out of 495020 | |||||
40774 string characters out of 6181323 | |||||
95813 words of memory out of 5000000 | |||||
5770 multiletter control sequences out of 15000+600000 | |||||
9232 words of font info for 33 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
38i,8n,38p,416b,241s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||||
bsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10. | |||||
pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></ | |||||
usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/sha | |||||
re/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/texli | |||||
ve/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/texmf | |||||
-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-dist/fo | |||||
nts/type1/public/amsfonts/cm/cmtt10.pfb> | |||||
Output written on 6.pdf (4 pages, 112443 bytes). | |||||
PDF statistics: | |||||
49 PDF objects out of 1000 (max. 8388607) | |||||
34 compressed objects within 1 object stream | |||||
0 named destinations out of 1000 (max. 500000) | |||||
1 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,141 @@ | |||||
\documentclass[11pt]{article} | |||||
%Gummi|065|=) | |||||
\title{\textbf{Setting up Tripwire with SSMTP}} | |||||
\usepackage{graphicx} | |||||
\usepackage{caption } | |||||
\author{Steak Electronics} | |||||
\date{06/4/19} | |||||
\begin{document} | |||||
%\maketitle | |||||
\textbf{Setting up Tripwire with SSMTP} | |||||
\tableofcontents | |||||
\vspace{0.2in} | |||||
This document is best read printed out on paper. | |||||
%\textbf{Todo} | |||||
\section{Overview} | |||||
Tripwire is intrusion detection software for GNU Linux \& BSD. Let's document how to set it up on a server with SSMTP configured for email notifications. Tripwire isn't too hard to setup, but I had to jump through a hoop for email notifications. Here I cover install, and how to get SSMTP working. | |||||
\section{Steps} | |||||
\subsection{Configuring Tripwire} | |||||
First install Tripwire. This will depend on your package manager. The two examples I have will be either Gentoo, or Debian/Devuan. | |||||
\begin{verbatim} | |||||
apt-get install tripwire mailutils ssmtp | |||||
OR | |||||
emerge -av tripwire mailutils ssmtp | |||||
\end{verbatim} | |||||
\subsubsection{Devuan/Debian} | |||||
Devuan will prompt you for a few things in an ncurses gui. Answer all of the defaults (yes for a site key, yes for a user key, etc...). Record your password. | |||||
\footnote{For a full walkthrough of this process see this URL:https://www.howtoforge.com/tutorial/how-to-monitor-and-detect-modified-files-using-tripwire-on-ubuntu-1604/ This process includes most, but not all of what you need to know.} | |||||
I use the same password for both. | |||||
\textbf{After install:}The goal when setting this up is to init, as little as possible. Each init is about 2-3 minutes, so time can be avoided, if you know what configs you need. Let's first edit the configs as much as possible. | |||||
\begin{verbatim} | |||||
when whitelisting, this is what needs to be commented out in devuan jessie/ascii for /etc/tripwire/twpol.txt | |||||
Filename: /etc/rc.boot | |||||
Filename: /root/mail | |||||
Filename: /root/Mail | |||||
Filename: /root/.xsession-errors | |||||
Filename: /root/.xauth | |||||
Filename: /root/.tcshrc | |||||
Filename: /root/.sawfish | |||||
Filename: /root/.pinerc | |||||
Filename: /root/.mc | |||||
Filename: /root/.gnome_private | |||||
Filename: /root/.gnome-desktop | |||||
Filename: /root/.gnome | |||||
Filename: /root/.esd_auth | |||||
Filename: /root/.elm | |||||
Filename: /root/.cshrc | |||||
Filename: /root/.bash_profile | |||||
Filename: /root/.bash_logout | |||||
Filename: /root/.amandahosts | |||||
Filename: /root/.addressbook.lu | |||||
Filename: /root/.addressbook | |||||
Filename: /root/.Xresources | |||||
Filename: /root/.Xauthority | |||||
Filename: /root/.ICEauthority | |||||
Filename: /proc/6136/fd/3 | |||||
Filename: /proc/6136/fdinfo/3 | |||||
Filename: /proc/6136/task/6136/fd/3 | |||||
Filename: /proc/6136/task/6136/fdinfo/3 | |||||
\end{verbatim} | |||||
For proc, you simply comment out the whole directory. (you'll see an entry in the file for /proc, put a \# before that). After twpol, we are not done. We also need to edit the email settings. | |||||
In /etc/tripwire/twcfg.txt we will change the following: | |||||
\begin{verbatim} | |||||
MAILMETHOD =SENDMAIL | |||||
MAILPROGRAM =/root/script.sh | |||||
\end{verbatim} | |||||
script.sh is just a script: (make sure it is executable with chmod +x\footnote{This script appears to be required in this setup.}) | |||||
\begin{verbatim} | |||||
#!/bin/bash | |||||
/usr/sbin/sendmail -s youremail@domain.com | |||||
\end{verbatim} | |||||
Finally, the last change we might make, will be for any special directories we want to watch. I put websites in the root at /sites/ so I will append the following to /etc/tripwire/twpol.txt | |||||
\begin{verbatim} | |||||
# Ruleset for Website | |||||
( | |||||
rulename = "Website Ruleset", | |||||
severity= $(SIG_HI) | |||||
) | |||||
{ | |||||
/sites/ -> $(SEC_CRIT); | |||||
} | |||||
\end{verbatim} | |||||
Now we will init, type | |||||
\begin{verbatim} | |||||
sudo tripwire --init | |||||
sudo twadmin -m P /etc/tripwire/twpol.txt | |||||
sudo tripwire --init | |||||
\end{verbatim} | |||||
to reconfigure twcfg.txt | |||||
run | |||||
\\ | |||||
\textbf{/usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt} | |||||
if you get: | |||||
\begin{verbatim} | |||||
root@site:~# /usr/sbin/twadmin --create-cfgfile -S site.key /etc/tripwire/twcfg.txt | |||||
# Error: File could not be opened. | |||||
# Filename: /root/site.key | |||||
# No such file or directory | |||||
# Exiting... | |||||
\end{verbatim} | |||||
You must cd to /etc/tripwire directory. | |||||
\subsection{Configuring SSMTP} | |||||
SSMTP is a program you configure once, and can reuse the configuration everywhere\footnote{This is a strength of FOSS and let it remain that way.}. For starters, I'd recommend you install SSMTP according to this guide here: | |||||
\begin{verbatim} | |||||
https://wiki.zoneminder.com/How_to_get_ssmtp_working_with_Zoneminder | |||||
\end{verbatim} | |||||
This is a thorough guide that explains debugging. Some steps are superfluous (given that the instructions pertain to different software) but the general directions are sound. And afterwards sending an email is as easy as | |||||
\\ | |||||
\\ | |||||
\textbf{echo "Hello, World" \textbar mail -s "My email check" user@email.com} | |||||
\\ | |||||
\\ | |||||
This guide assumes you have configured SSMTP according to this guide correctly, tested it, and are able to mail from the command line. Once you've setup SSMTP once, you can reproduce this setup on other computers, simply by copying over the revaliases and ssmtp.conf of a valid configuration. | |||||
So let's do that. Copy over revaliases, and ssmtp.conf. test the configuration from the command line using the above echo and mail. Once that works, test out tripwire. | |||||
\\ | |||||
\\ | |||||
\textbf{tripwire --test --email user@email.com} | |||||
\\ | |||||
\\ | |||||
Done. | |||||
\end{document} |
@ -0,0 +1,5 @@ | |||||
\contentsline {section}{\numberline {1}Overview}{1} | |||||
\contentsline {section}{\numberline {2}Steps}{1} | |||||
\contentsline {subsection}{\numberline {2.1}Configuring Tripwire}{1} | |||||
\contentsline {subsubsection}{\numberline {2.1.1}Devuan/Debian}{1} | |||||
\contentsline {subsection}{\numberline {2.2}Configuring SSMTP}{4} |
@ -0,0 +1,16 @@ | |||||
Version 0.6.2, May 6, 2009 | |||||
- Additional support for accented characters | |||||
- Convert '>' and '<' to HTML codes | |||||
- Changed to handling of \& and \% in math mode to reflect | |||||
different WordPress treatment of them | |||||
Version 0.6.1 February 23, 2009 | |||||
- Simplified format of latex2wpstyle.py (by Radu Grigore) | |||||
- Allow nesting of font styles such as \bf and \em (by Radu Grigore) | |||||
- Allow escaped symbols such as \$ in math mode | |||||
- LaTeX macros are correctly "tokenized" | |||||
- Support eqnarray* environment | |||||
Version 0.6 February 21, 2009 | |||||
First release |
@ -0,0 +1,26 @@ | |||||
\relax | |||||
\providecommand\hyper@newdestlabel[2]{} | |||||
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} | |||||
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined | |||||
\global\let\oldcontentsline\contentsline | |||||
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} | |||||
\global\let\oldnewlabel\newlabel | |||||
\gdef\newlabel#1#2{\newlabelxx{#1}#2} | |||||
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} | |||||
\AtEndDocument{\ifx\hyper@anchor\@undefined | |||||
\let\contentsline\oldcontentsline | |||||
\let\newlabel\oldnewlabel | |||||
\fi} | |||||
\fi} | |||||
\global\let\hyper@last\relax | |||||
\gdef\HyperFirstAtBeginDocument#1{#1} | |||||
\providecommand\HyField@AuxAddToFields[1]{} | |||||
\providecommand\HyField@AuxAddToCoFields[2]{} | |||||
\newlabel{lm:main}{{1}{1}{Main}{theorem.1}{}} | |||||
\newlabel{eq:lemma}{{1}{1}{Main}{equation.0.1}{}} | |||||
\newlabel{th:ad}{{2}{1}{}{theorem.2}{}} | |||||
\newlabel{eq:test}{{2}{1}{}{equation.0.2}{}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {1}A section}{4}{section.1}} | |||||
\newlabel{sec}{{1}{4}{A section}{section.1}{}} | |||||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}And a subsection}{4}{subsection.1.1}} | |||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Changing the style}{4}{section.2}} |
@ -0,0 +1,433 @@ | |||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 14 JUN 2019 01:55 | |||||
entering extended mode | |||||
restricted \write18 enabled. | |||||
%&-line parsing enabled. | |||||
**/home/layoutdev/Desktop/code/documentation_general/Misc_2019/latex_to_wordpre | |||||
ss/resources/example.tex | |||||
(/home/layoutdev/Desktop/code/documentation_general/Misc_2019/latex_to_wordpres | |||||
s/resources/example.tex | |||||
LaTeX2e <2014/05/01> | |||||
Babel <3.9l> and hyphenation patterns for 2 languages loaded. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls | |||||
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo | |||||
File: size12.clo 2014/09/29 v1.4h Standard LaTeX file (size option) | |||||
) | |||||
\c@part=\count79 | |||||
\c@section=\count80 | |||||
\c@subsection=\count81 | |||||
\c@subsubsection=\count82 | |||||
\c@paragraph=\count83 | |||||
\c@subparagraph=\count84 | |||||
\c@figure=\count85 | |||||
\c@table=\count86 | |||||
\abovecaptionskip=\skip41 | |||||
\belowcaptionskip=\skip42 | |||||
\bibindent=\dimen102 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty | |||||
Package: hyperref 2012/11/06 v6.83m Hypertext links for LaTeX | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty | |||||
Package: hobsub-hyperref 2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty | |||||
Package: hobsub-generic 2012/05/28 v1.13 Bundle oberdiek, subset generic (HO) | |||||
Package: hobsub 2012/05/28 v1.13 Construct package bundles (HO) | |||||
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) | |||||
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) | |||||
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) | |||||
Package ifluatex Info: LuaTeX not detected. | |||||
Package: ifvtex 2010/03/01 v1.5 Detect VTeX and its facilities (HO) | |||||
Package ifvtex Info: VTeX not detected. | |||||
Package: intcalc 2007/09/27 v1.1 Expandable calculations with integers (HO) | |||||
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) | |||||
Package ifpdf Info: pdfTeX in PDF mode is detected. | |||||
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) | |||||
Package etexcmds Info: Could not find \expanded. | |||||
(etexcmds) That can mean that you are not using pdfTeX 1.50 or | |||||
(etexcmds) that some package has redefined \expanded. | |||||
(etexcmds) In the latter case, load this package earlier. | |||||
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) | |||||
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) | |||||
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO | |||||
) | |||||
Package pdftexcmds Info: LuaTeX not detected. | |||||
Package pdftexcmds Info: \pdf@primitive is available. | |||||
Package pdftexcmds Info: \pdf@ifprimitive is available. | |||||
Package pdftexcmds Info: \pdfdraftmode found. | |||||
Package: pdfescape 2011/11/25 v1.13 Implements pdfTeX's escape features (HO) | |||||
Package: bigintcalc 2012/04/08 v1.3 Expandable calculations on big integers (HO | |||||
) | |||||
Package: bitset 2011/01/30 v1.1 Handle bit-vector datatype (HO) | |||||
Package: uniquecounter 2011/01/30 v1.2 Provide unlimited unique counter (HO) | |||||
) | |||||
Package hobsub Info: Skipping package `hobsub' (already loaded). | |||||
Package: letltxmacro 2010/09/02 v1.4 Let assignment for LaTeX macros (HO) | |||||
Package: hopatch 2012/05/28 v1.2 Wrapper for package hooks (HO) | |||||
Package: xcolor-patch 2011/01/30 xcolor patch | |||||
Package: atveryend 2011/06/30 v1.8 Hooks at the very end of document (HO) | |||||
Package atveryend Info: \enddocument detected (standard20110627). | |||||
Package: atbegshi 2011/10/05 v1.16 At begin shipout hook (HO) | |||||
Package: refcount 2011/10/16 v3.4 Data extraction from label references (HO) | |||||
Package: hycolor 2011/01/30 v1.7 Color options for hyperref/bookmark (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty | |||||
Package: keyval 2014/05/08 v1.15 key=value parser (DPC) | |||||
\KV@toks@=\toks14 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty | |||||
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty | |||||
Package: auxhook 2011/03/04 v1.3 Hooks for auxiliary files (HO) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty | |||||
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) | |||||
) | |||||
\@linkdim=\dimen103 | |||||
\Hy@linkcounter=\count87 | |||||
\Hy@pagecounter=\count88 | |||||
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def | |||||
File: pd1enc.def 2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO) | |||||
) | |||||
\Hy@SavedSpaceFactor=\count89 | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg | |||||
File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive | |||||
) | |||||
Package hyperref Warning: Option `letterpaper' is no longer used. | |||||
Package hyperref Info: Option `colorlinks' set `true' on input line 4319. | |||||
Package hyperref Warning: Values of option `pdfpagemode': | |||||
(hyperref) * `UseNone' | |||||
(hyperref) * `UseOutlines' | |||||
(hyperref) * `UseThumbs' | |||||
(hyperref) * `FullScreen' | |||||
(hyperref) * `UseOC' (PDF 1.5) | |||||
(hyperref) * `UseAttachments' (PDF 1.6) | |||||
(hyperref) * An empty value disables the option. | |||||
(hyperref) Unknown value `none' on input line 4319. | |||||
Package hyperref Info: Hyper figures OFF on input line 4443. | |||||
Package hyperref Info: Link nesting OFF on input line 4448. | |||||
Package hyperref Info: Hyper index ON on input line 4451. | |||||
Package hyperref Info: Plain pages OFF on input line 4458. | |||||
Package hyperref Info: Backreferencing ON on input line 4461. | |||||
Package hyperref Info: Implicit mode ON; LaTeX internals redefined. | |||||
Package hyperref Info: Bookmarks ON on input line 4688. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/backref.sty | |||||
Package: backref 2012/07/25 v1.38 Bibliographical back referencing | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty | |||||
Package: rerunfilecheck 2011/04/15 v1.7 Rerun checks for auxiliary files (HO) | |||||
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2 | |||||
82. | |||||
)) | |||||
\c@Hy@tempcnt=\count90 | |||||
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty | |||||
\Urlmuskip=\muskip10 | |||||
Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. | |||||
) | |||||
LaTeX Info: Redefining \url on input line 5041. | |||||
\XeTeXLinkMargin=\dimen104 | |||||
\Fld@menulength=\count91 | |||||
\Field@Width=\dimen105 | |||||
\Fld@charsize=\dimen106 | |||||
Package hyperref Info: Hyper figures OFF on input line 6295. | |||||
Package hyperref Info: Link nesting OFF on input line 6300. | |||||
Package hyperref Info: Hyper index ON on input line 6303. | |||||
Package hyperref Info: backreferencing ON on input line 6308. | |||||
Package hyperref Info: Link coloring ON on input line 6313. | |||||
Package hyperref Info: Link coloring with OCG OFF on input line 6320. | |||||
Package hyperref Info: PDF/A mode OFF on input line 6325. | |||||
LaTeX Info: Redefining \ref on input line 6365. | |||||
LaTeX Info: Redefining \pageref on input line 6369. | |||||
\Hy@abspage=\count92 | |||||
\c@Item=\count93 | |||||
\c@Hfootnote=\count94 | |||||
) | |||||
Package hyperref Message: Driver: hpdftex. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def | |||||
File: hpdftex.def 2012/11/06 v6.83m Hyperref driver for pdfTeX | |||||
\Fld@listcount=\count95 | |||||
\c@bookmark@seq@number=\count96 | |||||
\Hy@SectionHShift=\skip43 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty | |||||
Package: amsmath 2013/01/14 v2.14 AMS math features | |||||
\@mathmargin=\skip44 | |||||
For additional information on amsmath, use the `?' option. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty | |||||
Package: amstext 2000/06/29 v2.01 | |||||
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty | |||||
File: amsgen.sty 1999/11/30 v2.0 | |||||
\@emptytoks=\toks15 | |||||
\ex@=\dimen107 | |||||
)) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty | |||||
Package: amsbsy 1999/11/29 v1.2d | |||||
\pmbraise@=\dimen108 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty | |||||
Package: amsopn 1999/12/14 v2.01 operator names | |||||
) | |||||
\inf@bad=\count97 | |||||
LaTeX Info: Redefining \frac on input line 210. | |||||
\uproot@=\count98 | |||||
\leftroot@=\count99 | |||||
LaTeX Info: Redefining \overline on input line 306. | |||||
\classnum@=\count100 | |||||
\DOTSCASE@=\count101 | |||||
LaTeX Info: Redefining \ldots on input line 378. | |||||
LaTeX Info: Redefining \dots on input line 381. | |||||
LaTeX Info: Redefining \cdots on input line 466. | |||||
\Mathstrutbox@=\box26 | |||||
\strutbox@=\box27 | |||||
\big@size=\dimen109 | |||||
LaTeX Font Info: Redeclaring font encoding OML on input line 566. | |||||
LaTeX Font Info: Redeclaring font encoding OMS on input line 567. | |||||
\macc@depth=\count102 | |||||
\c@MaxMatrixCols=\count103 | |||||
\dotsspace@=\muskip11 | |||||
\c@parentequation=\count104 | |||||
\dspbrk@lvl=\count105 | |||||
\tag@help=\toks16 | |||||
\row@=\count106 | |||||
\column@=\count107 | |||||
\maxfields@=\count108 | |||||
\andhelp@=\toks17 | |||||
\eqnshift@=\dimen110 | |||||
\alignsep@=\dimen111 | |||||
\tagshift@=\dimen112 | |||||
\tagwidth@=\dimen113 | |||||
\totwidth@=\dimen114 | |||||
\lineht@=\dimen115 | |||||
\@envbody=\toks18 | |||||
\multlinegap=\skip45 | |||||
\multlinetaggap=\skip46 | |||||
\mathdisplay@stack=\toks19 | |||||
LaTeX Info: Redefining \[ on input line 2665. | |||||
LaTeX Info: Redefining \] on input line 2666. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty | |||||
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support | |||||
\symAMSa=\mathgroup4 | |||||
\symAMSb=\mathgroup5 | |||||
LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' | |||||
(Font) U/euf/m/n --> U/euf/b/n on input line 106. | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty | |||||
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty | |||||
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty | |||||
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg | |||||
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live | |||||
) | |||||
Package graphics Info: Driver file: pdftex.def on input line 91. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def | |||||
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX | |||||
\Gread@gobject=\count109 | |||||
)) | |||||
\Gin@req@height=\dimen116 | |||||
\Gin@req@width=\dimen117 | |||||
) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty | |||||
Package: color 2014/04/23 v1.1a Standard LaTeX Color (DPC) | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg | |||||
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive | |||||
) | |||||
Package color Info: Driver file: pdftex.def on input line 137. | |||||
) | |||||
(./macrosblog.tex (/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty | |||||
\UL@box=\box28 | |||||
\UL@hyphenbox=\box29 | |||||
\UL@skip=\skip47 | |||||
\UL@hook=\toks20 | |||||
\UL@height=\dimen118 | |||||
\UL@pe=\count110 | |||||
\UL@pixel=\dimen119 | |||||
\ULC@box=\box30 | |||||
Package: ulem 2012/05/18 | |||||
\ULdepth=\dimen120 | |||||
) | |||||
\c@exercise=\count111 | |||||
\c@theorem=\count112 | |||||
\c@example=\count113 | |||||
) | |||||
No file example.aux. | |||||
\openout1 = `example.aux'. | |||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 20. | |||||
LaTeX Font Info: ... okay on input line 20. | |||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 20. | |||||
LaTeX Font Info: ... okay on input line 20. | |||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 20. | |||||
LaTeX Font Info: ... okay on input line 20. | |||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 20. | |||||
LaTeX Font Info: ... okay on input line 20. | |||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 20. | |||||
LaTeX Font Info: ... okay on input line 20. | |||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 20. | |||||
LaTeX Font Info: ... okay on input line 20. | |||||
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 20. | |||||
LaTeX Font Info: ... okay on input line 20. | |||||
\AtBeginShipoutBox=\box31 | |||||
Package hyperref Info: Link coloring ON on input line 20. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty | |||||
Package: nameref 2012/10/27 v2.43 Cross-referencing by name of section | |||||
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty | |||||
Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO) | |||||
) | |||||
\c@section@level=\count114 | |||||
) | |||||
LaTeX Info: Redefining \ref on input line 20. | |||||
LaTeX Info: Redefining \pageref on input line 20. | |||||
LaTeX Info: Redefining \nameref on input line 20. | |||||
\@outlinefile=\write3 | |||||
\openout3 = `example.out'. | |||||
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii | |||||
[Loading MPS to PDF converter (version 2006.09.02).] | |||||
\scratchcounter=\count115 | |||||
\scratchdimen=\dimen121 | |||||
\scratchbox=\box32 | |||||
\nofMPsegments=\count116 | |||||
\nofMParguments=\count117 | |||||
\everyMPshowfont=\toks21 | |||||
\MPscratchCnt=\count118 | |||||
\MPscratchDim=\dimen122 | |||||
\MPnumerator=\count119 | |||||
\makeMPintoPDFobject=\count120 | |||||
\everyMPtoPDFconversion=\toks22 | |||||
) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty | |||||
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf | |||||
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty | |||||
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) | |||||
) | |||||
Package grfext Info: Graphics extension search list: | |||||
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE | |||||
G,.JBIG2,.JB2,.eps] | |||||
(grfext) \AppendGraphicsExtensions on input line 452. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg | |||||
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv | |||||
e | |||||
)) | |||||
LaTeX Font Info: Try loading font information for U+msa on input line 46. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd | |||||
File: umsa.fd 2013/01/14 v3.01 AMS symbols A | |||||
) | |||||
LaTeX Font Info: Try loading font information for U+msb on input line 46. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd | |||||
File: umsb.fd 2013/01/14 v3.01 AMS symbols B | |||||
) | |||||
LaTeX Warning: Reference `th:ad' on page 1 undefined on input line 60. | |||||
LaTeX Warning: Reference `lm:main' on page 1 undefined on input line 63. | |||||
[1 | |||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] | |||||
LaTeX Warning: Reference `eq:test' on page 2 undefined on input line 89. | |||||
LaTeX Warning: Reference `eq:lemma' on page 2 undefined on input line 90. | |||||
LaTeX Warning: Reference `lm:main' on page 2 undefined on input line 91. | |||||
LaTeX Font Info: Try loading font information for OMS+cmr on input line 115. | |||||
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd | |||||
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions | |||||
) | |||||
LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <12> not available | |||||
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 115. | |||||
[2] | |||||
<knuth.png, id=34, 77.088pt x 40.83255pt> | |||||
File: knuth.png Graphic file (type png) | |||||
<use knuth.png> | |||||
Package pdftex.def Info: knuth.png used on input line 148. | |||||
(pdftex.def) Requested size: 400.0pt x 211.94415pt. | |||||
LaTeX Warning: Reference `sec' on page 3 undefined on input line 160. | |||||
[3 <./knuth.png (PNG copy)>] | |||||
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 207. | |||||
[4] | |||||
Package atveryend Info: Empty hook `AfterLastShipout' on input line 207. | |||||
(./example.aux) | |||||
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 207. | |||||
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 207. | |||||
Package rerunfilecheck Warning: File `example.out' has changed. | |||||
(rerunfilecheck) Rerun to get outlines right | |||||
(rerunfilecheck) or use package `bookmark'. | |||||
Package rerunfilecheck Info: Checksums for `example.out': | |||||
(rerunfilecheck) Before: <no file> | |||||
(rerunfilecheck) After: 46842903BC89B1855615130CB6B6790A;162. | |||||
LaTeX Warning: There were undefined references. | |||||
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. | |||||
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 207. | |||||
) | |||||
Here is how much of TeX's memory you used: | |||||
6093 strings out of 495020 | |||||
88188 string characters out of 6181323 | |||||
169561 words of memory out of 5000000 | |||||
9237 multiletter control sequences out of 15000+600000 | |||||
10557 words of font info for 40 fonts, out of 8000000 for 9000 | |||||
14 hyphenation exceptions out of 8191 | |||||
32i,7n,28p,356b,329s stack positions out of 5000i,500n,10000p,200000b,80000s | |||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></us | |||||
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmcsc10.pfb></usr/sha | |||||
re/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb></usr/share/tex | |||||
live/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi12.pfb></usr/share/texlive/t | |||||
exmf-dist/fonts/type1/public/amsfonts/cm/cmmi8.pfb></usr/share/texlive/texmf-di | |||||
st/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/share/texlive/texmf-dist/font | |||||
s/type1/public/amsfonts/cm/cmr6.pfb></usr/share/texlive/texmf-dist/fonts/type1/ | |||||
public/amsfonts/cm/cmr8.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/a | |||||
msfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfont | |||||
s/cm/cmsy8.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm | |||||
ti12.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/symbols/msa | |||||
m10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/symbols/msbm | |||||
10.pfb> | |||||
Output written on example.pdf (4 pages, 168562 bytes). | |||||
PDF statistics: | |||||
95 PDF objects out of 1000 (max. 8388607) | |||||
74 compressed objects within 1 object stream | |||||
16 named destinations out of 1000 (max. 500000) | |||||
6 words of extra memory for PDF output out of 10000 (max. 10000000) | |||||
@ -0,0 +1,3 @@ | |||||
\BOOKMARK [1][-]{section.1}{A section}{}% 1 | |||||
\BOOKMARK [2][-]{subsection.1.1}{And a subsection}{section.1}% 2 | |||||
\BOOKMARK [1][-]{section.2}{Changing the style}{}% 3 |
@ -0,0 +1,207 @@ | |||||
\documentclass[12pt]{article} | |||||
\usepackage[pdftex,pagebackref,letterpaper=true,colorlinks=true,pdfpagemode=none,urlcolor=blue,linkcolor=blue,citecolor=blue,pdfstartview=FitH]{hyperref} | |||||
\usepackage{amsmath,amsfonts} | |||||
\usepackage{graphicx} | |||||
\usepackage{color} | |||||
\setlength{\oddsidemargin}{0pt} | |||||
\setlength{\evensidemargin}{0pt} | |||||
\setlength{\textwidth}{6.0in} | |||||
\setlength{\topmargin}{0in} | |||||
\setlength{\textheight}{8.5in} | |||||
\setlength{\parindent}{0in} | |||||
\setlength{\parskip}{5px} | |||||
\input{macrosblog} | |||||
\begin{document} | |||||
Look at the document source to see how to \sout{strike out} text, how | |||||
to \begin{red}use\end{red} \begin{green}different\end{green} \begin{blue}colors\end{blue}, | |||||
and how to \href{http://www.google.com}{link to URLs with snapshot preview} | |||||
and how to \hrefnosnap{http://www.google.com}{link to URLs without snapshot preview}. | |||||
There is a command which is ignored by pdflatex and which | |||||
defines where to cut the post in the version displayed on the | |||||
main page\more | |||||
Anything between the conditional declarations {\em ifblog . . . fi} | |||||
is ignored by LaTeX and processed by latex2wp. Anything | |||||
between {\em iftex . . . fi} is processed by LaTex and ignored | |||||
by latex2wp. | |||||
\ifblog \begin{green}This green sentence appears only in WordPress \end{green} \fi | |||||
\iftex \begin{red}This red sentence appears only in the LaTeX preview \end{red} \fi | |||||
This is useful if one, in desperation, wants to put pure HTML commands | |||||
in the {\em ifblog . . . fi} scope. | |||||
\begin{lemma}[Main] \label{lm:main} | |||||
Let $\cal F$ be a total ramification of a compactifier, then | |||||
\begin{equation} \label{eq:lemma} \forall g \in {\cal F}. g^2 = \eta \end{equation} | |||||
\end{lemma} | |||||
The (modifiable) numbering scheme is that lemmas, theorems, | |||||
propositions, remarks and corollaries share the same counters, | |||||
while exercises and examples have each their own counter. | |||||
\begin{theorem} \label{th:ad} The ad\`ele of a number field is never | |||||
hyperbolically transfinite. | |||||
\end{theorem} | |||||
\begin{proof} Left as an exercise. \end{proof} | |||||
\begin{exercise} Find a counterexample to Theorem \ref{th:ad}. | |||||
\end{exercise} | |||||
\begin{exercise}[Advanced] Prove Lemma \ref{lm:main}. \end{exercise} | |||||
Note that accented characters are allowed. Unfortunately, | |||||
Erd\H os's name cannot be properly typeset in HTML. | |||||
(Note that to get the above approximation, you need to type | |||||
backslash-H-space-o, rather than backslash-H-{o}. Both are | |||||
good in LaTeX, but only the second is recognized by LaTeX2WP.) | |||||
One can correctly type the names of H\aa stad, Szemer\'edi, | |||||
\v{C}ech, and so on. | |||||
It is possible to have numbered equations | |||||
\begin{equation} \label{eq:test} \frac 1 {x^2} \ge 0 \end{equation} | |||||
and unnumbered equations | |||||
$$ t(x) - \frac 12 > x^{\frac 13} $$ | |||||
Unnumbered equations can be created with the double-dollar sign | |||||
command or with the backslash-square bracket command. | |||||
\[ f(x) = \int_{-\infty}^{x} \frac 1 {t^2} dt \] | |||||
It is possible to refer to equations and | |||||
theorems via the {\em ref}, {\em eqref} and {\em label} LaTeX | |||||
commands, for example to Equation (\ref{eq:test}), | |||||
to Equation \eqref{eq:lemma}, | |||||
and to Lemma \ref{lm:main} above. | |||||
eqnarray* is supported, but not eqnarray: | |||||
\begin{eqnarray*} | |||||
f(x) & < & x^2 - y^2\\ | |||||
& = & (x+y) \cdot (x-y) | |||||
\end{eqnarray*} | |||||
{\em You {\bf can} nest a {\bf bold} text inside an emphasized | |||||
text or viceversa.} | |||||
The theorem-like environments {\em theorem}, {\em lemma}, | |||||
{\em proposition}, {\em remark}, {\em corollary}, {\em example} | |||||
and {\em exercise} are defined, as is the {\em proof} environment. | |||||
The LaTex commands to type \$, \%, and \&\ are supported outside | |||||
math mode, and \%\ and \&\ are supported in math mode as well: | |||||
\[ 30 \& 10 \% \] | |||||
The section symbol \S\ is also supported. | |||||
WordPress has trouble if a LaTeX expression containing a $<$ | |||||
symbol, such as $x^2 < x^2 + 1$ is followed by an expression | |||||
containing a $>$ symbol, such as $(x+y)^2 > (x+y)^2 - 3$. This | |||||
is fixed by converting the inequality symbols into ``HTML | |||||
character codes.'' Always write the symbols $<$ and $>$ in | |||||
math mode. | |||||
It it is possible to have tabular environments, both with borders | |||||
(the border will not be displayed in the LaTeX preview), as in | |||||
\begin{btabular}{lr} | |||||
blog & quality\\ | |||||
what's new & excellent\\ | |||||
in theory & poor | |||||
\end{btabular} | |||||
and without borders as in | |||||
\begin{tabular}{ccc} | |||||
$a$ & $\rightarrow$ & $b$\\ | |||||
$\downarrow$ & & $\uparrow$\\ | |||||
$c$ & $\rightarrow$ & $d$ | |||||
\end{tabular} | |||||
(The tabular environments will be centered in WordPress, but | |||||
not in the LaTeX preview.) | |||||
And it is possible to include a picture so that the pdf file produced | |||||
with pdflatex imports it from a local image file (which has to be | |||||
pdf, gif, jpeg, or png) and the WordPress post imports it from a URL. | |||||
\image{width = 400}{http://imgs.xkcd.com/comics/donald_knuth.png}{knuth.png} | |||||
The {\em image} command used to generate the above image | |||||
has three parameter: a size parameter for either the width or the height, | |||||
expressed in pixels (if different from the original resolution, the picture | |||||
will be scaled), a URL for the location of the image (this will be used | |||||
by WordPress) and a local file name (which will used by pdflatex). | |||||
It is possible to have numbered and unnumbered sections and subsections. | |||||
References to {\em label} commands which are not in the scope of | |||||
a numbered equation or a numbered theorem-like environment | |||||
will refer to the section number, | |||||
such as a reference to Section \ref{sec} below. | |||||
HTML does not have good support for itemized list with | |||||
descriptors (what one gets in LaTeX using the {\em itemize} environment | |||||
with optional parameters in square brackets after the {\em item} commands). | |||||
We can only offer the following rather ugly rendering: | |||||
\begin{itemize} | |||||
\item [Case a.] Description of case a | |||||
\item [Case b.] Description of case b | |||||
\end{itemize} | |||||
\section*{Examples of Sections} | |||||
\subsection*{And Subsections} | |||||
\section{A section} | |||||
\label{sec} | |||||
\subsection{And a subsection} | |||||
\section{Changing the style} | |||||
The file latex2wpstyle.py contains several definitions that determine | |||||
the appearance of the WordPress translation. It should be self-explanatory | |||||
to change the way sections, subsections, proofs and theorem-like | |||||
environments are typeset, and to change the numbering scheme | |||||
for theorem-like environments. | |||||
The variable $M$ in latex2wpstyle.py contains a list of pairs of strings. | |||||
For every pair, every occurrence of the first string in the document is | |||||
replaced by an occurrence of the second before proceeding to the | |||||
conversion from LaTeX to WordPress. If you want to use simple macros | |||||
(which do not involve parameter-passing) then edit $M$ to add support | |||||
for your own LaTeX macros. (You will have to define the macros in | |||||
macrosblog.tex as well, otherwise you will not be able to compile | |||||
your LaTeX file and preview it.) | |||||
Some macros are already defined. For example, backslash-E produces | |||||
an expectation symbol: | |||||
\[ \E_{x \in X} f(x) := \sum_{x\in X} \P [x] \cdot f(x) \] | |||||
Some more macros (see the LaTeX source) | |||||
\[ \B, \R , \C, \Z, \N , \Q, \eps \] | |||||
\end{document} |
@ -0,0 +1,674 @@ | |||||
GNU GENERAL PUBLIC LICENSE | |||||
Version 3, 29 June 2007 | |||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |||||
Everyone is permitted to copy and distribute verbatim copies | |||||
of this license document, but changing it is not allowed. | |||||
Preamble | |||||
The GNU General Public License is a free, copyleft license for | |||||
software and other kinds of works. | |||||
The licenses for most software and other practical works are designed | |||||
to take away your freedom to share and change the works. By contrast, | |||||
the GNU General Public License is intended to guarantee your freedom to | |||||
share and change all versions of a program--to make sure it remains free | |||||
software for all its users. We, the Free Software Foundation, use the | |||||
GNU General Public License for most of our software; it applies also to | |||||
any other work released this way by its authors. You can apply it to | |||||
your programs, too. | |||||
When we speak of free software, we are referring to freedom, not | |||||
price. Our General Public Licenses are designed to make sure that you | |||||
have the freedom to distribute copies of free software (and charge for | |||||
them if you wish), that you receive source code or can get it if you | |||||
want it, that you can change the software or use pieces of it in new | |||||
free programs, and that you know you can do these things. | |||||
To protect your rights, we need to prevent others from denying you | |||||
these rights or asking you to surrender the rights. Therefore, you have | |||||
certain responsibilities if you distribute copies of the software, or if | |||||
you modify it: responsibilities to respect the freedom of others. | |||||
For example, if you distribute copies of such a program, whether | |||||
gratis or for a fee, you must pass on to the recipients the same | |||||
freedoms that you received. You must make sure that they, too, receive | |||||
or can get the source code. And you must show them these terms so they | |||||
know their rights. | |||||
Developers that use the GNU GPL protect your rights with two steps: | |||||
(1) assert copyright on the software, and (2) offer you this License | |||||
giving you legal permission to copy, distribute and/or modify it. | |||||
For the developers' and authors' protection, the GPL clearly explains | |||||
that there is no warranty for this free software. For both users' and | |||||
authors' sake, the GPL requires that modified versions be marked as | |||||
changed, so that their problems will not be attributed erroneously to | |||||
authors of previous versions. | |||||
Some devices are designed to deny users access to install or run | |||||
modified versions of the software inside them, although the manufacturer | |||||
can do so. This is fundamentally incompatible with the aim of | |||||
protecting users' freedom to change the software. The systematic | |||||
pattern of such abuse occurs in the area of products for individuals to | |||||
use, which is precisely where it is most unacceptable. Therefore, we | |||||
have designed this version of the GPL to prohibit the practice for those | |||||
products. If such problems arise substantially in other domains, we | |||||
stand ready to extend this provision to those domains in future versions | |||||
of the GPL, as needed to protect the freedom of users. | |||||
Finally, every program is threatened constantly by software patents. | |||||
States should not allow patents to restrict development and use of | |||||
software on general-purpose computers, but in those that do, we wish to | |||||
avoid the special danger that patents applied to a free program could | |||||
make it effectively proprietary. To prevent this, the GPL assures that | |||||
patents cannot be used to render the program non-free. | |||||
The precise terms and conditions for copying, distribution and | |||||
modification follow. | |||||
TERMS AND CONDITIONS | |||||
0. Definitions. | |||||
"This License" refers to version 3 of the GNU General Public License. | |||||
"Copyright" also means copyright-like laws that apply to other kinds of | |||||
works, such as semiconductor masks. | |||||
"The Program" refers to any copyrightable work licensed under this | |||||
License. Each licensee is addressed as "you". "Licensees" and | |||||
"recipients" may be individuals or organizations. | |||||
To "modify" a work means to copy from or adapt all or part of the work | |||||
in a fashion requiring copyright permission, other than the making of an | |||||
exact copy. The resulting work is called a "modified version" of the | |||||
earlier work or a work "based on" the earlier work. | |||||
A "covered work" means either the unmodified Program or a work based | |||||
on the Program. | |||||
To "propagate" a work means to do anything with it that, without | |||||
permission, would make you directly or secondarily liable for | |||||
infringement under applicable copyright law, except executing it on a | |||||
computer or modifying a private copy. Propagation includes copying, | |||||
distribution (with or without modification), making available to the | |||||
public, and in some countries other activities as well. | |||||
To "convey" a work means any kind of propagation that enables other | |||||
parties to make or receive copies. Mere interaction with a user through | |||||
a computer network, with no transfer of a copy, is not conveying. | |||||
An interactive user interface displays "Appropriate Legal Notices" | |||||
to the extent that it includes a convenient and prominently visible | |||||
feature that (1) displays an appropriate copyright notice, and (2) | |||||
tells the user that there is no warranty for the work (except to the | |||||
extent that warranties are provided), that licensees may convey the | |||||
work under this License, and how to view a copy of this License. If | |||||
the interface presents a list of user commands or options, such as a | |||||
menu, a prominent item in the list meets this criterion. | |||||
1. Source Code. | |||||
The "source code" for a work means the preferred form of the work | |||||
for making modifications to it. "Object code" means any non-source | |||||
form of a work. | |||||
A "Standard Interface" means an interface that either is an official | |||||
standard defined by a recognized standards body, or, in the case of | |||||
interfaces specified for a particular programming language, one that | |||||
is widely used among developers working in that language. | |||||
The "System Libraries" of an executable work include anything, other | |||||
than the work as a whole, that (a) is included in the normal form of | |||||
packaging a Major Component, but which is not part of that Major | |||||
Component, and (b) serves only to enable use of the work with that | |||||
Major Component, or to implement a Standard Interface for which an | |||||
implementation is available to the public in source code form. A | |||||
"Major Component", in this context, means a major essential component | |||||
(kernel, window system, and so on) of the specific operating system | |||||
(if any) on which the executable work runs, or a compiler used to | |||||
produce the work, or an object code interpreter used to run it. | |||||
The "Corresponding Source" for a work in object code form means all | |||||
the source code needed to generate, install, and (for an executable | |||||
work) run the object code and to modify the work, including scripts to | |||||
control those activities. However, it does not include the work's | |||||
System Libraries, or general-purpose tools or generally available free | |||||
programs which are used unmodified in performing those activities but | |||||
which are not part of the work. For example, Corresponding Source | |||||
includes interface definition files associated with source files for | |||||
the work, and the source code for shared libraries and dynamically | |||||
linked subprograms that the work is specifically designed to require, | |||||
such as by intimate data communication or control flow between those | |||||
subprograms and other parts of the work. | |||||
The Corresponding Source need not include anything that users | |||||
can regenerate automatically from other parts of the Corresponding | |||||
Source. | |||||
The Corresponding Source for a work in source code form is that | |||||
same work. | |||||
2. Basic Permissions. | |||||
All rights granted under this License are granted for the term of | |||||
copyright on the Program, and are irrevocable provided the stated | |||||
conditions are met. This License explicitly affirms your unlimited | |||||
permission to run the unmodified Program. The output from running a | |||||
covered work is covered by this License only if the output, given its | |||||
content, constitutes a covered work. This License acknowledges your | |||||
rights of fair use or other equivalent, as provided by copyright law. | |||||
You may make, run and propagate covered works that you do not | |||||
convey, without conditions so long as your license otherwise remains | |||||
in force. You may convey covered works to others for the sole purpose | |||||
of having them make modifications exclusively for you, or provide you | |||||
with facilities for running those works, provided that you comply with | |||||
the terms of this License in conveying all material for which you do | |||||
not control copyright. Those thus making or running the covered works | |||||
for you must do so exclusively on your behalf, under your direction | |||||
and control, on terms that prohibit them from making any copies of | |||||
your copyrighted material outside their relationship with you. | |||||
Conveying under any other circumstances is permitted solely under | |||||
the conditions stated below. Sublicensing is not allowed; section 10 | |||||
makes it unnecessary. | |||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law. | |||||
No covered work shall be deemed part of an effective technological | |||||
measure under any applicable law fulfilling obligations under article | |||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or | |||||
similar laws prohibiting or restricting circumvention of such | |||||
measures. | |||||
When you convey a covered work, you waive any legal power to forbid | |||||
circumvention of technological measures to the extent such circumvention | |||||
is effected by exercising rights under this License with respect to | |||||
the covered work, and you disclaim any intention to limit operation or | |||||
modification of the work as a means of enforcing, against the work's | |||||
users, your or third parties' legal rights to forbid circumvention of | |||||
technological measures. | |||||
4. Conveying Verbatim Copies. | |||||
You may convey verbatim copies of the Program's source code as you | |||||
receive it, in any medium, provided that you conspicuously and | |||||
appropriately publish on each copy an appropriate copyright notice; | |||||
keep intact all notices stating that this License and any | |||||
non-permissive terms added in accord with section 7 apply to the code; | |||||
keep intact all notices of the absence of any warranty; and give all | |||||
recipients a copy of this License along with the Program. | |||||
You may charge any price or no price for each copy that you convey, | |||||
and you may offer support or warranty protection for a fee. | |||||
5. Conveying Modified Source Versions. | |||||
You may convey a work based on the Program, or the modifications to | |||||
produce it from the Program, in the form of source code under the | |||||
terms of section 4, provided that you also meet all of these conditions: | |||||
a) The work must carry prominent notices stating that you modified | |||||
it, and giving a relevant date. | |||||
b) The work must carry prominent notices stating that it is | |||||
released under this License and any conditions added under section | |||||
7. This requirement modifies the requirement in section 4 to | |||||
"keep intact all notices". | |||||
c) You must license the entire work, as a whole, under this | |||||
License to anyone who comes into possession of a copy. This | |||||
License will therefore apply, along with any applicable section 7 | |||||
additional terms, to the whole of the work, and all its parts, | |||||
regardless of how they are packaged. This License gives no | |||||
permission to license the work in any other way, but it does not | |||||
invalidate such permission if you have separately received it. | |||||
d) If the work has interactive user interfaces, each must display | |||||
Appropriate Legal Notices; however, if the Program has interactive | |||||
interfaces that do not display Appropriate Legal Notices, your | |||||
work need not make them do so. | |||||
A compilation of a covered work with other separate and independent | |||||
works, which are not by their nature extensions of the covered work, | |||||
and which are not combined with it such as to form a larger program, | |||||
in or on a volume of a storage or distribution medium, is called an | |||||
"aggregate" if the compilation and its resulting copyright are not | |||||
used to limit the access or legal rights of the compilation's users | |||||
beyond what the individual works permit. Inclusion of a covered work | |||||
in an aggregate does not cause this License to apply to the other | |||||
parts of the aggregate. | |||||
6. Conveying Non-Source Forms. | |||||
You may convey a covered work in object code form under the terms | |||||
of sections 4 and 5, provided that you also convey the | |||||
machine-readable Corresponding Source under the terms of this License, | |||||
in one of these ways: | |||||
a) Convey the object code in, or embodied in, a physical product | |||||
(including a physical distribution medium), accompanied by the | |||||
Corresponding Source fixed on a durable physical medium | |||||
customarily used for software interchange. | |||||
b) Convey the object code in, or embodied in, a physical product | |||||
(including a physical distribution medium), accompanied by a | |||||
written offer, valid for at least three years and valid for as | |||||
long as you offer spare parts or customer support for that product | |||||
model, to give anyone who possesses the object code either (1) a | |||||
copy of the Corresponding Source for all the software in the | |||||
product that is covered by this License, on a durable physical | |||||
medium customarily used for software interchange, for a price no | |||||
more than your reasonable cost of physically performing this | |||||
conveying of source, or (2) access to copy the | |||||
Corresponding Source from a network server at no charge. | |||||
c) Convey individual copies of the object code with a copy of the | |||||
written offer to provide the Corresponding Source. This | |||||
alternative is allowed only occasionally and noncommercially, and | |||||
only if you received the object code with such an offer, in accord | |||||
with subsection 6b. | |||||
d) Convey the object code by offering access from a designated | |||||
place (gratis or for a charge), and offer equivalent access to the | |||||
Corresponding Source in the same way through the same place at no | |||||
further charge. You need not require recipients to copy the | |||||
Corresponding Source along with the object code. If the place to | |||||
copy the object code is a network server, the Corresponding Source | |||||
may be on a different server (operated by you or a third party) | |||||
that supports equivalent copying facilities, provided you maintain | |||||
clear directions next to the object code saying where to find the | |||||
Corresponding Source. Regardless of what server hosts the | |||||
Corresponding Source, you remain obligated to ensure that it is | |||||
available for as long as needed to satisfy these requirements. | |||||
e) Convey the object code using peer-to-peer transmission, provided | |||||
you inform other peers where the object code and Corresponding | |||||
Source of the work are being offered to the general public at no | |||||
charge under subsection 6d. | |||||
A separable portion of the object code, whose source code is excluded | |||||
from the Corresponding Source as a System Library, need not be | |||||
included in conveying the object code work. | |||||
A "User Product" is either (1) a "consumer product", which means any | |||||
tangible personal property which is normally used for personal, family, | |||||
or household purposes, or (2) anything designed or sold for incorporation | |||||
into a dwelling. In determining whether a product is a consumer product, | |||||
doubtful cases shall be resolved in favor of coverage. For a particular | |||||
product received by a particular user, "normally used" refers to a | |||||
typical or common use of that class of product, regardless of the status | |||||
of the particular user or of the way in which the particular user | |||||
actually uses, or expects or is expected to use, the product. A product | |||||
is a consumer product regardless of whether the product has substantial | |||||
commercial, industrial or non-consumer uses, unless such uses represent | |||||
the only significant mode of use of the product. | |||||
"Installation Information" for a User Product means any methods, | |||||
procedures, authorization keys, or other information required to install | |||||
and execute modified versions of a covered work in that User Product from | |||||
a modified version of its Corresponding Source. The information must | |||||
suffice to ensure that the continued functioning of the modified object | |||||
code is in no case prevented or interfered with solely because | |||||
modification has been made. | |||||
If you convey an object code work under this section in, or with, or | |||||
specifically for use in, a User Product, and the conveying occurs as | |||||
part of a transaction in which the right of possession and use of the | |||||
User Product is transferred to the recipient in perpetuity or for a | |||||
fixed term (regardless of how the transaction is characterized), the | |||||
Corresponding Source conveyed under this section must be accompanied | |||||
by the Installation Information. But this requirement does not apply | |||||
if neither you nor any third party retains the ability to install | |||||
modified object code on the User Product (for example, the work has | |||||
been installed in ROM). | |||||
The requirement to provide Installation Information does not include a | |||||
requirement to continue to provide support service, warranty, or updates | |||||
for a work that has been modified or installed by the recipient, or for | |||||
the User Product in which it has been modified or installed. Access to a | |||||
network may be denied when the modification itself materially and | |||||
adversely affects the operation of the network or violates the rules and | |||||
protocols for communication across the network. | |||||
Corresponding Source conveyed, and Installation Information provided, | |||||
in accord with this section must be in a format that is publicly | |||||
documented (and with an implementation available to the public in | |||||
source code form), and must require no special password or key for | |||||
unpacking, reading or copying. | |||||
7. Additional Terms. | |||||
"Additional permissions" are terms that supplement the terms of this | |||||
License by making exceptions from one or more of its conditions. | |||||
Additional permissions that are applicable to the entire Program shall | |||||
be treated as though they were included in this License, to the extent | |||||
that they are valid under applicable law. If additional permissions | |||||
apply only to part of the Program, that part may be used separately | |||||
under those permissions, but the entire Program remains governed by | |||||
this License without regard to the additional permissions. | |||||
When you convey a copy of a covered work, you may at your option | |||||
remove any additional permissions from that copy, or from any part of | |||||
it. (Additional permissions may be written to require their own | |||||
removal in certain cases when you modify the work.) You may place | |||||
additional permissions on material, added by you to a covered work, | |||||
for which you have or can give appropriate copyright permission. | |||||
Notwithstanding any other provision of this License, for material you | |||||
add to a covered work, you may (if authorized by the copyright holders of | |||||
that material) supplement the terms of this License with terms: | |||||
a) Disclaiming warranty or limiting liability differently from the | |||||
terms of sections 15 and 16 of this License; or | |||||
b) Requiring preservation of specified reasonable legal notices or | |||||
author attributions in that material or in the Appropriate Legal | |||||
Notices displayed by works containing it; or | |||||
c) Prohibiting misrepresentation of the origin of that material, or | |||||
requiring that modified versions of such material be marked in | |||||
reasonable ways as different from the original version; or | |||||
d) Limiting the use for publicity purposes of names of licensors or | |||||
authors of the material; or | |||||
e) Declining to grant rights under trademark law for use of some | |||||
trade names, trademarks, or service marks; or | |||||
f) Requiring indemnification of licensors and authors of that | |||||
material by anyone who conveys the material (or modified versions of | |||||
it) with contractual assumptions of liability to the recipient, for | |||||
any liability that these contractual assumptions directly impose on | |||||
those licensors and authors. | |||||
All other non-permissive additional terms are considered "further | |||||
restrictions" within the meaning of section 10. If the Program as you | |||||
received it, or any part of it, contains a notice stating that it is | |||||
governed by this License along with a term that is a further | |||||
restriction, you may remove that term. If a license document contains | |||||
a further restriction but permits relicensing or conveying under this | |||||
License, you may add to a covered work material governed by the terms | |||||
of that license document, provided that the further restriction does | |||||
not survive such relicensing or conveying. | |||||
If you add terms to a covered work in accord with this section, you | |||||
must place, in the relevant source files, a statement of the | |||||
additional terms that apply to those files, or a notice indicating | |||||
where to find the applicable terms. | |||||
Additional terms, permissive or non-permissive, may be stated in the | |||||
form of a separately written license, or stated as exceptions; | |||||
the above requirements apply either way. | |||||
8. Termination. | |||||
You may not propagate or modify a covered work except as expressly | |||||
provided under this License. Any attempt otherwise to propagate or | |||||
modify it is void, and will automatically terminate your rights under | |||||
this License (including any patent licenses granted under the third | |||||
paragraph of section 11). | |||||
However, if you cease all violation of this License, then your | |||||
license from a particular copyright holder is reinstated (a) | |||||
provisionally, unless and until the copyright holder explicitly and | |||||
finally terminates your license, and (b) permanently, if the copyright | |||||
holder fails to notify you of the violation by some reasonable means | |||||
prior to 60 days after the cessation. | |||||
Moreover, your license from a particular copyright holder is | |||||
reinstated permanently if the copyright holder notifies you of the | |||||
violation by some reasonable means, this is the first time you have | |||||
received notice of violation of this License (for any work) from that | |||||
copyright holder, and you cure the violation prior to 30 days after | |||||
your receipt of the notice. | |||||
Termination of your rights under this section does not terminate the | |||||
licenses of parties who have received copies or rights from you under | |||||
this License. If your rights have been terminated and not permanently | |||||
reinstated, you do not qualify to receive new licenses for the same | |||||
material under section 10. | |||||
9. Acceptance Not Required for Having Copies. | |||||
You are not required to accept this License in order to receive or | |||||
run a copy of the Program. Ancillary propagation of a covered work | |||||
occurring solely as a consequence of using peer-to-peer transmission | |||||
to receive a copy likewise does not require acceptance. However, | |||||
nothing other than this License grants you permission to propagate or | |||||
modify any covered work. These actions infringe copyright if you do | |||||
not accept this License. Therefore, by modifying or propagating a | |||||
covered work, you indicate your acceptance of this License to do so. | |||||
10. Automatic Licensing of Downstream Recipients. | |||||
Each time you convey a covered work, the recipient automatically | |||||
receives a license from the original licensors, to run, modify and | |||||
propagate that work, subject to this License. You are not responsible | |||||
for enforcing compliance by third parties with this License. | |||||
An "entity transaction" is a transaction transferring control of an | |||||
organization, or substantially all assets of one, or subdividing an | |||||
organization, or merging organizations. If propagation of a covered | |||||
work results from an entity transaction, each party to that | |||||
transaction who receives a copy of the work also receives whatever | |||||
licenses to the work the party's predecessor in interest had or could | |||||
give under the previous paragraph, plus a right to possession of the | |||||
Corresponding Source of the work from the predecessor in interest, if | |||||
the predecessor has it or can get it with reasonable efforts. | |||||
You may not impose any further restrictions on the exercise of the | |||||
rights granted or affirmed under this License. For example, you may | |||||
not impose a license fee, royalty, or other charge for exercise of | |||||
rights granted under this License, and you may not initiate litigation | |||||
(including a cross-claim or counterclaim in a lawsuit) alleging that | |||||
any patent claim is infringed by making, using, selling, offering for | |||||
sale, or importing the Program or any portion of it. | |||||
11. Patents. | |||||
A "contributor" is a copyright holder who authorizes use under this | |||||
License of the Program or a work on which the Program is based. The | |||||
work thus licensed is called the contributor's "contributor version". | |||||
A contributor's "essential patent claims" are all patent claims | |||||
owned or controlled by the contributor, whether already acquired or | |||||
hereafter acquired, that would be infringed by some manner, permitted | |||||
by this License, of making, using, or selling its contributor version, | |||||
but do not include claims that would be infringed only as a | |||||
consequence of further modification of the contributor version. For | |||||
purposes of this definition, "control" includes the right to grant | |||||
patent sublicenses in a manner consistent with the requirements of | |||||
this License. | |||||
Each contributor grants you a non-exclusive, worldwide, royalty-free | |||||
patent license under the contributor's essential patent claims, to | |||||
make, use, sell, offer for sale, import and otherwise run, modify and | |||||
propagate the contents of its contributor version. | |||||
In the following three paragraphs, a "patent license" is any express | |||||
agreement or commitment, however denominated, not to enforce a patent | |||||
(such as an express permission to practice a patent or covenant not to | |||||
sue for patent infringement). To "grant" such a patent license to a | |||||
party means to make such an agreement or commitment not to enforce a | |||||
patent against the party. | |||||
If you convey a covered work, knowingly relying on a patent license, | |||||
and the Corresponding Source of the work is not available for anyone | |||||
to copy, free of charge and under the terms of this License, through a | |||||
publicly available network server or other readily accessible means, | |||||
then you must either (1) cause the Corresponding Source to be so | |||||
available, or (2) arrange to deprive yourself of the benefit of the | |||||
patent license for this particular work, or (3) arrange, in a manner | |||||
consistent with the requirements of this License, to extend the patent | |||||
license to downstream recipients. "Knowingly relying" means you have | |||||
actual knowledge that, but for the patent license, your conveying the | |||||
covered work in a country, or your recipient's use of the covered work | |||||
in a country, would infringe one or more identifiable patents in that | |||||
country that you have reason to believe are valid. | |||||
If, pursuant to or in connection with a single transaction or | |||||
arrangement, you convey, or propagate by procuring conveyance of, a | |||||
covered work, and grant a patent license to some of the parties | |||||
receiving the covered work authorizing them to use, propagate, modify | |||||
or convey a specific copy of the covered work, then the patent license | |||||
you grant is automatically extended to all recipients of the covered | |||||
work and works based on it. | |||||
A patent license is "discriminatory" if it does not include within | |||||
the scope of its coverage, prohibits the exercise of, or is | |||||
conditioned on the non-exercise of one or more of the rights that are | |||||
specifically granted under this License. You may not convey a covered | |||||
work if you are a party to an arrangement with a third party that is | |||||
in the business of distributing software, under which you make payment | |||||
to the third party based on the extent of your activity of conveying | |||||
the work, and under which the third party grants, to any of the | |||||
parties who would receive the covered work from you, a discriminatory | |||||
patent license (a) in connection with copies of the covered work | |||||
conveyed by you (or copies made from those copies), or (b) primarily | |||||
for and in connection with specific products or compilations that | |||||
contain the covered work, unless you entered into that arrangement, | |||||
or that patent license was granted, prior to 28 March 2007. | |||||
Nothing in this License shall be construed as excluding or limiting | |||||
any implied license or other defenses to infringement that may | |||||
otherwise be available to you under applicable patent law. | |||||
12. No Surrender of Others' Freedom. | |||||
If conditions are imposed on you (whether by court order, agreement or | |||||
otherwise) that contradict the conditions of this License, they do not | |||||
excuse you from the conditions of this License. If you cannot convey a | |||||
covered work so as to satisfy simultaneously your obligations under this | |||||
License and any other pertinent obligations, then as a consequence you may | |||||
not convey it at all. For example, if you agree to terms that obligate you | |||||
to collect a royalty for further conveying from those to whom you convey | |||||
the Program, the only way you could satisfy both those terms and this | |||||
License would be to refrain entirely from conveying the Program. | |||||
13. Use with the GNU Affero General Public License. | |||||
Notwithstanding any other provision of this License, you have | |||||
permission to link or combine any covered work with a work licensed | |||||
under version 3 of the GNU Affero General Public License into a single | |||||
combined work, and to convey the resulting work. The terms of this | |||||
License will continue to apply to the part which is the covered work, | |||||
but the special requirements of the GNU Affero General Public License, | |||||
section 13, concerning interaction through a network will apply to the | |||||
combination as such. | |||||
14. Revised Versions of this License. | |||||
The Free Software Foundation may publish revised and/or new versions of | |||||
the GNU General Public License from time to time. Such new versions will | |||||
be similar in spirit to the present version, but may differ in detail to | |||||
address new problems or concerns. | |||||
Each version is given a distinguishing version number. If the | |||||
Program specifies that a certain numbered version of the GNU General | |||||
Public License "or any later version" applies to it, you have the | |||||
option of following the terms and conditions either of that numbered | |||||
version or of any later version published by the Free Software | |||||
Foundation. If the Program does not specify a version number of the | |||||
GNU General Public License, you may choose any version ever published | |||||
by the Free Software Foundation. | |||||
If the Program specifies that a proxy can decide which future | |||||
versions of the GNU General Public License can be used, that proxy's | |||||
public statement of acceptance of a version permanently authorizes you | |||||
to choose that version for the Program. | |||||
Later license versions may give you additional or different | |||||
permissions. However, no additional obligations are imposed on any | |||||
author or copyright holder as a result of your choosing to follow a | |||||
later version. | |||||
15. Disclaimer of Warranty. | |||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | |||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | |||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | |||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | |||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | |||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | |||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |||||
16. Limitation of Liability. | |||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | |||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | |||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | |||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | |||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | |||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | |||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | |||||
SUCH DAMAGES. | |||||
17. Interpretation of Sections 15 and 16. | |||||
If the disclaimer of warranty and limitation of liability provided | |||||
above cannot be given local legal effect according to their terms, | |||||
reviewing courts shall apply local law that most closely approximates | |||||
an absolute waiver of all civil liability in connection with the | |||||
Program, unless a warranty or assumption of liability accompanies a | |||||
copy of the Program in return for a fee. | |||||
END OF TERMS AND CONDITIONS | |||||
How to Apply These Terms to Your New Programs | |||||
If you develop a new program, and you want it to be of the greatest | |||||
possible use to the public, the best way to achieve this is to make it | |||||
free software which everyone can redistribute and change under these terms. | |||||
To do so, attach the following notices to the program. It is safest | |||||
to attach them to the start of each source file to most effectively | |||||
state the exclusion of warranty; and each file should have at least | |||||
the "copyright" line and a pointer to where the full notice is found. | |||||
<one line to give the program's name and a brief idea of what it does.> | |||||
Copyright (C) <year> <name of author> | |||||
This program is free software: you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation, either version 3 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
Also add information on how to contact you by electronic and paper mail. | |||||
If the program does terminal interaction, make it output a short | |||||
notice like this when it starts in an interactive mode: | |||||
<program> Copyright (C) <year> <name of author> | |||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | |||||
This is free software, and you are welcome to redistribute it | |||||
under certain conditions; type `show c' for details. | |||||
The hypothetical commands `show w' and `show c' should show the appropriate | |||||
parts of the General Public License. Of course, your program's commands | |||||
might be different; for a GUI interface, you would use an "about box". | |||||
You should also get your employer (if you work as a programmer) or school, | |||||
if any, to sign a "copyright disclaimer" for the program, if necessary. | |||||
For more information on this, and how to apply and follow the GNU GPL, see | |||||
<http://www.gnu.org/licenses/>. | |||||
The GNU General Public License does not permit incorporating your program | |||||
into proprietary programs. If your program is a subroutine library, you | |||||
may consider it more useful to permit linking proprietary applications with | |||||
the library. If this is what you want to do, use the GNU Lesser General | |||||
Public License instead of this License. But first, please read | |||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>. |
@ -0,0 +1,712 @@ | |||||
""" | |||||
Copyright 2009 Luca Trevisan | |||||
Additional contributors: Radu Grigore | |||||
LaTeX2WP version 0.6.2 | |||||
This file is part of LaTeX2WP, a program that converts | |||||
a LaTeX document into a format that is ready to be | |||||
copied and pasted into WordPress. | |||||
You are free to redistribute and/or modify LaTeX2WP under the | |||||
terms of the GNU General Public License (GPL), version 3 | |||||
or (at your option) any later version. | |||||
I hope you will find LaTeX2WP useful, but be advised that | |||||
it comes WITHOUT ANY WARRANTY; without even the implied warranty | |||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GPL for more details. | |||||
You should have received a copy of the GNU General Public | |||||
License along with LaTeX2WP. If you can't find it, | |||||
see <http://www.gnu.org/licenses/>. | |||||
""" | |||||
import re | |||||
from sys import argv | |||||
from latex2wpstyle import * | |||||
# prepare variables computed from the info in latex2wpstyle | |||||
count = dict() | |||||
for thm in ThmEnvs: | |||||
count[T[thm]] = 0 | |||||
count["section"] = count["subsection"] = count["equation"] = 0 | |||||
ref={} | |||||
endlatex = "&fg="+textcolor | |||||
if HTML : endproof = "<img src=\"http://l.wordpress.com/latex.php?latex=\Box&fg=000000\">" | |||||
inthm = "" | |||||
""" | |||||
At the beginning, the commands \$, \% and \& are temporarily | |||||
replaced by placeholders (the second entry in each 4-tuple). | |||||
At the end, The placeholders in text mode are replaced by | |||||
the third entry, and the placeholders in math mode are | |||||
replaced by the fourth entry. | |||||
""" | |||||
esc = [["\\$","_dollar_","$","\\$"], | |||||
["\\%","_percent_","%","\\%"], | |||||
["\\&","_amp_","&","\\&"], | |||||
[">","_greater_",">",">"], | |||||
["<","_lesser_","<","<"]] | |||||
M = M + [ ["\\more","<!--more-->"], | |||||
["\\newblock","\\\\"], | |||||
["\\sloppy",""], | |||||
["\\S","§"]] | |||||
Mnomath =[["\\\\","<br/>\n"], | |||||
["\\ "," "], | |||||
["\\`a","à"], | |||||
["\\'a","á"], | |||||
["\\\"a","ä"], | |||||
["\\aa ","å"], | |||||
["{\\aa}","å"], | |||||
["\\`e","è"], | |||||
["\\'e","é"], | |||||
["\\\"e","ë"], | |||||
["\\`i","ì"], | |||||
["\\'i","í"], | |||||
["\\\"i","ï"], | |||||
["\\`o","ò"], | |||||
["\\'o","ó"], | |||||
["\\\"o","ö"], | |||||
["\\`o","ò"], | |||||
["\\'o","ó"], | |||||
["\\\"o","ö"], | |||||
["\\H o","ö"], | |||||
["\\`u","ù"], | |||||
["\\'u","ú"], | |||||
["\\\"u","ü"], | |||||
["\\`u","ù"], | |||||
["\\'u","ú"], | |||||
["\\\"u","ü"], | |||||
["\\v{C}","Č"]] | |||||
cb = re.compile("\\{|}") | |||||
def extractbody(m) : | |||||
begin = re.compile("\\\\begin\s*") | |||||
m= begin.sub("\\\\begin",m) | |||||
end = re.compile("\\\\end\s*") | |||||
m = end.sub("\\\\end",m) | |||||
beginenddoc = re.compile("\\\\begin\\{document}" | |||||
"|\\\\end\\{document}") | |||||
parse = beginenddoc.split(m) | |||||
if len(parse)== 1 : | |||||
m = parse[0] | |||||
else : | |||||
m = parse[1] | |||||
""" | |||||
removes comments, replaces double returns with <p> and | |||||
other returns and multiple spaces by a single space. | |||||
""" | |||||
for e in esc : | |||||
m = m.replace(e[0],e[1]) | |||||
comments = re.compile("%.*?\n") | |||||
m=comments.sub(" ",m) | |||||
multiplereturns = re.compile("\n\n+") | |||||
m= multiplereturns.sub ("<p>",m) | |||||
spaces=re.compile("(\n|[ ])+") | |||||
m=spaces.sub(" ",m) | |||||
""" | |||||
removes text between \iffalse ... \fi and | |||||
between \iftex ... \fi keeps text between | |||||
\ifblog ... \fi | |||||
""" | |||||
ifcommands = re.compile("\\\\iffalse|\\\\ifblog|\\\\iftex|\\\\fi") | |||||
L=ifcommands.split(m) | |||||
I=ifcommands.findall(m) | |||||
m= L[0] | |||||
for i in range(1,(len(L)+1)/2) : | |||||
if (I[2*i-2]=="\\ifblog") : | |||||
m=m+L[2*i-1] | |||||
m=m+L[2*i] | |||||
""" | |||||
changes $$ ... $$ into \[ ... \] and reformats | |||||
eqnarray* environments as regular array environments | |||||
""" | |||||
doubledollar = re.compile("\\$\\$") | |||||
L=doubledollar.split(m) | |||||
m=L[0] | |||||
for i in range(1,(len(L)+1)/2) : | |||||
m = m+ "\\[" + L[2*i-1] + "\\]" + L[2*i] | |||||
m=m.replace("\\begin{eqnarray*}","\\[ \\begin{array}{rcl} ") | |||||
m=m.replace("\\end{eqnarray*}","\\end{array} \\]") | |||||
return m | |||||
def convertsqb(m) : | |||||
r = re.compile("\\\\item\\s*\\[.*?\\]") | |||||
Litems = r.findall(m) | |||||
Lrest = r.split(m) | |||||
m = Lrest[0] | |||||
for i in range(0,len(Litems)) : | |||||
s= Litems[i] | |||||
s=s.replace("\\item","\\nitem") | |||||
s=s.replace("[","{") | |||||
s=s.replace("]","}") | |||||
m=m+s+Lrest[i+1] | |||||
r = re.compile("\\\\begin\\s*\\{\\w+}\\s*\\[.*?\\]") | |||||
Lthms = r.findall(m) | |||||
Lrest = r.split(m) | |||||
m = Lrest[0] | |||||
for i in range(0,len(Lthms)) : | |||||
s= Lthms[i] | |||||
s=s.replace("\\begin","\\nbegin") | |||||
s=s.replace("[","{") | |||||
s=s.replace("]","}") | |||||
m=m+s+Lrest[i+1] | |||||
return m | |||||
def converttables(m) : | |||||
retable = re.compile("\\\\begin\s*\\{tabular}.*?\\\\end\s*\\{tabular}" | |||||
"|\\\\begin\s*\\{btabular}.*?\\\\end\s*\\{btabular}") | |||||
tables = retable.findall(m) | |||||
rest = retable.split(m) | |||||
m = rest[0] | |||||
for i in range(len(tables)) : | |||||
if tables[i].find("{btabular}") != -1 : | |||||
m = m + convertonetable(tables[i],True) | |||||
else : | |||||
m = m + convertonetable(tables[i],False) | |||||
m = m + rest[i+1] | |||||
return m | |||||
def convertmacros(m) : | |||||
comm = re.compile("\\\\[a-zA-Z]*") | |||||
commands = comm.findall(m) | |||||
rest = comm.split(m) | |||||
r= rest[0] | |||||
for i in range( len (commands) ) : | |||||
for s1,s2 in M : | |||||
if s1==commands[i] : | |||||
commands[i] = s2 | |||||
r=r+commands[i]+rest[i+1] | |||||
return(r) | |||||
def convertonetable(m,border) : | |||||
tokens = re.compile("\\\\begin\\{tabular}\s*\\{.*?}" | |||||
"|\\\\end\\{tabular}" | |||||
"|\\\\begin\\{btabular}\s*\\{.*?}" | |||||
"|\\\\end\\{btabular}" | |||||
"|&|\\\\\\\\") | |||||
align = { "c" : "center", "l" : "left" , "r" : "right" } | |||||
T = tokens.findall(m) | |||||
C = tokens.split(m) | |||||
L = cb.split(T[0]) | |||||
format = L[3] | |||||
columns = len(format) | |||||
if border : | |||||
m = "<table border=\"1\" align=center>" | |||||
else : | |||||
m="<table align = center><tr>" | |||||
p=1 | |||||
i=0 | |||||
while T[p-1] != "\\end{tabular}" and T[p-1] != "\\end{btabular}": | |||||
m = m + "<td align="+align[format[i]]+">" + C[p] + "</td>" | |||||
p=p+1 | |||||
i=i+1 | |||||
if T[p-1]=="\\\\" : | |||||
for i in range (p,columns) : | |||||
m=m+"<td></td>" | |||||
m=m+"</tr><tr>" | |||||
i=0 | |||||
m = m+ "</tr></table>" | |||||
return (m) | |||||
def separatemath(m) : | |||||
mathre = re.compile("\\$.*?\\$" | |||||
"|\\\\begin\\{equation}.*?\\\\end\\{equation}" | |||||
"|\\\\\\[.*?\\\\\\]") | |||||
math = mathre.findall(m) | |||||
text = mathre.split(m) | |||||
return(math,text) | |||||
def processmath( M ) : | |||||
R = [] | |||||
counteq=0 | |||||
global ref | |||||
mathdelim = re.compile("\\$" | |||||
"|\\\\begin\\{equation}" | |||||
"|\\\\end\\{equation}" | |||||
"|\\\\\\[|\\\\\\]") | |||||
label = re.compile("\\\\label\\{.*?}") | |||||
for m in M : | |||||
md = mathdelim.findall(m) | |||||
mb = mathdelim.split(m) | |||||
""" | |||||
In what follows, md[0] contains the initial delimiter, | |||||
which is either \begin{equation}, or $, or \[, and | |||||
mb[1] contains the actual mathematical equation | |||||
""" | |||||
if md[0] == "$" : | |||||
if HTML : | |||||
m=m.replace("$","") | |||||
m=m.replace("+","%2B") | |||||
m=m.replace(" ","+") | |||||
m=m.replace("'","'") | |||||
m="<img src=\"http://l.wordpress.com/latex.php?latex=%7B"+m+"%7D"+endlatex+"\">" | |||||
else : | |||||
m="$latex {"+mb[1]+"}"+endlatex+"$" | |||||
else : | |||||
if md[0].find("\\begin") != -1 : | |||||
count["equation"] += 1 | |||||
mb[1] = mb[1] + "\\ \\ \\ \\ \\ ("+str(count["equation"])+")" | |||||
if HTML : | |||||
mb[1]=mb[1].replace("+","%2B") | |||||
mb[1]=mb[1].replace("&","%26") | |||||
mb[1]=mb[1].replace(" ","+") | |||||
mb[1]=mb[1].replace("'","'") | |||||
m = "<p align=center><img src=\"http://l.wordpress.com/latex.php?latex=\displaystyle " + mb[1] +endlatex+"\"></p>\n" | |||||
else : | |||||
m = "<p align=center>$latex \displaystyle " + mb[1] +endlatex+"$</p>\n" | |||||
if m.find("\\label") != -1 : | |||||
mnolab = label.split(m) | |||||
mlab = label.findall(m) | |||||
""" | |||||
Now the mathematical equation, which has already | |||||
been formatted for WordPress, is the union of | |||||
the strings mnolab[0] and mnolab[1]. The content | |||||
of the \label{...} command is in mlab[0] | |||||
""" | |||||
lab = mlab[0] | |||||
lab=cb.split(lab)[1] | |||||
lab=lab.replace(":","") | |||||
ref[lab]=count["equation"] | |||||
m="<a name=\""+lab+"\">"+mnolab[0]+mnolab[1]+"</a>" | |||||
R= R + [m] | |||||
return R | |||||
def convertcolors(m,c) : | |||||
if m.find("begin") != -1 : | |||||
return("<span style=\"color:#"+colors[c]+";\">") | |||||
else : | |||||
return("</span>") | |||||
def convertitm(m) : | |||||
if m.find("begin") != -1 : | |||||
return ("\n\n<ul>") | |||||
else : | |||||
return ("\n</ul>\n\n") | |||||
def convertenum(m) : | |||||
if m.find("begin") != -1 : | |||||
return ("\n\n<ol>") | |||||
else : | |||||
return ("\n</ol>\n\n") | |||||
def convertbeginnamedthm(thname,thm) : | |||||
global inthm | |||||
count[T[thm]] +=1 | |||||
inthm = thm | |||||
t = beginnamedthm.replace("_ThmType_",thm.capitalize()) | |||||
t = t.replace("_ThmNumb_",str(count[T[thm]])) | |||||
t = t.replace("_ThmName_",thname) | |||||
return(t) | |||||
def convertbeginthm(thm) : | |||||
global inthm | |||||
count[T[thm]] +=1 | |||||
inthm = thm | |||||
t = beginthm.replace("_ThmType_",thm.capitalize()) | |||||
t = t.replace("_ThmNumb_",str(count[T[thm]])) | |||||
return(t) | |||||
def convertendthm(thm) : | |||||
global inthm | |||||
inthm = "" | |||||
return(endthm) | |||||
def convertlab(m) : | |||||
global inthm | |||||
global ref | |||||
m=cb.split(m)[1] | |||||
m=m.replace(":","") | |||||
if inthm != "" : | |||||
ref[m]=count[T[inthm]] | |||||
else : | |||||
ref[m]=count["section"] | |||||
return("<a name=\""+m+"\"></a>") | |||||
def convertproof(m) : | |||||
if m.find("begin") != -1 : | |||||
return(beginproof) | |||||
else : | |||||
return(endproof) | |||||
def convertsection (m) : | |||||
L=cb.split(m) | |||||
""" | |||||
L[0] contains the \\section or \\section* command, and | |||||
L[1] contains the section name | |||||
""" | |||||
if L[0].find("*") == -1 : | |||||
t=section | |||||
count["section"] += 1 | |||||
count["subsection"]=0 | |||||
else : | |||||
t=sectionstar | |||||
t=t.replace("_SecNumb_",str(count["section"]) ) | |||||
t=t.replace("_SecName_",L[1]) | |||||
return(t) | |||||
def convertsubsection (m) : | |||||
L=cb.split(m) | |||||
if L[0].find("*") == -1 : | |||||
t=subsection | |||||
else : | |||||
t=subsectionstar | |||||
count["subsection"] += 1 | |||||
t=t.replace("_SecNumb_",str(count["section"]) ) | |||||
t=t.replace("_SubSecNumb_",str(count["subsection"]) ) | |||||
t=t.replace("_SecName_",L[1]) | |||||
return(t) | |||||
def converturl (m) : | |||||
L = cb.split(m) | |||||
return ("<a href=\""+L[1]+"\">"+L[3]+"</a>") | |||||
def converturlnosnap (m) : | |||||
L = cb.split(m) | |||||
return ("<a class=\"snap_noshots\" href=\""+L[1]+"\">"+L[3]+"</a>") | |||||
def convertimage (m) : | |||||
L = cb.split (m) | |||||
return ("<p align=center><img "+L[1] + " src=\""+L[3] | |||||
+"\"></p>") | |||||
def convertstrike (m) : | |||||
L=cb.split(m) | |||||
return("<s>"+L[1]+"</s>") | |||||
def processtext ( t ) : | |||||
p = re.compile("\\\\begin\\{\\w+}" | |||||
"|\\\\nbegin\\{\\w+}\\s*\\{.*?}" | |||||
"|\\\\end\\{\\w+}" | |||||
"|\\\\item" | |||||
"|\\\\nitem\\s*\\{.*?}" | |||||
"|\\\\label\\s*\\{.*?}" | |||||
"|\\\\section\\s*\\{.*?}" | |||||
"|\\\\section\\*\\s*\\{.*?}" | |||||
"|\\\\subsection\\s*\\{.*?}" | |||||
"|\\\\subsection\\*\\s*\\{.*?}" | |||||
"|\\\\href\\s*\\{.*?}\\s*\\{.*?}" | |||||
"|\\\\hrefnosnap\\s*\\{.*?}\\s*\\{.*?}" | |||||
"|\\\\image\\s*\\{.*?}\\s*\\{.*?}\\s*\\{.*?}" | |||||
"|\\\\sout\\s*\\{.*?}") | |||||
for s1, s2 in Mnomath : | |||||
t=t.replace(s1,s2) | |||||
ttext = p.split(t) | |||||
tcontrol = p.findall(t) | |||||
w = ttext[0] | |||||
i=0 | |||||
while i < len(tcontrol) : | |||||
if tcontrol[i].find("{itemize}") != -1 : | |||||
w=w+convertitm(tcontrol[i]) | |||||
elif tcontrol[i].find("{enumerate}") != -1 : | |||||
w= w+convertenum(tcontrol[i]) | |||||
elif tcontrol[i][0:5]=="\\item" : | |||||
w=w+"<li>" | |||||
elif tcontrol[i][0:6]=="\\nitem" : | |||||
lb = tcontrol[i][7:].replace("{","") | |||||
lb = lb.replace("}","") | |||||
w=w+"<li>"+lb | |||||
elif tcontrol[i].find("\\hrefnosnap") != -1 : | |||||
w = w+converturlnosnap(tcontrol[i]) | |||||
elif tcontrol[i].find("\\href") != -1 : | |||||
w = w+converturl(tcontrol[i]) | |||||
elif tcontrol[i].find("{proof}") != -1 : | |||||
w = w+convertproof(tcontrol[i]) | |||||
elif tcontrol[i].find("\\subsection") != -1 : | |||||
w = w+convertsubsection(tcontrol[i]) | |||||
elif tcontrol[i].find("\\section") != -1 : | |||||
w = w+convertsection(tcontrol[i]) | |||||
elif tcontrol[i].find("\\label") != -1 : | |||||
w=w+convertlab(tcontrol[i]) | |||||
elif tcontrol[i].find("\\image") != -1 : | |||||
w = w+convertimage(tcontrol[i]) | |||||
elif tcontrol[i].find("\\sout") != -1 : | |||||
w = w+convertstrike(tcontrol[i]) | |||||
elif tcontrol[i].find("\\begin") !=-1 and tcontrol[i].find("{center}")!= -1 : | |||||
w = w+"<p align=center>" | |||||
elif tcontrol[i].find("\\end")!= -1 and tcontrol[i].find("{center}") != -1 : | |||||
w = w+"</p>" | |||||
else : | |||||
for clr in colorchoice : | |||||
if tcontrol[i].find("{"+clr+"}") != -1: | |||||
w=w + convertcolors(tcontrol[i],clr) | |||||
for thm in ThmEnvs : | |||||
if tcontrol[i]=="\\end{"+thm+"}" : | |||||
w=w+convertendthm(thm) | |||||
elif tcontrol[i]=="\\begin{"+thm+"}": | |||||
w=w+convertbeginthm(thm) | |||||
elif tcontrol[i].find("\\nbegin{"+thm+"}") != -1: | |||||
L=cb.split(tcontrol[i]) | |||||
thname=L[3] | |||||
w=w+convertbeginnamedthm(thname,thm) | |||||
w += ttext[i+1] | |||||
i += 1 | |||||
return processfontstyle(w) | |||||
def processfontstyle(w) : | |||||
close = dict() | |||||
ww = "" | |||||
level = i = 0 | |||||
while i < len(w): | |||||
special = False | |||||
for k, v in fontstyle.items(): | |||||
l = len(k) | |||||
if w[i:i+l] == k: | |||||
level += 1 | |||||
ww += '<' + v + '>' | |||||
close[level] = '</' + v + '>' | |||||
i += l | |||||
special = True | |||||
if not special: | |||||
if w[i] == '{': | |||||
ww += '{' | |||||
level += 1 | |||||
close[level] = '}' | |||||
elif w[i] == '}' and level > 0: | |||||
ww += close[level] | |||||
level -= 1 | |||||
else: | |||||
ww += w[i] | |||||
i += 1 | |||||
return ww | |||||
def convertref(m) : | |||||
global ref | |||||
p=re.compile("\\\\ref\s*\\{.*?}|\\\\eqref\s*\\{.*?}") | |||||
T=p.split(m) | |||||
M=p.findall(m) | |||||
w = T[0] | |||||
for i in range(len(M)) : | |||||
t=M[i] | |||||
lab=cb.split(t)[1] | |||||
lab=lab.replace(":","") | |||||
if t.find("\\eqref") != -1 : | |||||
w=w+"<a href=\"#"+lab+"\">("+str(ref[lab])+")</a>" | |||||
else : | |||||
w=w+"<a href=\"#"+lab+"\">"+str(ref[lab])+"</a>" | |||||
w=w+T[i+1] | |||||
return w | |||||
""" | |||||
The program makes several passes through the input. | |||||
In a first clean-up, all text before \begin{document} | |||||
and after \end{document}, if present, is removed, | |||||
all double-returns are converted | |||||
to <p>, and all remaining returns are converted to | |||||
spaces. | |||||
The second step implements a few simple macros. The user can | |||||
add support for more macros if desired by editing the | |||||
convertmacros() procedure. | |||||
Then the program separates the mathematical | |||||
from the text parts. (It assumes that the document does | |||||
not start with a mathematical expression.) | |||||
It makes one pass through the text part, translating | |||||
environments such as theorem, lemma, proof, enumerate, itemize, | |||||
\em, and \bf. Along the way, it keeps counters for the current | |||||
section and subsection and for the current numbered theorem-like | |||||
environment, as well as a flag that tells whether one is | |||||
inside a theorem-like environment or not. Every time a \label{xx} | |||||
command is encountered, we give ref[xx] the value of the section | |||||
in which the command appears, or the number of the theorem-like | |||||
environment in which it appears (if applicable). Each appearence | |||||
of \label is replace by an html "name" tag, so that later we can | |||||
replace \ref commands by clickable html links. | |||||
The next step is to make a pass through the mathematical environments. | |||||
Displayed equations are numbered and centered, and when a \label{xx} | |||||
command is encountered we give ref[xx] the number of the current | |||||
equation. | |||||
A final pass replaces \ref{xx} commands by the number in ref[xx], | |||||
and a clickable link to the referenced location. | |||||
""" | |||||
inputfile = "wpress.tex" | |||||
outputfile = "wpress.html" | |||||
if len(argv) > 1 : | |||||
inputfile = argv[1] | |||||
if len(argv) > 2 : | |||||
outputfile = argv[2] | |||||
else : | |||||
outputfile = inputfile.replace(".tex",".html") | |||||
f=open(inputfile) | |||||
s=f.read() | |||||
f.close() | |||||
""" | |||||
extractbody() takes the text between a \begin{document} | |||||
and \end{document}, if present, (otherwise it keeps the | |||||
whole document), normalizes the spacing, and removes comments | |||||
""" | |||||
s=extractbody(s) | |||||
# formats tables | |||||
s=converttables(s) | |||||
# reformats optional parameters passed in square brackets | |||||
s=convertsqb(s) | |||||
#implement simple macros | |||||
s=convertmacros(s) | |||||
# extracts the math parts, and replaces the with placeholders | |||||
# processes math and text separately, then puts the processed | |||||
# math equations in place of the placeholders | |||||
(math,text) = separatemath(s) | |||||
s=text[0] | |||||
for i in range(len(math)) : | |||||
s=s+"__math"+str(i)+"__"+text[i+1] | |||||
s = processtext ( s ) | |||||
math = processmath ( math ) | |||||
# converts escape sequences such as \$ to HTML codes | |||||
# This must be done after formatting the tables or the '&' in | |||||
# the HTML codes will create problems | |||||
for e in esc : | |||||
s=s.replace(e[1],e[2]) | |||||
for i in range ( len ( math ) ) : | |||||
math[i] = math[i].replace(e[1],e[3]) | |||||
# puts the math equations back into the text | |||||
for i in range(len(math)) : | |||||
s=s.replace("__math"+str(i)+"__",math[i]) | |||||
# translating the \ref{} commands | |||||
s=convertref(s) | |||||
if HTML : | |||||
s="<head><style>body{max-width:55em;}a:link{color:#4444aa;}a:visited{color:#4444aa;}a:hover{background-color:#aaaaFF;}</style></head><body>"+s+"</body></html>" | |||||
s = s.replace("<p>","\n<p>\n") | |||||
f=open(outputfile,"w") | |||||
f.write(s) | |||||
f.close() |
@ -0,0 +1,108 @@ | |||||
""" | |||||
Copyright 2009 Luca Trevisan | |||||
Additional contributors: Radu Grigore | |||||
LaTeX2WP version 0.6.2 | |||||
This file is part of LaTeX2WP, a program that converts | |||||
a LaTeX document into a format that is ready to be | |||||
copied and pasted into WordPress. | |||||
You are free to redistribute and/or modify LaTeX2WP under the | |||||
terms of the GNU General Public License (GPL), version 3 | |||||
or (at your option) any later version. | |||||
I hope you will find LaTeX2WP useful, but be advised that | |||||
it comes WITHOUT ANY WARRANTY; without even the implied warranty | |||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GPL for more details. | |||||
You should have received a copy of the GNU General Public | |||||
License along with LaTeX2WP. If you can't find it, | |||||
see <http://www.gnu.org/licenses/>. | |||||
""" | |||||
# Lines starting with #, like this one, are comments | |||||
# change to HTML = True to produce standard HTML | |||||
HTML = False | |||||
# color of LaTeX formulas | |||||
textcolor = "000000" | |||||
# colors that can be used in the text | |||||
colors = { "red" : "ff0000" , "green" : "00ff00" , "blue" : "0000ff" } | |||||
# list of colors defined above | |||||
colorchoice = ["red","green","blue"] | |||||
# counters for theorem-like environments | |||||
# assign any counter to any environment. Make sure that | |||||
# maxcounter is an upper bound to the any counter being used | |||||
T = { "theorem" : 0 , "lemma" : 0 , "proposition" : 0, "definition" : 0, | |||||
"corollary" : 0, "remark" : 3 , "example" : 1, "claim" : 4, | |||||
"exercise" : 2 } | |||||
# list of theorem-like environments | |||||
ThmEnvs = ["theorem","definition","lemma","proposition","corollary","claim", | |||||
"remark","example","exercise"] | |||||
# the way \begin{theorem}, \begin{lemma} etc are translated in HTML | |||||
# the string _ThmType_ stands for the type of theorem | |||||
# the string _ThmNumb_ is the theorem number | |||||
beginthm = "\n<blockquote><b>_ThmType_ _ThmNumb_</b> <em>" | |||||
# translation of \begin{theorem}[...]. The string | |||||
# _ThmName_ stands for the content betwee the | |||||
# square brackets | |||||
beginnamedthm = "\n<blockquote><b>_ThmType_ _ThmNumb_ (_ThmName_)</b> <em>" | |||||
#translation of \end{theorem}, \end{lemma}, etc. | |||||
endthm = "</em></blockquote>\n<p>\n" | |||||
beginproof = "<em>Proof:</em> " | |||||
endproof = "$latex \Box&fg=000000$\n\n" | |||||
section = "\n<p>\n<b>_SecNumb_. _SecName_ </b>\n<p>\n" | |||||
sectionstar = "\n<p>\n<b> _SecName_ </b>\n<p>\n" | |||||
subsection = "\n<p>\n<b> _SecNumb_._SubSecNumb_. _SecName_ </b>\n<p>\n" | |||||
subsectionstar = "\n<p>\n<b> _SecName_ </b>\n<p>\n" | |||||
# Font styles. Feel free to add others. The key *must* contain | |||||
# an open curly bracket. The value is the namem of a HTML tag. | |||||
fontstyle = { | |||||
r'{\em ' : 'em', | |||||
r'{\bf ' : 'b', | |||||
r'{\it ' : 'i', | |||||
r'{\sl ' : 'i', | |||||
r'\textit{' : 'i', | |||||
r'\textsl{' : 'i', | |||||
r'\emph{' : 'em', | |||||
r'\textbf{' : 'b', | |||||
} | |||||
# Macro definitions | |||||
# It is a sequence of pairs [string1,string2], and | |||||
# latex2wp will replace each occurrence of string1 with an | |||||
# occurrence of string2. The substitutions are performed | |||||
# in the same order as the pairs appear below. | |||||
# Feel free to add your own. | |||||
# Note that you have to write \\ instead of \ | |||||
# and \" instead of " | |||||
M = [ ["\\to","\\rightarrow"] , | |||||
["\\B","\\{ 0,1 \\}" ], | |||||
["\\E","\mathop{\\mathbb E}"], | |||||
["\\P","\mathop{\\mathbb P}"], | |||||
["\\N","{\\mathbb N}"], | |||||
["\\Z","{\\mathbb Z}"], | |||||
["\\C","{\\mathbb C}"], | |||||
["\\R","{\\mathbb R}"], | |||||
["\\Q","{\\mathbb Q}"], | |||||
["\\xor","\\oplus"], | |||||
["\\eps","\\epsilon"] | |||||
] | |||||
@ -0,0 +1,56 @@ | |||||
%%%%%%%%% For wordpress conversion | |||||
\def\more{} | |||||
\newif\ifblog | |||||
\newif\iftex | |||||
\blogfalse | |||||
\textrue | |||||
\usepackage{ulem} | |||||
\def\em{\it} | |||||
\def\emph#1{\textit{#1}} | |||||
\def\image#1#2#3{\begin{center}\includegraphics[#1pt]{#3}\end{center}} | |||||
\let\hrefnosnap=\href | |||||
\newenvironment{btabular}[1]{\begin{tabular} {#1}}{\end{tabular}} | |||||
\newenvironment{red}{\color{red}}{} | |||||
\newenvironment{green}{\color{green}}{} | |||||
\newenvironment{blue}{\color{blue}}{} | |||||
%%%%%%%%% Typesetting shortcuts | |||||
\def\B{\{0,1\}} | |||||
\def\xor{\oplus} | |||||
\def\P{{\mathbb P}} | |||||
\def\E{{\mathbb E}} | |||||
\def\var{{\bf Var}} | |||||
\def\N{{\mathbb N}} | |||||
\def\Z{{\mathbb Z}} | |||||
\def\R{{\mathbb R}} | |||||
\def\C{{\mathbb C}} | |||||
\def\Q{{\mathbb Q}} | |||||
\def\eps{{\epsilon}} | |||||
\def\bz{{\bf z}} | |||||
\def\true{{\tt true}} | |||||
\def\false{{\tt false}} | |||||
%%%%%%%%% Theorems and proofs | |||||
\newtheorem{exercise}{Exercise} | |||||
\newtheorem{theorem}{Theorem} | |||||
\newtheorem{lemma}[theorem]{Lemma} | |||||
\newtheorem{definition}[theorem]{Definition} | |||||
\newtheorem{corollary}[theorem]{Corollary} | |||||
\newtheorem{proposition}[theorem]{Proposition} | |||||
\newtheorem{example}{Example} | |||||
\newtheorem{remark}[theorem]{Remark} | |||||
\newenvironment{proof}{\noindent {\sc Proof:}}{$\Box$ \medskip} |
@ -0,0 +1,22 @@ | |||||
\documentclass[12pt]{article} | |||||
\usepackage[pdftex,pagebackref,letterpaper=true,colorlinks=true,pdfpagemode=none,urlcolor=blue,linkcolor=blue,citecolor=blue,pdfstartview=FitH]{hyperref} | |||||
\usepackage{amsmath,amsfonts} | |||||
\usepackage{graphicx} | |||||
\usepackage{color} | |||||
\setlength{\oddsidemargin}{0pt} | |||||
\setlength{\evensidemargin}{0pt} | |||||
\setlength{\textwidth}{6.0in} | |||||
\setlength{\topmargin}{0in} | |||||
\setlength{\textheight}{8.5in} | |||||
\setlength{\parindent}{0in} | |||||
\setlength{\parskip}{5px} | |||||
\input{macrosblog} | |||||
\begin{document} | |||||
\end{document} |
@ -0,0 +1,155 @@ | |||||
HOW TO GET STARTED | |||||
Have latex2wp.py,latex2wpstyle.py, macrosblog.tex and your tex file | |||||
in the same directory. Use post-template.tex as a starting | |||||
point, writing your text between the \begin{document} | |||||
and \end{document}. | |||||
HOW TO USE | |||||
In the directory in which latex2wp.py and your | |||||
tex file are both present, type | |||||
python latex2wp.py yourlatexfile.tex | |||||
this will produce a file called yourlatexfile.html which | |||||
is ready to be cut and pasted into WordPress. | |||||
-------------------- | |||||
WHAT WORKS | |||||
See the file example.tex to see how to import figures, have | |||||
text appear in different colors, have links to URLs, and | |||||
enter the "more" command of WordPress. | |||||
Anything between a "\iftex . . . \fi" is compiled in LaTeX | |||||
but ignored in the conversion to WordPress; anything between | |||||
"\ifblog . . . \fi" is converted to WordPress but ignored | |||||
by LaTeX. Anything between a "\iffalse . . . \fi" is ignored | |||||
by both. | |||||
A few macros are predefined, such as \E for \mathop{\mathbb E}, | |||||
\P for \mathop{\mathbb P} and so on. | |||||
Several theorem-like numbered environments are supported, | |||||
such as "theorem", "lemma", "proposition", "remark", "corollary", | |||||
"example" and "exercise. In addition, there is the "proof" | |||||
environment. | |||||
You can use the inline math environment $...$ and the | |||||
displayed math environments $$...$$, \[ ... \], | |||||
\begin{equation} ... \end{equation}, and | |||||
\begin{eqnarray*} ... \end{eqnarray*}. | |||||
The tabular environment works | |||||
\label{}, \eqref{} and \ref{} work in the standard way. | |||||
------------------- | |||||
WHAT DOESN'T WORK | |||||
WordPress has some limitations to the kind of latex equations | |||||
it can display. As a consequence, align and eqnarray are | |||||
not supported. You can, however, use eqnarray* and you can use | |||||
array inside a math environment. | |||||
There is no support for \medskip, \bigskip and other such | |||||
formatting commands. The return command \\ is recognized. | |||||
\section, \section*, \subsection and \subsection* are supported, | |||||
but not \subsubsection and so on. | |||||
There is no support for bibliographic references | |||||
There is no support for footnotes. | |||||
------------------------ | |||||
HOW TO CUSTOMIZE | |||||
The file latex2wpstyle.py can be easily modified to | |||||
make the program create pure HTML, to add new macros, | |||||
to add new theorem-like environments or change their | |||||
numbering conventions, or to change the typesetting | |||||
design of theorem-like environments and other details. | |||||
- Creating pure HTML: | |||||
If the variable HTML is set to True | |||||
at the beginning of the program, then pure HTML code | |||||
is generated, which can be previewed locally with a browser. | |||||
- Adding new macros: | |||||
The variable M in latex2wpstyle.py contains | |||||
a list of pair of strings. For every pair, every occurrence | |||||
of the first string is replaced by an occurrence of the second | |||||
string. Add your own macros as needed. Note that a backslash \ | |||||
must be written twice as \\, and a quote sign " must be written | |||||
as \", so that for example the accent command \" must be written | |||||
as \\\". Any macro you define in M must of course also be defined | |||||
in macrosblog.tex in order for the latex file to be compiled | |||||
and previewed as pdf. | |||||
- Numbering conventions of numbered theorem-like environments: | |||||
As in the TeX compiler, the program keeps several counters, | |||||
for sections, subsections, equations, and theorem-like environments. | |||||
Often, one wants certain environments to share the same counter, so | |||||
that for example Lemma 2 is followed by Theorem 3 even if Theorem 3 | |||||
is the first theorem to appear. | |||||
The variable T declared at the beginning of the program is a table | |||||
that specifies which counter is used for which environment. Change | |||||
the assignment to follow different numbering conventions. Any | |||||
number strictly less than numberofcounters can be used to denote | |||||
a counter in T. Increase the value of numberofcounters if you want | |||||
to use a bigger range of counters in T. | |||||
- Creating new theorem-like environments: | |||||
Just add the name of the new environment, for example "conjecture", | |||||
to the list ThmEnvs of currently supported environments. Choose a | |||||
counter number, for example 0, to use for it, and add the entry | |||||
"conjecture" : 0 | |||||
to T. Now the program recognizes \begin{conjecture}...\end{conjecture} | |||||
and will number conjectures using counter 0. Add a \newtheorem | |||||
definition in macrosblog.tex in order to be able to compile a | |||||
latex file that uses this new environment. | |||||
- Formatting of Theorem-like environments: | |||||
The string beginthm specifies what to do at the | |||||
beginning of a theorem-like environment. In the string, | |||||
_ThmType_ will be replaced by the type of theorem | |||||
(e.g. Theorem, or Lemma, or Corollary, etc.) and | |||||
_ThmNumb_ will be replaced by the theorem number. | |||||
So the standard setting | |||||
beginthm= "\n<blockquote><b>_ThmType_ _ThmNumb_</b> <em>" | |||||
will start a blockquote environment, write in boldface | |||||
something like "Theorem 3", and then start an emphasized | |||||
environment. | |||||
beginnamedthm specifies what to do at the beginning of | |||||
a theorem-like environment declared by something like | |||||
\begin{theorem}[Fundamental Theorem of Calculus] .... | |||||
the string _ThmName_ holds the content of the text in | |||||
square brackets in the original LaTeX | |||||
endthm specifies what to do at the end of a theorem-like | |||||
environment. | |||||
- Formatting of the proof environment | |||||
Set the beginproof and endproof variables | |||||
- Formatting of sections and subsections | |||||
Set the section, sectionstar, subsection, and subsectionstar | |||||
variables | |||||
@ -0,0 +1,106 @@ | |||||
""" | |||||
Copyright 2009 Luca Trevisan | |||||
Additional contributors: Radu Grigore | |||||
LaTeX2WP version 0.6.2 | |||||
This file is part of LaTeX2WP, a program that converts | |||||
a LaTeX document into a format that is ready to be | |||||
copied and pasted into WordPress. | |||||
You are free to redistribute and/or modify LaTeX2WP under the | |||||
terms of the GNU General Public License (GPL), version 3 | |||||
or (at your option) any later version. | |||||
I hope you will find LaTeX2WP useful, but be advised that | |||||
it comes WITHOUT ANY WARRANTY; without even the implied warranty | |||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GPL for more details. | |||||
You should have received a copy of the GNU General Public | |||||
License along with LaTeX2WP. If you can't find it, | |||||
see <http://www.gnu.org/licenses/>. | |||||
""" | |||||
# Lines starting with #, like this one, are comments | |||||
# change to HTML = True to produce standard HTML | |||||
HTML = False | |||||
# color of LaTeX formulas | |||||
textcolor = "000000" | |||||
# colors that can be used in the text | |||||
colors = { "red" : "ff0000" , "green" : "00ff00" , "blue" : "0000ff" } | |||||
# list of colors defined above | |||||
colorchoice = ["red","green","blue"] | |||||
# counters for theorem-like environments | |||||
# assign any counter to any environment. Make sure that | |||||
# maxcounter is an upper bound to the any counter being used | |||||
maxcounter = 5 | |||||
T = { "theorem" : 0 , "lemma" : 0 , "proposition" : 0, "definition" : 0, | |||||
"corollary" : 0, "remark" : 3 , "example" : 1, "claim" : 4, | |||||
"exercise" : 2 } | |||||
# list of theorem-like environments defined above | |||||
ThmEnvs = ["theorem","definition","lemma","proposition","corollary","claim", | |||||
"remark","example","exercise"] | |||||
# the way \begin{theorem}, \begin{lemma} etc are translated in HTML | |||||
# the string _ThmType_ stands for the type of theorem | |||||
# the string _ThmNumb_ is the theorem number | |||||
beginthm = "\n<blockquote><b>_ThmType_ _ThmNumb_</b> " | |||||
# translation of \begin{theorem}[...]. The string | |||||
# _ThmName_ stands for the content betwee the | |||||
# square brackets | |||||
beginnamedthm = "\n<blockquote><b>_ThmType_ _ThmNumb_ (_ThmName_)</b> " | |||||
#translation of \end{theorem}, \end{lemma}, etc. | |||||
endthm = "</blockquote>\n<p>\n" | |||||
beginproof = "<em>Proof:</em> " | |||||
endproof = "$latex \Box&fg=000000$\n\n" | |||||
section = "\n<p align=center><b> — _SecNumb_. _SecName_ — </b></p>\n\n" | |||||
sectionstar = "\n<p align=center><b> — _SecName_ — </b></p>\n\n" | |||||
subsection = "\n<p align=center><b> — _SecNumb_._SubSecNumb_. _SecName_ — </b></p>\n\n" | |||||
subsectionstar = "\n<p align=center><b> — _SecName_ —</b></p>\n\n" | |||||
# Font styles. Feel free to add others. The key *must* contain | |||||
# an open curly bracket. The value is the namem of a HTML tag. | |||||
fontstyle = { | |||||
r'{\em ' : 'em', | |||||
r'{\bf ' : 'b', | |||||
r'{\it ' : 'i', | |||||
r'{\sl ' : 'i', | |||||
r'\textit{' : 'i', | |||||
r'\textsl{' : 'i', | |||||
r'\emph{' : 'em', | |||||
r'\textbf{' : 'b', | |||||
} | |||||
# Macro definitions | |||||
# It is a sequence of pairs [string1,string2], and | |||||
# latex2wp will replace each occurrence of string1 with an | |||||
# occurrence of string2. The substitutions are performed | |||||
# in the same order as the pairs appear below. | |||||
# Feel free to add your own. | |||||
# Note that you have to write \\ instead of \ | |||||
# and \" instead of " | |||||
M = [ ["\\to","\\rightarrow"] , | |||||
["\\E","\mathop{\\mathbb E}"], | |||||
["\\P","\mathop{\\mathbb P}"], | |||||
["\\N","{\\mathbb N}"], | |||||
["\\Z","{\\mathbb Z}"], | |||||
["\\C","{\\mathbb C}"], | |||||
["\\R","{\\mathbb R}"], | |||||
["\\Q","{\\mathbb Q}"], | |||||
["\\xor","\\oplus"], | |||||
["\\eps","\\epsilon"] | |||||
] | |||||